AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.37k stars 2.2k forks source link

InlineUIContainer is not rendered when added to new InlineCollection is set to Inlines #14670

Closed wieslawsoltes closed 7 months ago

wieslawsoltes commented 7 months ago

Describe the bug

Controls inside InlineUIContainer are not rendered when when added to new InlineCollection and set to Inlines.

To Reproduce

Repro:

      <TextBlock>
        <TextBlock.Inlines>
          <InlineCollection>
            <Run>Some text</Run>
            <InlineUIContainer>
              <StackPanel>
                <Button Content="Button 1" />
                <Button Content="Button 2" />
              </StackPanel>
            </InlineUIContainer>
          </InlineCollection>
        </TextBlock.Inlines>
      </TextBlock>
  <TabControl>

    <TabItem Header="Inlines Content">

      <TextBlock>
        <Run>Some text</Run>
        <InlineUIContainer>
          <StackPanel>
            <Button Content="Button 1" />
            <Button Content="Button 2" />
          </StackPanel>
        </InlineUIContainer>
      </TextBlock>

    </TabItem>

    <TabItem Header="Inlines Directly">

      <TextBlock>
        <TextBlock.Inlines>
          <Run>Some text</Run>
          <InlineUIContainer>
            <StackPanel>
              <Button Content="Button 1" />
              <Button Content="Button 2" />
            </StackPanel>
          </InlineUIContainer>
        </TextBlock.Inlines>
      </TextBlock>

    </TabItem>

    <TabItem Header="Inlines InlineCollection">

      <TextBlock>
        <TextBlock.Inlines>
          <InlineCollection>
            <Run>Some text</Run>
            <InlineUIContainer>
              <StackPanel>
                <Button Content="Button 1" />
                <Button Content="Button 2" />
              </StackPanel>
            </InlineUIContainer>
          </InlineCollection>
        </TextBlock.Inlines>
      </TextBlock>

    </TabItem>

  </TabControl>

Expected behavior

Controls inside InlineUIContainer are rendered.

Screenshots

image

Environment

Additional context

wieslawsoltes commented 7 months ago

I think this PR https://github.com/AvaloniaUI/Avalonia/commit/0c2c3f1aeb01bb8a7661d206a27065a6ac38aac3 broke adding VisualChildren