Hi, I have a RadGridView and one of the columns has a CellTemplate with a TextBlock and a CellEditTemplate with a RadComboBox. The RadGridView ItemSource is a collection of business objects. I'd like it so that the RadComboBox is only accessible based on a property on the business object (in other words you can only choose a different item in the list if the business object is editable). It seems that you can't use a binding in the GridViewDataColumn IsReadOnly property (it only accepts True/False), so I was wondering what the best way to do this would be?
Here's my code:
Thanks,
Tom
Here's my code:
<gridview:RadGridView AutoGenerateColumns="False" |
ShowGroupPanel="False" Margin="4" RowIndicatorVisibility="Collapsed" Grid.Column="0" |
Grid.Row="1" Background="White" ItemsSource="{Binding BusinessObjects}"> |
<gridview:RadGridView.Columns> |
<gridview:GridViewDataColumn Width="auto" Header="Columns" IsFilterable="False" |
IsSortable="False" IsReadOnly="True" > |
<gridview:GridViewDataColumn.CellTemplate> |
<DataTemplate> |
<TextBlock Text="{Binding SelectedOne.Label}" /> |
</DataTemplate> |
</gridview:GridViewDataColumn.CellTemplate> |
<gridview:GridViewDataColumn.CellEditTemplate> |
<DataTemplate> |
<input:RadComboBox IsReadOnly="{Binding IsReadOnly}" IsEditable="{Binding IsEditable}" IsTextSearchEnabled="False" |
OpenDropDownOnFocus="True" KeyDown="RadComboBox_KeyDown" |
MinWidth="100" |
ItemsSource="{Binding Source={StaticResource ViewModel}, Path=SearchList}" |
DisplayMemberPath="Label" |
Text="{Binding Source={StaticResource ViewModel}, Path=SearchText, Mode=TwoWay}" |
SelectedItem="{Binding SelectedOne}" |
attachedcommands:TelerikSelectorSelectionChanged.Command="{Binding Source={StaticResource ViewModel}, Path=SelectionChangedCommand}" |
attachedcommands:TelerikSelectorSelectionChanged.CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedValue}" /> |
</DataTemplate> |
</gridview:GridViewDataColumn.CellEditTemplate> |
</gridview:GridViewDataColumn> |
</gridview:RadGridView.Columns> |
</gridview:RadGridView> |
Thanks,
Tom