我的内置Datepicker
的弹出窗口:
<materialDesign:PopupBox StaysOpen="True">
<DatePicker Focusable="False"/>
</materialDesign:PopupBox>
当我选择日期Datepicker
将自动关闭时,以及弹出窗口。当我从弹出窗口中的Popup
选择日期时,如何阻止Datepicker
关闭?
正如你所看到的,我尝试将属性StaysOpen
改为真,但似乎没有工作,差不多,不是在这种情况下。
答案 0 :(得分:1)
如果我从DatePicker中取出Focusable="False"
,当我在DatePicker中选择日期时,PopupBox将保持打开状态。
<materialDesign:PopupBox StaysOpen="True">
<local:DatePicker2 />
</materialDesign:PopupBox>
C#
public class DatePicker2 : DatePicker
{
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (GetTemplateChild("PART_TextBox") is TextBox textBox)
{
textBox.IsReadOnly = true;
}
}
}
你去,一个价格的两个答案。