iNKORE-NET / UI.WPF.Modern

Modern (Fluent 2) styles and controls for your WPF applications
GNU Lesser General Public License v2.1
587 stars 52 forks source link

The BorderThickness="0" is not have any effect when applied to RichTextBox #82

Closed GID0317 closed 3 months ago

GID0317 commented 3 months ago

Describe the bug I encountered an issue with the RichTextBox control in the library. When setting the BorderThickness property to 0, the border is still visible, and the focus underline appears. This behavior is inconsistent with the TextBox control, where setting BorderThickness to 0 successfully hides the border and focus underline.

To Reproduce Steps to reproduce the behavior:

  1. Create a RichTextBox control.
  2. Set the BorderThickness property to 0.
  3. Set the BorderBrush property to Transparent.
  4. Run the application and observe the RichTextBox when it gains focus.

Expected behavior RichTextBox should not display any border or focus underline when BorderThickness is set to 0 and BorderBrush is set to Transparent.

Screenshots Screenshot 2024-08-16 192209

Additional context The RichTextBox still displays a border and focus underline despite setting BorderThickness to 0 and BorderBrush to Transparent.

NotYoojun commented 3 months ago

Hi, according to WinUI guidelines, when the box is foucsed, the BorderThickness will be set to a different value called TextControlBorderThemeThicknessFocused. If you want to remove the focused border, you can do as follows:

<RichTextBox BorderThickness="0">
    <FrameworkElement.Resources>
        <Thickness x:Key="{x:Static ui:ThemeKeys.TextControlBorderThemeThicknessFocusedKey}">0</Thickness>
    </FrameworkElement.Resources>
</RichTextBox>

This will be mentioned in the future documentation.

GID0317 commented 3 months ago

Thanks! can’t wait to see it in the documentation. I’ll close this issue as completed.

NotYoojun commented 3 months ago

Hi, the doc is done, please view https://docs.inkore.net/ui-wpf-modern/features/overrides/override-resources

@GID0317

GID0317 commented 3 months ago

Thank you! I'll check it out