【发布时间】: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,并且没有遇到任何问题。我希望有人以前遇到过这个问题并且能够解决它。