-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting TextDecoration = None on TextBlock does not remove the strike through after applying it #1093
Comments
@knightmeister Yes, this totally looks like a bug in the Fortunately, there's a simple workaround: private void TextBlock_Tapped(object sender, TappedRoutedEventArgs e)
{
var tb = (TextBlock)sender;
if (tb.TextDecorations == TextDecorations.None)
{
tb.TextDecorations = Windows.UI.Text.TextDecorations.Strikethrough;
tb.Foreground = new SolidColorBrush(Colors.Gray);
}
else
{
+ var text = tb.Text;
+ tb.Text = string.Empty;
tb.TextDecorations = TextDecorations.None;
+ tb.Text = text;
tb.Foreground = new SolidColorBrush(Colors.Black);
}
} |
Yes, this is an old bug. The TextDecoration property incorrectly does not mark the element as needing rendering when its value changed. |
Thanks for the work around @mrlacey, works well. |
I think this is something that can only be fixed with WinUI 3. |
Is there any ETA on a fix? A more permanent fix would be great! |
It has not been fixed in WinUI3. Please fix it - should be a very easy fix and the bug is very nasty |
Fixed in 1.4.0. @bpulliam please close this issue as I cannot :) |
Describe the bug
I am trying to strike through a TextBlock when the user taps it. This works great, but it's not possible to clear the strike through decoration once it's been applied.
Steps to reproduce the bug
Expected behavior
Tapping the TextBlock applies a strike through and changes the colour to gray. That works. Tapping it again should change the colour to black and remove the strike through. The colour changes but the strike through isn't removed.
Version Info
1903
NuGet package version:
N/A
Question
Is there a work around to this, because it's core for the UI I'm working on.
The text was updated successfully, but these errors were encountered: