我有一个XamDataGrid
绑定到 DateTime 的字段的 Infragistics。由于用户只能从一组预定义的日期中进行选择,因此我使用 aXamComboEditor
来编辑该字段。我想为日期指定格式,并且我已经成功地为下拉菜单这样做了。但是,我无法设置字段“预览”的日期格式(即当字段未处于编辑模式时)。
在下拉列表中,格式是正确的,例如“01/06/2010 12:00:00”,但在预览列中呈现为“06/01/2010 12:00:00”。如何设置“预览”的日期格式?
该字段的 XAML:
<igWPF:Field Name="ReferenceDate" Label="Reference date">
<igWPF:Field.Settings>
<igWPF:FieldSettings EditorType="{x:Type igWPF:XamComboEditor}">
<igWPF:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igWPF:XamComboEditor}">
<Setter Property="ComboBoxStyle">
<Setter.Value>
<Style TargetType="ComboBox">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<!-- Works just fine, but only in edit-mode -->
<TextBlock Text="{Binding Converter={StaticResource dateTimeConverter}}" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="SelectedItem" Value="{Binding DataItem.ReferenceDate}" />
</Style>
</Setter.Value>
</Setter>
<Setter Property="ItemsSource" Value="{Binding DataItem.AvailableReferenceDates}"/>
<Setter Property="DropDownResizeMode" Value="None"/>
<Setter Property="IsReadOnly" Value="{Binding DataItem.HasVariance, Converter={StaticResource invertBooleanConverter}}" />
<!-- Does not seem to work -->
<Setter Property="Format" Value="{x:Static ValueConverters:DateTimeLongFormatConverter.DateFormat}" />
</Style>
</igWPF:FieldSettings.EditorStyle>
</igWPF:FieldSettings>
</igWPF:Field.Settings>
</igWPF:Field>