Hi,
I have a radgridview binded to a data-table. I need to make the first column of this grid Combo-box. I have tried the following and it did not worked out well as the combo-column is not showing the data-table data.
My code behind,
My XAML,
I have attached the output I'm getting.
I need to retain the value selected in the combo. replacing the original content.
regards,
SK
I have a radgridview binded to a data-table. I need to make the first column of this grid Combo-box. I have tried the following and it did not worked out well as the combo-column is not showing the data-table data.
My code behind,
Class MainWindow Private Colours As String() Public Sub New() ' This call is required by the designer. InitializeComponent() Colours = New String(1) {} Colours(0) = "Yellow" Colours(1) = "Green" ' Add any initialization after the InitializeComponent() call. RadGridView1.ItemsSource = BindData() End Sub Public Function BindData() Dim dtTemp_Start As New DataTable If Not dtTemp_Start.Columns.Count > 0 Then Dim column As DataColumn = New DataColumn column.DataType = System.Type.GetType("System.Int32") With column .AutoIncrement = True .AutoIncrementSeed = 1 .ReadOnly = True .Unique = True .ColumnName = "Auto_ID" End With dtTemp_Start.Columns.Add(column) dtTemp_Start.Columns.Add("tType", GetType(String)) dtTemp_Start.Columns.Add("Expression", GetType(String)) Dim sDataRow As DataRow sDataRow = dtTemp_Start.NewRow() sDataRow(1) = "black" sDataRow(2) = "bbk" dtTemp_Start.Rows.Add(sDataRow) ' dtTemp.Columns.Add("VarCollection", GetType(ObservableCollection(Of SimulationVariableInfo))) 'dtTemp_Start.Columns.Add("ConditionCollection", GetType(clsCondCollection)) End If Return dtTemp_Start End Function Private Sub RadGridView1_BeginningEdit(ByVal sender As System.Object, ByVal e As Telerik.Windows.Controls.GridViewBeginningEditRoutedEventArgs) Handles RadGridView1.BeginningEdit DirectCast(Me.RadGridView1.Columns("tType"), GridViewComboBoxColumn).ItemsSource = Colours End SubEnd ClassMy XAML,
<telerik:RadGridView IsFilteringAllowed="False" ShowGroupPanel="False" AutoGenerateColumns="false" HorizontalAlignment="Left" Margin="0,67,0,0" Name="RadGridView1" VerticalAlignment="Top" Height="207" Width="503" > <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding Auto_ID}" /> <telerik:GridViewComboBoxColumn Header="Type" DataMemberBinding="{Binding tType}" > </telerik:GridViewComboBoxColumn> <telerik:GridViewDataColumn Header="Expression" DataMemberBinding="{Binding Expression}" /> </telerik:RadGridView.Columns> </telerik:RadGridView>I have attached the output I'm getting.
I need to retain the value selected in the combo. replacing the original content.
regards,
SK