How to change RelativePanel attached properties in Windows Apps?
Asked Answered
J

1

6

I have tried to change the RelativePanel attached properties of a control by XAML in the VisualState.Setters in a Visual State but the properties do not change, so I created a dependency property to test by code behind and neither.

Is there any way to refresh to a new group of values like:

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

And make the view more 'responsive'?

Joella answered 29/3, 2015 at 6:55 Comment(0)
F
8

For changing values of Attached Properties in Setter.Target use this format:

TargetObjectXName.(ClassName.AttachedPropertyName)

In you case:

 <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>

Where "Control1" is the x:Name of the control you want to place left of TimestablesControl.

Frisky answered 30/3, 2015 at 12:50 Comment(1)
Yes it works, I tested with: <Setter Target="DayDetailsView.(RelativePanel.AlignRightWithPanel)" Value="False"/> <Setter Target="DayDetailsView.(RelativePanel.AlignLeftWithPanel)" Value="True"/>Joella

© 2022 - 2024 — McMap. All rights reserved.