Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1590
Cannot edit (or even select) cell when applying CellValuePresenter
posted

Hello,

I'm trying to create a column in the XamDataGrid that shows an enumeration value. This enumeration value is displayed as a symbol instead of plain text. Users can click the column and edit the value, in which case they will see a dropdownlist with all enumeration values displayed as symbols. The following snippet is part of my code:

<igDP:Field Name="Status" Label="State" Width="40">

<igDP:Field.Settings>

<igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}" EditAsType="{x:Type model:MyEnumeration}">

<igDP:FieldSettings.CellValuePresenterStyle>

<Style TargetType="igDP:CellValuePresenter">

<Setter Property="Template">

<Setter.Value>

<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">

<ContentPresenter Content="{TemplateBinding Value}" />

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

</igDP:FieldSettings.CellValuePresenterStyle>

<igDP:FieldSettings.EditorStyle>

<Style TargetType="{x:Type igEditors:XamComboEditor}">

<Setter Property="ItemsProvider">

<Setter.Value>

<igEditors:ComboBoxItemsProvider ItemsSource="{Binding Source={StaticResource MyEnumerationValuesProvider}}" />

</Setter.Value>

</Setter>

<Setter Property="DropDownButtonDisplayMode" Value="OnlyInEditMode" />

</Style>

</igDP:FieldSettings.EditorStyle>

</igDP:FieldSettings>

</igDP:Field.Settings>

</igDP:Field>

MyEnumeration is the enumeration of course. MyEnumerationValuesProvider is an ObjectDataProvider that returns all enumeration values. I also have a data template set to the enumeration type, but for some reason this data template is not applied to the column. It is applied correctly when entering edit mode however. So, to correct this I added the CellValuePresenterStyle as you can see, but now I cannot edit or even select the cell anymore. Even when I set the following properties on the FieldSettings, I still cannot select or edit the column values:

AllowEdit="True" CellClickAction="SelectCell" LabelClickAction="SelectField"

 Any advice is appreciated!

Parents Reply Children
No Data