how to bind with and height of relative panel

Shay Wilner 1,746 Reputation points
2020-06-17T21:11:16.45+00:00

Hi

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 }"  >
            <RelativePanel.Background>
                <ImageBrush ImageSource ="/Assets/patternwood.jpg" Stretch="UniformToFill"/>
            </RelativePanel.Background>

        </RelativePanel>

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

Thanks

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Shay Wilner 1,746 Reputation points
    2020-06-18T07:28:34.873+00:00

    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

    Thanks


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.