Xaml 如何更改Windows应用中的RelativePanel附加属性?

Xaml 如何更改Windows应用中的RelativePanel附加属性?,xaml,win-universal-app,windows-10,attached-properties,uwp-xaml,Xaml,Win Universal App,Windows 10,Attached Properties,Uwp Xaml,我曾尝试在VisualState.Setters处于可视状态时,通过XAML更改控件的RelativePanel附加属性,但这些属性没有更改,因此我创建了一个依赖项属性,以通过代码隐藏进行测试,而这两个属性都没有 有没有办法刷新到一组新值,如: <VisualState.Setters> <Setter Target="TimestablesControl.RelativePanel.RightOf" Value=""/> <Setter

我曾尝试在VisualState.Setters处于可视状态时,通过XAML更改控件的RelativePanel附加属性,但这些属性没有更改,因此我创建了一个依赖项属性,以通过代码隐藏进行测试,而这两个属性都没有

有没有办法刷新到一组新值,如:

 <VisualState.Setters>
      <Setter Target="TimestablesControl.RelativePanel.RightOf" Value=""/>
      <Setter Target="TimestablesControl.RelativePanel.AlignRightWithPanel" Value="false"/>
      <Setter Target="TimestablesControl.RelativePanel.AlignLeftWithPanel" Value="true"/> 
 </VisualState.Setters>


并使视图更具“响应性”?

用于更改Setter中附加属性的值。Target使用以下格式:

TargetObjectXName.(ClassName.AttachedPropertyName)
就你而言:

 <VisualState.Setters>
      <Setter Target="TimestablesControl.(RelativePanel.RightOf)" Value="Control1"/>
      <Setter Target="TimestablesControl.(RelativePanel.AlignRightWithPanel)" Value="False"/>
      <Setter Target="TimestablesControl.(RelativePanel.AlignLeftWithPanel)" Value="True"/> 
 </VisualState.Setters>

其中“Control1”是要放置在TimeTablesControl左侧的控件的x:名称。

是的,它可以工作,我使用以下方法进行了测试: