how to bind with and height of relative panel

Shay Wilner 1,746 Reputation points


I have a relative panel named board located inside a relative panel .
the size of board is set only at realtime
here the xaml

 <RelativePanel x:Name ="Boardgame" RelativePanel.AlignVerticalCenterWithPanel="True" RelativePanel.AlignHorizontalCenterWithPanel="True"
         Margin="20,0,0,0" CornerRadius="6,6,6,6" Width="{x:Bind Path= widthboard }" Height="{x:Bind Path= widthboard }"  >
                <ImageBrush ImageSource ="/Assets/patternwood.jpg" Stretch="UniformToFill"/>


i tried to bind the width and height to widthboard
widthboard is set in mainpagexaml.vb

When i run the app Boardgame has width = 0


Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Shay Wilner 1,746 Reputation points

    When I tested your code and set a value to widthboard property in code-behind

    I wrote in the mainloading event widthboard = 60

    Probably i don't understand how the xaml works ?
    That exactly the problem where in the code behind i have to set widthboard so that when the xaml Width="{x:Bind Path= widthboard is applied get the value