我正在尝试为自定义附加属性设置可视状态,使用完整命名空间、不使用命名空间、使用别名等多种方式都未能成功。有任何想法吗?
xmlns:p="using:Controls.Views.Properties"
<RelativePanel x:Name="RootPanel" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="VisualStateGroup">
<VisualState x:Name="NarrowView">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
//This is where the value is not achieved
<Setter Target="Text.(p:RelativeSize.Width)" Value="0.5"/>
它不仅仅会触发任何错误,我可以将p:替换为j:而不会崩溃,我不知道如何解决这个问题。
这个问题是为了完成这里的解决方案:使用相对面板在XAML中为UI元素设置相对宽度