Avalonia: Flyout Width more than 500 does not work

192 Views Asked by At

It would be easier with WPF. I'm working with Avalonia because of the cross-platform. It doesn't work with MinWidth and Width either.

How can I remove or disable the scrollbar of this flyout when a control's width is larger than 500?

<DropDownButton>
   <TextBlock Text="Test" />
   <DropDownButton.Flyout>
      <Flyout>
         <FlyoutPresenter Background="Red" Height="1000" Width="1000">
                        
         </FlyoutPresenter>
      </Flyout>
    </DropDownButton.Flyout>
</DropDownButton>

It doesn't work with MinWidth and Width either without scrollbar. Height and MinHeight have no problem.

Where can I use attached scrollbar in flyout?

2

There are 2 best solutions below

0
Raf-9600 On

Try this:

<sys:Double x:Key="FlyoutThemeMaxWidth">1000</sys:Double>
0
Fawaz Takhji On

Try doing it like this, if it doesn't work try setting the MaxWidth value too.

<DropDownButton>
   <TextBlock Text="Test" />
   <DropDownButton.Styles>
       <Style Selector="FlyoutPresenter">
           <Setter Property="Width" Value="1000" />
           <Setter Property="Height" Value="1000" />
           <Setter Property="Background" Value="Red" />
       </Style>
   </DropDownButton.Styles>
   <DropDownButton.Flyout>
      <Flyout>
          // Add content here
      </Flyout>
    </DropDownButton.Flyout>
</DropDownButton>