Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# CalendarDatePicker内部按钮弹出按钮_C#_Xaml_Uwp - Fatal编程技术网

C# CalendarDatePicker内部按钮弹出按钮

C# CalendarDatePicker内部按钮弹出按钮,c#,xaml,uwp,C#,Xaml,Uwp,我想使用CalendarDatePicker内部按钮弹出按钮,如下所示: <Button> <Button.Flyout> <Flyout> <StackPanel> <CalendarDatePicker x:Name="calendar"></CalendarDatePicker>

我想使用CalendarDatePicker内部按钮弹出按钮,如下所示:

<Button>
   <Button.Flyout>
      <Flyout>
         <StackPanel>
             <CalendarDatePicker x:Name="calendar"></CalendarDatePicker>                                          
             <Button Click="Button_Click">Save</Button>
         </StackPanel>
      </Flyout>
   </Button.Flyout>
</Button>

拯救

但当我点击日历时,整个弹出按钮消失了。我的目标是Windows10UWP应用程序。有什么办法解决吗?谢谢。

您可能无法在弹出型按钮内使用CalendarDatePicker-只要选择一个选项,弹出型按钮就会关闭,在这种情况下,单击“控件”以显示日历后,弹出型按钮将与打开的日历一起关闭(如果按住控件,您甚至可能会看到它一段时间)。在这种情况下,您可以使用例如Popup或ContentDialog

XAML:


拯救
拯救
代码隐藏:

private void按钮\u单击(对象发送者,路由目标)
{
//一些逻辑
//calendarPopup.IsOpen=false;
calendarDialog.Hide();
}
私有异步void showCalndarButton_Click(对象发送方,RoutedEventArgs e)
{
//calendarPopup.IsOpen=true;
等待calendarDialog.ShowAsync();
}

在这种情况下,无论是ContentDialog还是Popup,您都必须自行设计。

OK,如果按钮位于ListView数据模板内,该怎么办?@Vodáček我认为您应该能够从定义ListView的数据模板中公开click事件,并执行相同的操作。您可能还可以为datatemplate构建UserControl。