Validation.ErrorTemplate="{x:Null}
Wednesday, June 8, 2016
Tuesday, June 7, 2016
Clear Validation Error On TextBox TextChanged event WPF
WPF > Validation > ClearInvalid
Removes all ValidationError objects from the specified BindingExpression object.
Example
Removes all ValidationError objects from the specified BindingExpression object.
Example
this.TextChanged += TextBox_TextChanged;
void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
Validation.ClearInvalid(((TextBox)sender).GetBindingExpression(TextBox.TextProperty));
}
Friday, June 3, 2016
DataGrid WPF show row number
WPF > Controls > ItemsControl > DataGrid > Show row number
XAML
XAML
<DataGrid
x:Name="dataGrid"
LoadingRow="dataGrid_LoadingRow"
Code
private void dataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
// show
row number
e.Row.Header = (e.Row.GetIndex() +
1).ToString();
}