[Bug] UriValidationBehavior didn't change style of Border
See original GitHub issueDescription
I try using this behaviour to update the style of a Border based on the validation result of an Entry. The validation result is updated correctly as the user types but the Border’s style is not updated
Stack Trace
No Stack Trace
Link to Reproduction Sample
Check out this branch: https://github.com/KafkaWannaFly/WibuTube/tree/UriValidationBehavior-Bug-Reproduction at MainPage.xaml
Example code
<Border x:Name="urlEntryBorder"
Padding="0"
Margin="0">
<Entry x:Name="urlEntry"
ClearButtonVisibility="WhileEditing"
IsSpellCheckEnabled="false"
Keyboard="Url"
Grid.Column="0"
Placeholder="YouTube url..."
ReturnCommand="{Binding SearchVideoCommand}"
ReturnType="Search"
Text="{Binding Url, Mode=TwoWay}"
VerticalTextAlignment="Center"></Entry>
<Border.Behaviors>
<toolkit:UriValidationBehavior x:Name="validator"
Value="{Binding Url}"
InvalidStyle="{StaticResource InvalidEntryStyle}"
ValidStyle="{StaticResource ValidEntryStyle}"
Flags="ValidateOnValueChanged"
UriKind="Absolute" />
</Border.Behaviors>
</Border>
<Button Grid.Column="1"
IsEnabled="True"
Padding="12"
FontFamily="Segoe MDL2 Assets"
FontSize="20"
BindingContext="{x:Reference validator}"
x:DataType="toolkit:UriValidationBehavior"
Text="{Binding Path=IsValid}" />
Steps to Reproduce
- Run the code, targeting the Window machine. You will see 1 text input and 1 button
- Input random characters on the text input. Button text change to False
- Input a valid URL (eg. https://github.com/). Button text change to True
Expected Behavior
The border colour of the text input should be red when False and green when True
Actual Behavior
The border colour of the text input doesn’t change
Basic Information
- Version with issue: 1.0.0
- Last known good version: 1.0.0
- IDE: Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.3.0 Preview 1.1
- Platform Target Frameworks: net6.0-windows10.0.19041.0
Workaround
No workaround
Reproduction imagery
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Changing label color on JS validation doesn't work and ...
If validation fails on firstName, everything works fine; label turns red and input border too. But wwhen failing validation on any other input, ......
Read more >Skin rule option "Error Border" and "Error Background ...
on PE 7.1.9, it seems "Error Border" and "Error Background" option does not have any effect on a text control which contains validation...
Read more >CSS Container Border
I am trying to create a white border container around all my content. The container DIV is in the xhtml fine and will...
Read more >Form Validation UX in HTML and CSS
:valid , in this case, is ensuring the required condition is met, but that selector is also useful for validating the type of...
Read more >CSS Examples
Below are some commonly requested styling changes that aren't currently included in the visual form styler settings or in the field options.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @bijington
I think I found the solution. The root cause may come from default Border style in
Style.xaml
and I copied it. Which is:There might be something wrong with the
StrokeShape
property. Sadly, the IDE didn’t prompt any error. I change from:To:
So, I conclude that there is nothing wrong with the
UriValidationBehavior
and we can close this issue.@KafkaWannaFly thank you for the update and investigating the issue