Hi,
I use the RadGridView and I want to have 2 GridViewComboBoxColumn in there. But there are a lot of problem:
1. The Comboboxes should always be visible, but they are only visible if the user double-clicks in the cell. Therefore, I tried to put a normal Combobox in the DataTemplate of the Cell-Template but then
2. Databinding is not working any more. And
3. Databinding with Enums is not working at all. If I bind my enum to the normal GridViewComboBoxColumn the data is showing up wenn the user double clicks, but then it is not possible to select any other cell in the grid and everything stood still.
4. How can I preselect the current dataitem value in the combobox? The initial value of all comboboxes is always empty ....
Please help!
That's my code:
XAML:
<telerik:RadGridView x:Name="grid" Grid.Column="2" Grid.RowSpan="15" AutoGenerateColumns="False" ItemsSource="{Binding}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Plate Id" DataMemberBinding="{Binding Name}">
<telerik:GridViewComboBoxColumn Header="Dilution Factor" DataMemberBinding="{Binding DilutionFactorId, Mode = TwoWay}" ItemsSource="{Binding}" DisplayMemberPath="Name" SelectedValueMemberPath="Id" UniqueName="colDilFactor">
<!--<telerik:GridViewComboBoxColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<ComboBox x:Name="internalCboFactor" ItemsSource="{Binding}" SelectedValue="{Binding DilutionFactorId}"></ComboBox>
</StackPanel>
</DataTemplate>
</telerik:GridViewComboBoxColumn.CellTemplate>-->
</telerik:GridViewComboBoxColumn>
<telerik:GridViewComboBoxColumn Header="State" DataMemberBinding="{Binding State}" ItemsSource="{Binding}" UniqueName="colState">
</telerik:RadGridView.Columns>
</telerik:RadGridView>
C#
((GridViewComboBoxColumn)grid.Columns["colState"]).ItemsSource = Enum.GetNames(typeof(PlateStateEnum));
((GridViewComboBoxColumn)grid.Columns["colDilFactor"]).ItemsSource = _handler.GetProvider().LoadDilutionFactors(typeId);
//ComboBox cboFactor = grid.Columns["colDilFactor"].FindName("internalCboFactor") as ComboBox;
//if(cboFactor != null)
// cboFactor.ItemsSource = _handler.GetProvider().LoadDilutionFactors(typeId);
}
Thx in advance!
I use the RadGridView and I want to have 2 GridViewComboBoxColumn in there. But there are a lot of problem:
1. The Comboboxes should always be visible, but they are only visible if the user double-clicks in the cell. Therefore, I tried to put a normal Combobox in the DataTemplate of the Cell-Template but then
2. Databinding is not working any more. And
3. Databinding with Enums is not working at all. If I bind my enum to the normal GridViewComboBoxColumn the data is showing up wenn the user double clicks, but then it is not possible to select any other cell in the grid and everything stood still.
4. How can I preselect the current dataitem value in the combobox? The initial value of all comboboxes is always empty ....
Please help!
That's my code:
XAML:
<telerik:RadGridView x:Name="grid" Grid.Column="2" Grid.RowSpan="15" AutoGenerateColumns="False" ItemsSource="{Binding}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Plate Id" DataMemberBinding="{Binding Name}">
<telerik:GridViewComboBoxColumn Header="Dilution Factor" DataMemberBinding="{Binding DilutionFactorId, Mode = TwoWay}" ItemsSource="{Binding}" DisplayMemberPath="Name" SelectedValueMemberPath="Id" UniqueName="colDilFactor">
<!--<telerik:GridViewComboBoxColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<ComboBox x:Name="internalCboFactor" ItemsSource="{Binding}" SelectedValue="{Binding DilutionFactorId}"></ComboBox>
</StackPanel>
</DataTemplate>
</telerik:GridViewComboBoxColumn.CellTemplate>-->
</telerik:GridViewComboBoxColumn>
<telerik:GridViewComboBoxColumn Header="State" DataMemberBinding="{Binding State}" ItemsSource="{Binding}" UniqueName="colState">
</telerik:RadGridView.Columns>
</telerik:RadGridView>
C#
((GridViewComboBoxColumn)grid.Columns["colState"]).ItemsSource = Enum.GetNames(typeof(PlateStateEnum));
((GridViewComboBoxColumn)grid.Columns["colDilFactor"]).ItemsSource = _handler.GetProvider().LoadDilutionFactors(typeId);
//ComboBox cboFactor = grid.Columns["colDilFactor"].FindName("internalCboFactor") as ComboBox;
//if(cboFactor != null)
// cboFactor.ItemsSource = _handler.GetProvider().LoadDilutionFactors(typeId);
}
Thx in advance!