title: Silverlight 4 Canvas Height and Width Binding
body: <p>I am working on silverlight apps and I want to bind the Canvas Width and Height through XAML but how I can bind it.Because the canvas width and height I had tried to bind it but will not working in my case so if you guys have any other binding way to bind it so please put some somple code so I can figure out the solution of this problem.</p>
  
  <p>I wan to bind this with the Image Height and Width so the some times Image size is 1000 x 1200 and some times image size will be 1400 x 1700 so how I can bind it?</p>
  
  <pre><code>&lt;Viewbox 
              Grid.Row="1" 
              Grid.Column="0"
              Grid.ColumnSpan="2"&gt;
                  &lt;Canvas
                  Height="1000"
                  HorizontalAlignment="Center"
                  VerticalAlignment="Center"
                  Width="1200"&gt;
  
                      &lt;Image x:Name="imgEdit" 
                                  Cursor="Hand"
                                  MouseLeftButtonDown="imgEdit_MouseLeftButtonDown"
                                  MouseMove="imgEdit_MouseMove"
                                  MouseLeftButtonUp="imgEdit_MouseLeftButtonUp"   
                                  HorizontalAlignment="Center"
                                 VerticalAlignment="Center" 
                                 RenderTransformOrigin="0.5, 0.5"&gt;
  
                      &lt;Image.Effect&gt;
                          &lt;l:briconEffect 
                                      Brightness="{Binding ElementName=bVal, Path=Value}"
                                      Contrast="{Binding ElementName=cVal, Path=Value}"
                                      Gamma="{Binding ElementName=gVal,Path=Value}"
                                      RedRatio="{Binding ElementName=rVal,Path=Value}"
                                      BlueRatio="{Binding ElementName=blueVal,Path=Value}"
                                      GreenRatio="{Binding ElementName=greenVal,Path=Value}"/&gt;
                      &lt;/Image.Effect&gt;
  
                      &lt;Image.RenderTransform&gt;
  
                          &lt;TransformGroup&gt;
                              &lt;RotateTransform x:Name="Rotator"&gt;
                                  &lt;RotateTransform.Angle&gt;
                                      &lt;Binding ElementName="sldVerHorizontal" Path="Value" Mode="TwoWay"/&gt;
                                  &lt;/RotateTransform.Angle&gt;
                              &lt;/RotateTransform&gt;
  
                              &lt;ScaleTransform x:Name="Scale"&gt;
                                  &lt;ScaleTransform.ScaleX&gt;
                                      &lt;Binding ElementName="sldZoomInOut" Path="Value" Mode="TwoWay"/&gt;
                                  &lt;/ScaleTransform.ScaleX&gt;
                                  &lt;ScaleTransform.ScaleY&gt;
                                      &lt;Binding ElementName="sldZoomInOut" Path="Value" Mode="TwoWay"/&gt;
                                  &lt;/ScaleTransform.ScaleY&gt;
                              &lt;/ScaleTransform&gt;
                          &lt;/TransformGroup&gt;
  
                      &lt;/Image.RenderTransform&gt;
  
  
                  &lt;/Image&gt;
  
                  &lt;Border
                          x:Name="maskBorder"
                          MinWidth="200"
                          MinHeight="200"
                          BorderBrush="Black"
                          BorderThickness="5"
                          Canvas.Left="250" 
                          Cursor="Hand"
                          Canvas.Top="250"&gt;
  
                      &lt;Rectangle
                          MinWidth="200"
                          MinHeight="200"
                          x:Name="maskRect"
                          Canvas.Left="250" 
                          Cursor="Hand"
                          Canvas.Top="250"&gt;
                      &lt;/Rectangle&gt;
                  &lt;/Border&gt;
              &lt;/Canvas&gt;
          &lt;/Viewbox&gt;
  </code></pre>