What is the correct way use a "DataColumn" object to tell the RadGridView which column to bind to? I can get it to bind using the "ColumnName" property on the column, but I would rather bind on the DataColumn object itself.
Here is a test program to demonstrate the problem
​
The column that I set via the property did not work, but the one referencing the column name and the auto generated column both worked. What is the correct way to reference a column using the property?
Here is a test program to demonstrate the problem
<Window x:Class="RadGridViewTest.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:radGridViewTest="clr-namespace:RadGridViewTest" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <radGridViewTest:ContextData x:Key="ContextData"/> </Window.Resources> <Grid DataContext="{StaticResource ContextData}"> <telerik:RadGridView ItemsSource="{Binding Path=ExampleTable}" AutoGenerateColumns="True" ShowGroupPanel="False"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding ExampleColumn}" Header="Via property"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Example}" Header="Via Column Name"/> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid></Window>​
using System.Data;using System.Windows;namespace RadGridViewTest{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } } public class ContextData { public ContextData() { ExampleTable = new StrongNamedDataTable(); var row = ExampleTable.NewRow(); row[ExampleTable.ExampleColumn] = "Test Data"; ExampleTable.Rows.Add(row); } public StrongNamedDataTable ExampleTable { get; set; } } public class StrongNamedDataTable : DataTable { public StrongNamedDataTable() { ExampleColumn = this.Columns.Add("Example"); } public DataColumn ExampleColumn { get; private set; } }}The column that I set via the property did not work, but the one referencing the column name and the auto generated column both worked. What is the correct way to reference a column using the property?