2010-06-21 52 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它不提供(仍然)

相關問題