views:

62

answers:

2

I am trying to port an application from WPF to Silverlight but it fails on some very simple binding.

I have the following simple example:

    <ListBox >
        <ListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
               <Setter Property="Canvas.Top" Value="{Binding X}"></Setter>
            </Style>
        </ListBox.ItemContainerStyle>
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <Canvas></Canvas>
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
       </ListBox>

However, Silverlight parsing crashes. However, if I replace the binding with a constant, things are OK:

    <ListBox >
        <ListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
               <Setter Property="Canvas.Top" Value="3"></Setter>
            </Style>
        </ListBox.ItemContainerStyle>
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <Canvas></Canvas>
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
        </ListBox>

Why is this?

+1  A: 

Nop it doesn't provide that (still)

Aggelos Mpimpoudis