I have a WPF DataGrid templatecolumn that has a DataTemplate for an AutoCompleteBox from the wpf toolkit. During RowEditEnding event and validation procedures, I am not able to see the content in the templatecolumn.
<DataGridTemplateColumn Header="Account Type" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<toolkit:AutoCompleteBox Text="{Binding Path='Account Type'}" Populating="PopulateAccountTypesACB" IsTextCompletionEnabled="True" BorderThickness="0" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
if ((value as BindingGroup).Items.Count == 0)
return new ValidationResult(true, null);
DataRowView row = (value as BindingGroup).Items[0] as DataRowView;
if (row != null)
{
if (ValidateAccountName(row.Row.ItemArray[0].ToString()))
{
return new ValidationResult(true, null);
}
else
{
return new ValidationResult(false,
"Account Name must be between 1 and 100 Characters.");
}
}
else
return new ValidationResult(true, null);
}
When I put a break point in my validation function after I create the DataRowView, the template column is empty. How would I get its content?