This question is locked. New answers and comments are not allowed.
Hi,
I have a pretty advanced template for a GridViewComboBoxColumn that displays projects.
I would like to have a two column combobox (Project number and name) both in the dropdown and when not in editing mode.
I also need to capture the SelectionChange event of the ComboBox.
As now the multi column only works when not in editing mode, the drop down only displays the name.
And that is because I can't include the ItemTemplate, it will crash when I open the drop down.
My working xaml looks like this:
When I add <telerik:RadComboBox.ItemTemplate> inside the RadComboBox tag, with the data template in the resource above it crashes.
What am I doing wrong?
It would also be nice to use the IsFilterable flag, but as I understood it does not work when virtualizing is on.
I tried to shut it off by setting EnableColumnVirtualization and EnableRowVirtualization to false, but there was no difference.
I also replaced the VirtualizingStackPanel with a normal StackPanel, but I didn't get that to work either.
Regards,
Håkan
I have a pretty advanced template for a GridViewComboBoxColumn that displays projects.
I would like to have a two column combobox (Project number and name) both in the dropdown and when not in editing mode.
I also need to capture the SelectionChange event of the ComboBox.
As now the multi column only works when not in editing mode, the drop down only displays the name.
And that is because I can't include the ItemTemplate, it will crash when I open the drop down.
My working xaml looks like this:
<
telerik:RadGridView.Resources
>
<
DataTemplate
x:Key
=
"ProjectDataTemplate"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
TextBlock
Text
=
"{Binding Number}"
TextAlignment
=
"Right"
Margin
=
"0,0,5,0"
/>
<
TextBlock
Text
=
"{Binding Name}"
Grid.Column
=
"1"
/>
</
Grid
>
</
DataTemplate
>
</
telerik:RadGridView.Resources
>
<
telerik:GridViewComboBoxColumn
Header
=
"Projekt"
IsComboBoxEditable
=
"True"
DataMemberBinding
=
"{Binding ProjectId}"
ItemsSource
=
"{Binding Path=Projects, Source={StaticResource ViewModel}}"
SelectedValueMemberPath
=
"ProjectId"
DisplayMemberPath
=
"Name"
ItemTemplate
=
"{StaticResource ProjectDataTemplate}"
Width
=
"*"
>
<
telerik:GridViewComboBoxColumn.CellEditTemplate
>
<
DataTemplate
>
<
telerik:RadComboBox
SelectedValue
=
"{Binding ProjectId, Mode=TwoWay}"
ItemsSource
=
"{Binding Path=Projects, Source={StaticResource ViewModel}}"
DisplayMemberPath
=
"Name"
SelectedValuePath
=
"ProjectId"
IsEditable
=
"True"
TextSearchMode
=
"Contains"
IsReadOnly
=
"True"
OpenDropDownOnFocus
=
"True"
SelectionChanged
=
"ProjectChanged"
>
<
telerik:RadComboBox.ItemsPanel
>
<
ItemsPanelTemplate
>
<
VirtualizingStackPanel
Width
=
"250"
/>
</
ItemsPanelTemplate
>
</
telerik:RadComboBox.ItemsPanel
>
</
telerik:RadComboBox
>
</
DataTemplate
>
</
telerik:GridViewComboBoxColumn.CellEditTemplate
>
</
telerik:GridViewComboBoxColumn
>
When I add <telerik:RadComboBox.ItemTemplate> inside the RadComboBox tag, with the data template in the resource above it crashes.
What am I doing wrong?
It would also be nice to use the IsFilterable flag, but as I understood it does not work when virtualizing is on.
I tried to shut it off by setting EnableColumnVirtualization and EnableRowVirtualization to false, but there was no difference.
I also replaced the VirtualizingStackPanel with a normal StackPanel, but I didn't get that to work either.
Regards,
Håkan