更新时间:2022-06-24 22:35:33
正如Meleak在其评论中已经提到的:使用静态类
As Meleak already mentioned in his comment: Use a static class
namespace Infrastructure
{
public static class RegionNames
{
public const string MainRegion = "MainRegion";
}
}
在您的xaml代码中,您可以按以下方式使用区域名称:
In your xaml code you can use the region name as follows:
<UserControl
xmlns:Inf="clr-namespace:Infrastructure;assembly=Infrastructure"
xmlns:Regions="clr-namespace:Microsoft.Practices.Prism.Regions;assembly=Microsoft.Practices.Prism">
<ContentControl Regions:RegionManager.RegionName="{x:Static Inf:RegionNames.MainRegion}"/>
</UserControl>