在Windows 10 XAML C#中的按钮弹出窗口上组合DataPicker和TimePicker

时间:2016-08-29 07:11:24

标签: c# xaml windows-10-mobile

我正在制作UWP应用程序(Windows 10)。我想在Button Flyout中组合DatePicker和TimePicker。 为此,我写了下面的代码。

<Button Height="30" Width="30" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" x:Name="ButtonSetAlarmTime">
    <Button.Flyout>
        <Flyout>
            <Grid Height="100">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <CalendarDatePicker x:Name="CalendarDatePickerAlarmDate" />
                <TimePicker x:Name="TimePickerAlarmTime" Grid.Row="1"/>
            </Grid>
        </Flyout>
    </Button.Flyout>
    <Button.Background>
        <ImageBrush ImageSource="Assets/alarm-icon.png" Stretch="UniformToFill"></ImageBrush>
    </Button.Background>
</Button>

DatePicker和TimePicker按预期显示。 enter image description here 但问题是当我点击任何选择器时,Flyout会关闭。

还有其他办法吗?

提前谢谢你。

0 个答案:

没有答案