Formatting preview of DateTime-column in XamDataGrid when editor is
XamComboEditor
I have an Infragistics XamDataGrid with a field that is bound to a
DateTime. Since the user only can choose from a predefined set of dates, I
use a XamComboEditor to edit the field. I want to specify formatting for
the dates and I have successfully been able to do so for the drop down.
However, I'm not able to set the date format of the "preview" of the field
(i.e. when the field is not in edit mode).
How do I set the date format of the "preview"?
The XAML for the field:
<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>
No comments:
Post a Comment