2010-06-21 86 views
1

我试图从WPF移植到Silverlight的应用程序,但它失败了一些非常简单的绑定。Silverlight 4.0是否支持样式设置器中的绑定?

我有以下简单的例子:

<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> 

然而,Silverlight的解析崩溃。 但是,如果我取代以恒定的结合,东西都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> 

这是为什么?

回答

1

NOP它不提供(仍然)

相关问题