I have an issue with getting a property to be shown in a DataGridComboBoxColumn. However, when selecting a value from this combobox, the setter will be updated and the database will change when saved. (So basically its working UI -> Model, but I dont think Model -> UI..)
Basically I have a DataGridComboBoxColumn that is bounded to a Enum. Here is the XAML of where I think the issue lies.
<DataGrid x:Name="dgProductItem"
ItemsSource="{Binding ProductVersion.ProductItems}"
<DataGridComboBoxColumn Header="Deployment Type"
SelectedItemBinding="{Binding DeploymentType, Mode=TwoWay}"
SelectedValuePath="DeploymentType" Width="120">
And here is the rest of the code for the DataGridComboBoxColumn
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource"
Value="{Binding Source={StaticResource DeploymentTypeEnum}}"/>
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource"
Value="{Binding Source={StaticResource DeploymentTypeEnum}}"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
But as I say, when a user selects a value from the combo box, the setter will be updated so I don't think its too far off.
Here is the property code.
public DeploymentType DeploymentType
{
get
{
return m_DeploymentType;
}
set
{
m_DeploymentType = value
PropertyChanged("DeploymentType")
}
}
Any help would be useful.
Thanks