Binding position to ActualHeight

Posted by Qanik on Stack Overflow See other posts from Stack Overflow or by Qanik
Published on 2010-05-18T11:34:12Z Indexed on 2010/05/18 13:21 UTC
Read the original article Hit count: 372

Hi I want to bind a lists position to its own height in XAML. So its lower left corner always will be at 0.0 of the canvas. I'm using elementBinding to get the ActualHeight and a converter to invert the property. But the height sent to the converter is 0. How do I solve this or am I going at this the wrong way?

<Canvas x:Name="DisplaySurface">
    <ListBox x:Name="MenuList" Visibility="Visible"  
             Canvas.Top="{Binding ElementName=MenuList, Path=ActualHeight, 
             Converter={StaticResource LamdaConv}, ConverterParameter='val=>-val'}">

         <ListBoxItem Content="item 1" />
         <ListBoxItem Content="item 2" />
         <ListBoxItem Content="item 3" />
         <ListBoxItem Content="item 4" />
         <ListBoxItem Content="item 5" />
         <ListBoxItem Content="item 6" />
     </ListBox>
</Canvas>

-Qanik

© Stack Overflow or respective owner

Related posts about silverlight-4.0

Related posts about Silverlight