Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change RelativePanel attached properties in Windows Apps?

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

like image 244
Juan Pablo Garcia Coello Avatar asked Mar 29 '15 06:03

Juan Pablo Garcia Coello


1 Answers

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.

like image 74
Martin Suchan Avatar answered Nov 19 '22 05:11

Martin Suchan