public class TextBoxColumn : DataGridTemplateColumn { public static readonly DependencyProperty FieldNameProperty = DependencyProperty.Register("FieldName", typeof(string), typeof(TextBoxColumn), new PropertyMetadata("")); public string FieldName { get { return (string)GetValue(FieldNameProperty); } set { SetValue(FieldNameProperty, value); } } ... }
<DataGrid> <DataGrid.Columns> <local:TextBoxControl FieldName="FirstName"/> <local:TextBoxControl FieldName="LastName"/> </DataGrid.Columns> </DataGrid>
<DataTemplate x:Key="TextBoxColumn_CellTemplate"> <TextBox Text="{Binding FieldName}"/> <!-- Here is the problem --> </DataTemplate>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)