I am currently trying out Uno Platform with Prism, to see if it's worth migrating a project of mine from WPF to UWP and Uno. I've built this application with the Prism Template.
I've currently run into an issue where I usually assign a region to a ContentControl, by calling the region name by a static that is stored within a class of static region names.
My WPF XAML code, from Shell.xaml:
<ContentControl Grid.Row="0"
VerticalAlignment="Bottom"
HorizontalAlignment="Stretch"
Margin="0,0,0,11"
prismRegions:RegionManager.RegionName="{x:Static blankCore:RegionNames.ContentHeaderRegion}"/>
However, this does not work, due to x:Static not existing in UWP (Unknown type 'Static' in XML namespace). Therefore, after looking at some documentation on UWP, I have used x:Bind and now the code looks like this:
<ContentControl Grid.Row="0"
VerticalAlignment="Bottom"
HorizontalAlignment="Stretch"
Margin="0,0,0,11"
prismRegions:RegionManager.RegionName="{x:Bind blankCore:RegionNames.ContentHeaderRegion}"/>
This is compiling and running for UWP, but upon switching to WASM or Android, I get various errors in a generated file:
c32.SetBinding(global::Prism.Regions.RegionManager.RegionNameProperty, new Windows.UI.Xaml.Data.Binding{ Mode = BindingMode.OneTime }.Apply(___b => /*defaultBindModeOneTime*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, this, ___ctx => ___ctx is global::BlankApp1.Shared.Views.Shell ___tctx ? (object)(___tctx.global::BlankApp1.Core.RegionNames.AuthenticateRegion) : null, null )));
My current static class of RegionNames is as follows:
namespace BlankApp1.Core
{
public class RegionNames
{
public static string ContentHeaderRegion = "ContentHeaderRegion";
/// ...
}
}
Is going with 'x:Bind' the correct way about this and is there a fix for this? Or should I be doing something else?
This was resolved by updating the Uno.UI library to 3.5.x or above. I was on 3.0.x