uno.extensions
uno.extensions copied to clipboard
GridSplitter/ContentSizer in do not work with C# Markup.
Current behavior
When I translate the ContentSizer sample in Windows Community Toolkit Gallery into C# markup, the sizer control do not show as expected. But it works with XAML.
Expected behavior
The behavior of the ContentSizer controls are the same as in the gallery。
How to reproduce it (as minimally and precisely as possible)
Create a Uno Platform App by the template in Visual Studio 2022, with: Framework: .NET 8.0 Platforms: Windows Presentation: MVUX Markup: C# Markup
Replace the MainPage.cs content with:
using CommunityToolkit.WinUI.Controls;
using Uno.Extensions.Markup.Generator;
[assembly: GenerateMarkupForAssembly(typeof(ContentSizer))]
namespace UnoApp5.Presentation;
public sealed partial class MainPage : Page
{
public MainPage()
{
_ = this.DataContext<BindableMainModel>((page, vm) => page
.NavigationCacheMode(NavigationCacheMode.Required)
.Background(ThemeResource.Get<Brush>("ApplicationPageBackgroundThemeBrush"))
.Content(
new Grid()
.MinWidth(400)
.MinHeight(300)
.ColumnDefinitions(
new ColumnDefinition().Width(GridLength.Auto),
new ColumnDefinition().Width(GridLength.Auto),
new ColumnDefinition())
.Children(
// Left-side 'Shelf', In this case you could also use a GridSplitter
new Border()
.Name(out var SideContent)
.MinWidth(200)
.MinHeight(600)
.Background(ThemeResource.Get<Brush>("AccentFillColorDefaultBrush"))
.Child(
new TextBlock()
.HorizontalAlignment(HorizontalAlignment.Center)
.VerticalAlignment(VerticalAlignment.Center)
.Foreground(ThemeResource.Get<Brush>("TextOnAccentFillColorPrimaryBrush"))
.Style(ThemeResource.Get<Style>("BodyStrongTextBlockStyle"))
.Text("Side Content")),
new ContentSizer()
.Grid(column: 1)
.TargetControl(x => x.Source(nameof(SideContent)).Binding(() => SideContent)))));
}
}
Workaround
No response
Works on UWP/WinUI
No
Environment
No response
NuGet package version(s)
Uno.Sdk: 5.2.175 CommunityToolkit.WinUI.Controls.Sizers: 8.0.240109
Affected platforms
Windows (WinAppSDK)
IDE
Visual Studio 2022
IDE version
17.10.5
Relevant plugins
No response
Anything else we need to know?
No response