【问题标题】:DateTimePicker Missing Dropdown ButtonDateTimePicker 缺少下拉按钮
【发布时间】:2022-08-05 20:20:24
【问题描述】:

我在用户控件上有两个 xctk:DateTimePickers。我不认为这是问题所在,但他们的 IsEnabled 属性绑定到同一个用户控件上的单选按钮 IsChecked 属性。 问题是他们中只有一个可以有一个下拉按钮,一次显示日历。当它被加载时,只有最后一个加载的有一个,但是当它们被启用时,只有另一个有它。 TimePicker 在他们的日历显示上也有类似的问题。

即使没有资源,问题仍然存在,因此那里可能没有任何相关内容。 可能还需要注意的是按钮实际上在那里,箭头似乎是缺少的。 这是此特定部分的 xaml:

<StackPanel HorizontalAlignment=\"Stretch\" Margin=\"10\">
        <RadioButton GroupName=\"dateOptions\" IsChecked=\"True\" ToolTip=\"Show the most recent date at 1Hz refresh rate.\" Margin=\"{StaticResource DefaultMargin }\">Scope Mode</RadioButton>
        <RadioButton x:Name=\"RadioButtonLogBrowser\" IsChecked=\"{Binding IsDateRange, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}\" GroupName=\"dateOptions\" ToolTip=\"Browse History by date range\" Margin=\"{StaticResource DefaultMargin }\">Log Browser Mode</RadioButton>
        <Grid Margin=\"20,0,0,0\" IsEnabled=\"{Binding IsChecked, ElementName=RadioButtonLogBrowser,Mode=OneWay, UpdateSourceTrigger=PropertyChanged}\">
            <Grid.RowDefinitions>
                <RowDefinition Height=\"Auto\"/>
                <RowDefinition Height=\"Auto\"/>
                <RowDefinition Height=\"Auto\"/>
                <RowDefinition Height=\"Auto\"/>
            </Grid.RowDefinitions>
            <Label  Margin=\"{StaticResource DefaultMargin }\">Start Date:</Label>
            <xctk:DateTimePicker HorizontalAlignment=\"Stretch\" x:Name=\"StartDate\" Grid.Row=\"1\" Margin=\"{StaticResource DefaultMargin }\" >
                <xctk:DateTimePicker.Resources>
                    <ResourceDictionary>
                        <ResourceDictionary.MergedDictionaries>
                            <ResourceDictionary Source=\"..\\..\\GeneralResources.xaml\" />
                        </ResourceDictionary.MergedDictionaries>
                    </ResourceDictionary>
                </xctk:DateTimePicker.Resources>
            </xctk:DateTimePicker>
                <Label Grid.Row=\"2\" Margin=\"{StaticResource DefaultMargin }\">Start Date:</Label>
            <xctk:DateTimePicker HorizontalAlignment=\"Stretch\" x:Name=\"EndDate\" Grid.Row=\"3\" Margin=\"{StaticResource DefaultMargin }\">
                <xctk:DateTimePicker.Resources>
                    <ResourceDictionary>
                        <ResourceDictionary.MergedDictionaries>
                            <ResourceDictionary Source=\"..\\..\\GeneralResources.xaml\" />
                        </ResourceDictionary.MergedDictionaries>
                    </ResourceDictionary>
                </xctk:DateTimePicker.Resources>
            </xctk:DateTimePicker>
        </Grid>```
  • 我无法重现您的问题。除了DefaultMargin(用10替换它)和GeneralResources.xaml之外,我使用了你的代码,因为我没有它。尝试我的方式,如果它修复了它,那么GeneralResources.xaml 可能是你的问题。
  • 谢谢,安德鲁。我尝试删除两者,但都没有奏效。我之前在其他项目上使用过DateTimePicker,并且没有遇到任何问题。我希望有人以前遇到过这个问题并且能够解决它。

标签: wpf wpf-extended-toolkit


【解决方案1】:

对于将来遇到此问题的人: 这是一个已知的组件问题,在最新版本 4.3.0 中已解决。

在 DateTimePicker 中,使用多个自定义 DateTimePicker 现在会在每个 DateTimePicker 上显示下拉按钮。

参考:https://github.com/xceedsoftware/wpftoolkit/wiki/Improvements-in-v4.3.0

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-07
    • 2022-01-20
    • 1970-01-01
    • 2022-09-24
    • 1970-01-01
    • 2015-01-07
    • 2017-03-28
    • 2018-11-17
    相关资源
    最近更新 更多