Hello,
i created any GridViewComboBoxColumns on code behind with:
private void MyGridView_AutoGeneratingColumn(object sender, Telerik.Windows.Controls.GridViewAutoGeneratingColumnEventArgs e)
{
DirInfoPropertyDescriptor propertyDecriptor = e.ItemPropertyInfo.Descriptor as DirInfoPropertyDescriptor;
GridViewDataColumn datacolumn = e.Column as GridViewDataColumn;
if (datacolumn != null)
{
IList<FieldDropDownItem> dropdownItems = DirInfo.FieldsDropdownItemsCache[propertyDecriptor.Name];
if(dropdownItems.Count != 0)
{
GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn();
comboColumn.Header = datacolumn.Header;
comboColumn.DataMemberBinding = datacolumn.DataMemberBinding;
comboColumn.SelectedValueMemberPath = "Id";
comboColumn.DisplayMemberPath = "Description";
comboColumn.SortMemberPath = "Description";
comboColumn.ItemsSource = dropdownItems;
(sender as RadGridView).Columns.Add(comboColumn);
e.Cancel = true;
}
}
}
It works nice: i can see and edit my dropdown values, but i cant sort.
After sorting my grid is empty, see screenshot
i created any GridViewComboBoxColumns on code behind with:
private void MyGridView_AutoGeneratingColumn(object sender, Telerik.Windows.Controls.GridViewAutoGeneratingColumnEventArgs e)
{
DirInfoPropertyDescriptor propertyDecriptor = e.ItemPropertyInfo.Descriptor as DirInfoPropertyDescriptor;
GridViewDataColumn datacolumn = e.Column as GridViewDataColumn;
if (datacolumn != null)
{
IList<FieldDropDownItem> dropdownItems = DirInfo.FieldsDropdownItemsCache[propertyDecriptor.Name];
if(dropdownItems.Count != 0)
{
GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn();
comboColumn.Header = datacolumn.Header;
comboColumn.DataMemberBinding = datacolumn.DataMemberBinding;
comboColumn.SelectedValueMemberPath = "Id";
comboColumn.DisplayMemberPath = "Description";
comboColumn.SortMemberPath = "Description";
comboColumn.ItemsSource = dropdownItems;
(sender as RadGridView).Columns.Add(comboColumn);
e.Cancel = true;
}
}
}
After sorting my grid is empty, see screenshot