|
36 | 36 | <StackPanel Margin="10" |
37 | 37 | Spacing="10"> |
38 | 38 | <ComboBox MinWidth="200" |
39 | | - ItemsSource="{x:Bind Items, Mode=OneWay}" |
| 39 | + ItemsSource="{x:Bind ViewModel.Items, Mode=OneWay}" |
40 | 40 | SelectedIndex="0" /> |
41 | 41 | </StackPanel> |
42 | 42 | </local:ControlExample> |
|
48 | 48 | Spacing="10"> |
49 | 49 | <TextBox Name="PhoneNumberValidator" |
50 | 50 | dev:TextBoxExtensions.Regex="^\s*\+?\s*([0-9][\s-]*){9,}$" |
51 | | - Header="Text box with Regex extension for phone number, validation occurs on TextChanged" /> |
| 51 | + Header="Text box with Regex extension for phone number, validation occurs on TextChanged" |
| 52 | + TextChanging="PhoneNumberValidator_TextChanging" /> |
52 | 53 | <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}"> |
53 | 54 | <Run Text="Is valid: " /> |
54 | 55 | <Run FontWeight="SemiBold" |
55 | | - Text="{Binding (dev:TextBoxExtensions.IsValid), ElementName=PhoneNumberValidator}" /> |
| 56 | + Text="{x:Bind ViewModel.IsPhoneNumberValid, Mode=OneWay}" /> |
56 | 57 | </TextBlock> |
57 | 58 | <TextBox Name="CharactValidator" |
58 | 59 | dev:TextBoxExtensions.ValidationMode="Dynamic" |
59 | 60 | dev:TextBoxExtensions.ValidationType="Characters" |
60 | 61 | Header="Text box with ValidationType=Characters, validation occurs at input with ValidationMode=Dynamic and clear only single character when value is invalid" |
61 | | - Text="abcdef" /> |
| 62 | + Text="abcdef" |
| 63 | + TextChanging="CharactValidator_TextChanging" /> |
62 | 64 | <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}"> |
63 | 65 | <Run Text="Is valid: " /> |
64 | 66 | <Run FontWeight="SemiBold" |
65 | | - Text="{Binding (dev:TextBoxExtensions.IsValid), ElementName=CharactValidator}" /> |
| 67 | + Text="{x:Bind ViewModel.IsCharacterValid, Mode=OneWay}" /> |
66 | 68 | </TextBlock> |
67 | 69 | <TextBox Name="EmailValidator" |
68 | 70 | dev:TextBoxExtensions.ValidationType="Email" |
69 | | - Header="Text box with ValidationType=Email, validation occurs on TextChanged" /> |
| 71 | + Header="Text box with ValidationType=Email, validation occurs on TextChanged" |
| 72 | + TextChanging="EmailValidator_TextChanging" /> |
70 | 73 | <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}"> |
71 | 74 | <Run Text="Is valid: " /> |
72 | 75 | <Run FontWeight="SemiBold" |
73 | | - Text="{Binding (dev:TextBoxExtensions.IsValid), ElementName=EmailValidator}" /> |
| 76 | + Text="{x:Bind ViewModel.IsEmailValid, Mode=OneWay}" /> |
74 | 77 | </TextBlock> |
75 | 78 | <TextBox Name="DecimalValidatorForce" |
76 | 79 | dev:TextBoxExtensions.ValidationMode="Forced" |
77 | 80 | dev:TextBoxExtensions.ValidationType="Decimal" |
78 | | - Header="Text box with ValidationType=Decimal, validation occurs on TextChanged and force occurs on lose focus with ValidationMode=Force (333,111 or 333.111)" /> |
| 81 | + Header="Text box with ValidationType=Decimal, validation occurs on TextChanged and force occurs on lose focus with ValidationMode=Force (333,111 or 333.111)" |
| 82 | + TextChanging="DecimalValidatorForce_TextChanging" /> |
79 | 83 | <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}"> |
80 | 84 | <Run Text="Is valid: " /> |
81 | 85 | <Run FontWeight="SemiBold" |
82 | | - Text="{Binding (dev:TextBoxExtensions.IsValid), ElementName=DecimalValidatorForce}" /> |
| 86 | + Text="{x:Bind ViewModel.IsDecimalValid, Mode=OneWay}" /> |
83 | 87 | </TextBlock> |
84 | 88 | <TextBox Name="NumberValidatorDynamic" |
85 | 89 | dev:TextBoxExtensions.ValidationMode="Dynamic" |
86 | 90 | dev:TextBoxExtensions.ValidationType="Number" |
87 | | - Header="Text box with ValidationType=Number, validation occurs at input with ValidationMode=Dynamic and clear only single character when value is invalid" /> |
| 91 | + Header="Text box with ValidationType=Number, validation occurs at input with ValidationMode=Dynamic and clear only single character when value is invalid" |
| 92 | + TextChanging="NumberValidatorDynamic_TextChanging" /> |
88 | 93 | <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}"> |
89 | 94 | <Run Text="Is valid: " /> |
90 | 95 | <Run FontWeight="SemiBold" |
91 | | - Text="{Binding (dev:TextBoxExtensions.IsValid), ElementName=NumberValidatorDynamic}" /> |
| 96 | + Text="{x:Bind ViewModel.IsNumberValid, Mode=OneWay}" /> |
92 | 97 | </TextBlock> |
93 | 98 | </StackPanel> |
94 | 99 | </local:ControlExample> |
|
0 commit comments