Open MartinZikmund opened 2 months ago
@mobynet1 could you tell if this issue happens on the net8.0-windows head?
@jeromelaban This happens on WinAppSDK Unpackaged as well as Desktop.
I think I've put my finger on the issue and it points to the AutoLayout.
This works:
<Page
x:Class="UnoApp1.Presentation.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UnoApp1.Presentation"
xmlns:uen="using:Uno.Extensions.Navigation.UI"
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:um="using:Uno.Material"
NavigationCacheMode="Required"
Background="{ThemeResource BackgroundBrush}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="3*" />
<ColumnDefinition
Width="5*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition
Height="2*" />
<RowDefinition
Height="*" />
</Grid.RowDefinitions>
<Border
Background="#2f5cb6" />
<Border
Grid.Column="1"
Background="#1f3d7a" />
<Border
Grid.Row="1"
Grid.ColumnSpan="2"
Background="#152951" />
</Grid>
</Page>
which produces:
And this does not work:
<Page
x:Class="UnoApp1.Presentation.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UnoApp1.Presentation"
xmlns:uen="using:Uno.Extensions.Navigation.UI"
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:um="using:Uno.Material"
NavigationCacheMode="Required"
Background="{ThemeResource BackgroundBrush}">
<utu:AutoLayout>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="3*" />
<ColumnDefinition
Width="5*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition
Height="2*" />
<RowDefinition
Height="*" />
</Grid.RowDefinitions>
<Border
Background="#2f5cb6" />
<Border
Grid.Column="1"
Background="#1f3d7a" />
<Border
Grid.Row="1"
Grid.ColumnSpan="2"
Background="#152951" />
</Grid>
</utu:AutoLayout>
</Page>
Which produces this:
The only difference between the two is the latter is wrapped inside the AutoLayout control. Is it in the way that I am using the AutoLayout control? Here, I am not using any properties to the control, but believe me, I have tried almost every property in almost every combination and it just misbehaves...
Cc @kazo0
Setting the Primary/Counter Alignments on the Grid through the AutoLayout AttachedProperties should do the trick:
<utu:AutoLayout>
<Grid utu:AutoLayout.PrimaryAlignment="Stretch" utu:AutoLayout.CounterAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Background="#2f5cb6" />
<Border Grid.Column="1"
Background="#1f3d7a" />
<Border Grid.Row="1"
Grid.ColumnSpan="2"
Background="#152951" />
</Grid>
</utu:AutoLayout>
Although, I would have thought that setting the PrimaryAxisAlignment
and CounterAxisAlignment
directly on the root AutoLayout
would work as well. It doesn't seem to work properly in that case.
I have transferred this issue to the Toolkit repo so we can investigate
I have been a WPF developer since 2006 and have written thousands of lines of WPF xaml code without issue. Maui, because Mirocosoft has to have a billion different versions of xaml, made me learn YAXL (yet another Xaml language), but I figured it out. Then, here comes Uno which uses WinUI 3... I am probably needing to quit my day job and go be a greeter at Walmart because I just cannot figure this out.
I am doing a poor-man's version of navitation. I have a list view with cells, that when selected, set the content of a content control on the main page to the page that was selected.
This is the definition of the main page:
I have a SelectionChanged event handler in the Main.xaml.cs code-behind that handles the page set up. It works fine as the pages change as I need them to. But... for the life of me, I cannot get any page that is loaded as the content of the content control to consume the entire page surface. I have tried using AutoLayout, but that didn't work as I could get two out of three columns to fill properly, but I could never get all three columns to fill. When I added a listview to the third column, suddenly all of the column's vertical height get set to the tallest column but it was still shorter than the panel height. I tried changing the type of the content being loaded into the content control to UserControl, but that didn't fix it.
This is the abbreviated code of a page I am trying to load:
It just ends up looking like this:
If I change the MainPage to this:
I get this, which is what I want:
What is it about a page that is being loaded into a content control on the main page does not render the same way it renders the main page does when that is all the xaml tells it to do???
I know this is something extremely simple, but I have spent hours and tried a million things to make this work. My bet is that if one of you smart guys that reads this you will see the error immediately. I just can't look at it any longer!!!
Originally posted by @mobynet1 in https://github.com/unoplatform/uno/discussions/18221