Hello,
I got some issues with setting a Value in an Object depending on the Selection in a GridViewComboBoxColumn.
I have a List of Objects bound to a RadGridView. An Object contains a List of valid Value-Objects for a Value-Property the Object has. What I want to do is now bind the List of valid Value-Objects to the ComboBoxes of the Column ( each Object has a different List of valid Value-Objects) and set the Value-Property of the referring Object depending on the SelectedItem in the ComboBox.
Object ()
{
string Name {get; set;}
int Number {get;set;}
List<Value> ValidValues;
Value Value {get; set;}
bool Visibility {get;set;}
}
Value()
{
string Description {get;set;}
string Key {get;private set;}
}
<telerik:RadGridView ItemsSource="{Binding Objects}" AutoGenerateColumns="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Nr." DataMemberBinding="{Binding Number}" IsReadOnly="True">
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Name" IsReadOnly="True" DataMemberBinding="{Binding Name}">
</telerik:GridViewDataColumn>
<telerik:GridViewCheckBoxColumn Header="Visibility" IsReadOnly="True" DataMemberBinding="{Binding IsVisible}">
</telerik:GridViewCheckBoxColumn>
<telerik:GridViewComboBoxColumn Header="Value"
Width="250"
ItemsSourceBinding="{Binding ValidValues}"
DisplayMemberPath="Description"
IsComboBoxEditable="False"
DataMemberBinding="{Binding Key}"
SelectedValueMemberPath="Key" // I have to set that to Key because otherwise the Combobox is not showing anything when the respective row is not more on focus //
>
</telerik:GridViewComboBoxColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
I hope this is enough code to understand what my problem is and offer me some help if possible. Thank you!
Regards,
Achim
I got some issues with setting a Value in an Object depending on the Selection in a GridViewComboBoxColumn.
I have a List of Objects bound to a RadGridView. An Object contains a List of valid Value-Objects for a Value-Property the Object has. What I want to do is now bind the List of valid Value-Objects to the ComboBoxes of the Column ( each Object has a different List of valid Value-Objects) and set the Value-Property of the referring Object depending on the SelectedItem in the ComboBox.
Object ()
{
string Name {get; set;}
int Number {get;set;}
List<Value> ValidValues;
Value Value {get; set;}
bool Visibility {get;set;}
}
Value()
{
string Description {get;set;}
string Key {get;private set;}
}
<telerik:RadGridView ItemsSource="{Binding Objects}" AutoGenerateColumns="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Nr." DataMemberBinding="{Binding Number}" IsReadOnly="True">
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Name" IsReadOnly="True" DataMemberBinding="{Binding Name}">
</telerik:GridViewDataColumn>
<telerik:GridViewCheckBoxColumn Header="Visibility" IsReadOnly="True" DataMemberBinding="{Binding IsVisible}">
</telerik:GridViewCheckBoxColumn>
<telerik:GridViewComboBoxColumn Header="Value"
Width="250"
ItemsSourceBinding="{Binding ValidValues}"
DisplayMemberPath="Description"
IsComboBoxEditable="False"
DataMemberBinding="{Binding Key}"
SelectedValueMemberPath="Key" // I have to set that to Key because otherwise the Combobox is not showing anything when the respective row is not more on focus //
>
</telerik:GridViewComboBoxColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
I hope this is enough code to understand what my problem is and offer me some help if possible. Thank you!
Regards,
Achim