I'm using dotnet 3.5, WPF.
XP pro SP3.
IE6.0.2900
RadControls_for_WPF_2009_1_0526_TRIAL
C#
I have created a simple RadGridView with a GridViewComboBoxColumn column.
I have added a combobox "DataTemplate" so that the column cells will look like a combo, and not just
when pressing on one of the cells.
In the constructor of the window1, I call FillStatusComboColumn() to fill the combo with possible values.
*** The problem is that using the "DataTemplate" in the XAML causes the values in the
combobox to disappear. ***
Any ideas ?
Thanks
E. S
<telerik:RadGridView Name="RadGridView1"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
AutoGenerateColumns="False"
ShowGroupPanel="False"
IsFilteringAllowed="False">
<telerik:RadGridView.Columns>
<telerik:GridViewComboBoxColumn UniqueName="Status"
HeaderText="STATUS">
<telerik:GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox />
</DataTemplate>
</telerik:GridViewColumn.CellTemplate>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
private void FillStatusComboColumn()
{
var comboColumn = (Telerik.Windows.Controls.
GridViewComboBoxColumn)RadGridView1.Columns["Status"];
comboColumn.DataMemberBinding = new Binding("ActivityType");
comboColumn.ItemsSource = GetActivityTypes();
comboColumn.DisplayMemberPath =
"Name";
comboColumn.SelectedValueMemberPath =
"ID";
}
public class ActivityType
{
public string Name
{
get;
set;
}
public int ID
{
get;
set;
}
}
private System.Collections.IEnumerable GetActivityTypes()
{
List<ActivityType> ActivityTypes = new List<ActivityType>();
ActivityTypes.Add(new ActivityType() { ID = 0, Name = "" });
ActivityTypes.Add(new ActivityType() { ID = 1, Name = "Val1" });
ActivityTypes.Add(new ActivityType() { ID = 2, Name = "Val2" });
ActivityTypes.Add(new ActivityType() { ID = 3, Name = "Val3" });
return ActivityTypes;
}