Hi
I have a grid that starts off with no rows. The rows are created by adding to CriteriaColumnItem (see code snippet below). When I a row the column in the new row shows the combobox column correctly. However, when I add another row the new row shows the combobox correctly but the previous row now shows blank in the combobox column.
Thanks
Rich
================================================================
// Used for GridViewComboBoxColumn
public List<GroupType> TextGroupTypes = new List<GroupType>()
{
new GroupType {Code=4, Name="Count", },
new GroupType {Code=1, Name="Group By", },
new GroupType {Code=5, Name="Expression", },
new GroupType {Code=2, Name="Min", },
new GroupType {Code=3, Name="Max", },
new GroupType {Code=6, Name="Where"}
};
=============================================================================
public partial class CriteriaColumnItem
{
public string Column { get; set; }
public string ColumnAlias { get; set; }
public string TableDisplayName { get; set; }
public string SchemaName { get; set; }
public string TableName { get; set; }
public bool Show { get; set; }
public string SortType{ get; set; }
public string SortOrder { get; set; }
public Int32 GroupByCode { get; set; } // Used for GridViewComboBoxColumn
}
===========================================================================
<telerik:GridViewComboBoxColumn
IsFilterable="False" Width="65" Name="GroupByCode" Header="Group By"
DataMemberBinding="{Binding GroupByCode, Mode=TwoWay}"
DisplayMemberPath="Name"
SelectedValueMemberPath="Code"
IsVisible="False">
</telerik:GridViewComboBoxColumn>
==============================================================================
private void radGridViewSelectedColumns_RowLoaded(object sender, RowLoadedEventArgs e)
{
CriteriaColumnItem item = e.Row.DataContext as CriteriaColumnItem;
if (item == null)
return;
if(radGridViewSelectedColumns.Columns["GroupByCode"].IsVisible)
{
Telerik.Windows.Controls.GridViewComboBoxColumn column =
radGridViewSelectedColumns.Columns["GroupByCode"] as Telerik.Windows.Controls.GridViewComboBoxColumn;
OpenAccessHelper oaHelper = new OpenAccessHelper();
// Determine which list is needed, Only showing one for now.
column.ItemsSource = oaHelper.TextGroupTypes; // Is this the problem? does each row have its own itemsSource for the column
}
}
============================================================================
I have a grid that starts off with no rows. The rows are created by adding to CriteriaColumnItem (see code snippet below). When I a row the column in the new row shows the combobox column correctly. However, when I add another row the new row shows the combobox correctly but the previous row now shows blank in the combobox column.
Thanks
Rich
================================================================
// Used for GridViewComboBoxColumn
public List<GroupType> TextGroupTypes = new List<GroupType>()
{
new GroupType {Code=4, Name="Count", },
new GroupType {Code=1, Name="Group By", },
new GroupType {Code=5, Name="Expression", },
new GroupType {Code=2, Name="Min", },
new GroupType {Code=3, Name="Max", },
new GroupType {Code=6, Name="Where"}
};
=============================================================================
public partial class CriteriaColumnItem
{
public string Column { get; set; }
public string ColumnAlias { get; set; }
public string TableDisplayName { get; set; }
public string SchemaName { get; set; }
public string TableName { get; set; }
public bool Show { get; set; }
public string SortType{ get; set; }
public string SortOrder { get; set; }
public Int32 GroupByCode { get; set; } // Used for GridViewComboBoxColumn
}
===========================================================================
<telerik:GridViewComboBoxColumn
IsFilterable="False" Width="65" Name="GroupByCode" Header="Group By"
DataMemberBinding="{Binding GroupByCode, Mode=TwoWay}"
DisplayMemberPath="Name"
SelectedValueMemberPath="Code"
IsVisible="False">
</telerik:GridViewComboBoxColumn>
==============================================================================
private void radGridViewSelectedColumns_RowLoaded(object sender, RowLoadedEventArgs e)
{
CriteriaColumnItem item = e.Row.DataContext as CriteriaColumnItem;
if (item == null)
return;
if(radGridViewSelectedColumns.Columns["GroupByCode"].IsVisible)
{
Telerik.Windows.Controls.GridViewComboBoxColumn column =
radGridViewSelectedColumns.Columns["GroupByCode"] as Telerik.Windows.Controls.GridViewComboBoxColumn;
OpenAccessHelper oaHelper = new OpenAccessHelper();
// Determine which list is needed, Only showing one for now.
column.ItemsSource = oaHelper.TextGroupTypes; // Is this the problem? does each row have its own itemsSource for the column
}
}
============================================================================