validationrule

Parent Child ValidationRule

一曲冷凌霜 提交于 2020-01-05 07:04:15
问题 I have a complicated scenario using ValidationRules that I need some help with. I have a User Control that is roughly organized like this: Parent (ItemsControl) Child 1 Property 1 Property 2 Child 2 Property 1 Property 2 When Child 1.Property 1 is changed, I need to perform validation on it. However, the validation rule requires the value of Child 1.Property 1 as well as the Property 1 values for all its siblings (variable number) to perform the validation. I could put a ValidationRule on the

WPF - ValidationRule is not being called

可紊 提交于 2019-12-11 19:19:34
问题 I got this Xaml of a TextBlock: <TextBlock VerticalAlignment="Center"> <TextBlock.Text> <Binding Path="FilesPath" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"> <Binding.ValidationRules> <viewModel:ExtensionRule></viewModel:ExtensionRule> </Binding.ValidationRules> </Binding> </TextBlock.Text> </TextBlock> In the ViewModel: private string _filesPath; public string FilesPath { set { _filesPath = value; OnPropertyChange("FilesPath"); } get { return _filesPath; } } private void

ValidationRule for WPF Textbox

天涯浪子 提交于 2019-11-30 14:01:39
I am newbie to WPF.In my UserControl,I have 8 labels and its respective 8 textboxes as follows: 1.Label : abc 2.Label : def TextBox1 : TextBox2 : 3.Label :xyz 4. Label : ghi Textbox3 : TextBox4 : Each of these textbox text property should contain text ending with its respective label name for TextBox1.text should be xxxx.abc , TextBox2.text should be xxxx.def and so on.if not textbox should have red border. hope I am clear with the details.So Do i need to write different ValidationRule for each textbox?? Any you inputs?? Why not have one ValidationRule implementation, with a property exposing

ValidationRule for WPF Textbox

耗尽温柔 提交于 2019-11-29 20:55:17
问题 I am newbie to WPF.In my UserControl,I have 8 labels and its respective 8 textboxes as follows: 1.Label : abc 2.Label : def TextBox1 : TextBox2 : 3.Label :xyz 4. Label : ghi Textbox3 : TextBox4 : Each of these textbox text property should contain text ending with its respective label name for TextBox1.text should be xxxx.abc , TextBox2.text should be xxxx.def and so on.if not textbox should have red border. hope I am clear with the details.So Do i need to write different ValidationRule for