Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!int.TryParse(value.ToString(), out proposedValue))
- {
- return new ValidationResult(false, "'" + value.ToString() + "' ist no positive integer (>=0).");
- }
- if (proposedValue < 0)
- {
- // Something was wrong.
- return new ValidationResult(false, "Value can't be smaller than 0.");
- }
- }
- // Everything OK.
- return new ValidationResult(true, null);
- }
- }
- <DataGridTextColumn Header="Shitfs" IsReadOnly="False">
- <DataGridTextColumn.Binding>
- <Binding Path="Shifts">
- <Binding.ValidationRules>
- <validationRules:IsPositiveIntegerRule />
- </Binding.ValidationRules>
- </Binding>
- </DataGridTextColumn.Binding>
- </DataGridTextColumn>
- <Style TargetType="TextBlock">
- <Style.Triggers>
- <Trigger Property="Validation.HasError" Value="true">
- <Setter Property="ToolTip"
- Value="{Binding RelativeSource={x:Static RelativeSource.Self},
- Path=(Validation.Errors)[0].ErrorContent}"/>
- </Trigger>
- </Style.Triggers>
- </Style>
- <Style x:Key="CellEditStyle" TargetType="TextBox">
- <Style.Triggers>
- <Trigger Property="Validation.HasError" Value="true">
- <Setter Property="ToolTip"
- Value="{Binding RelativeSource={RelativeSource Self},
- Path=(Validation.Errors)[0].ErrorContent}"/>
- </Trigger>
- </Style.Triggers>
- </Style>
- <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
Add Comment
Please, Sign In to add comment