Skip to content
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

SelectableTextBlock with Inlines render issue #16820

Open
love-linger opened this issue Aug 27, 2024 · 0 comments
Open

SelectableTextBlock with Inlines render issue #16820

love-linger opened this issue Aug 27, 2024 · 0 comments

Comments

@love-linger
Copy link

Describe the bug

SelectableTextBlock with inlines renders no content after closing context menu of another control by click this SelectableTextBlock.

To Reproduce

  1. Create an Avalonia .NET App (AvaloinaUI) project
  2. Replace the content in MainWindow.axaml with the code shown below
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        Width="400" Height="200"
        x:Class="SelectableTextBlockDemo.MainWindow"
        Title="SelectableTextBlockDemo">
  <StackPanel Orientation="Vertical">
    <TextBlock Text="SelectableTextBlock Demo" Margin="0,12" HorizontalAlignment="Center"/>
    
    <Border Background="Green" Height="24">
      <Border.ContextMenu>
        <ContextMenu>
          <MenuItem Header="Just a menu item 1"/>
          <MenuItem Header="Just a menu item 2"/>
        </ContextMenu>
      </Border.ContextMenu>
      
      <TextBlock Text="Right Click Here to Open Context Menu" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    </Border>
    
    <SelectableTextBlock Background="Transparent" FontSize="16" Margin="0,8,0,0" HorizontalAlignment="Center">
      <Run>This is a</Run>
      <Run Foreground="Red">SelectableTextBlock</Run>
      <Run>with inline elements</Run>
    </SelectableTextBlock>

    <SelectableTextBlock Background="Transparent" FontSize="16" Margin="0,8,0,0" HorizontalAlignment="Center" Text="This is a SelectableTextBlock without inlines"/>
  </StackPanel>
</Window>
  1. As shown in the video, run the project

Expected behavior

After the context menu closed by clicking above the first SelectableTextBlock, the first SelectableTextBlock should redraw correctly.

Avalonia version

11.1.3

OS

Windows, macOS, Linux

Additional context

This video shows how to reproduce this issue

demo.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants
@love-linger @Gillibald and others