我想給設置值綁定到屬性,但我不斷收到災難性錯誤0x8000ffff的Silverlight在樣式的綁定問題
嘗試這樣:
那麼這個:
<ItemsControl.Style>
<Style TargetType="ContentPresenter">
<Setter Property="Grid.Row"
Value="0" />
<Setter Property="Grid.Column"
Value="0" />
</Style>
</ItemsControl.Style>
我不得不升級到SL5來獲取TargetType。第二個示例刪除了任何綁定的嘗試,但仍「失敗」。
<ItemsControl.ItemsPanel> <ItemsPanelTemplate> <layout:MatrixGrid /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel>
我試圖創建數據的網格矩陣(如由其他人在一個例子說明)。
ItemsControl(在Silverlight中)沒有ItemContainerStyle元素,所以我嘗試了這一點,至今沒有運氣。
<ListBox.ItemsPanel> <ItemsPanelTemplate> <layout:MatrixGrid /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemContainerStyle> <Style TargetType="ContentPresenter"> <Setter Property="Grid.Row" Value="{Binding GridRow}" /> <Setter Property="Grid.Column" Value="{Binding GridColumn}" /> </Style> </ListBox.ItemContainerStyle>
你能展示你使用這種風格的地方嗎? – ChrisF 2012-04-08 14:27:28
嗨ChrisF,我在ItemsControl中使用它 – AlwaysLearning 2012-04-08 14:29:46
爲什麼你使用TargetType =「ContentPresenter」,如果你的風格是ItemsControl? – Zabavsky 2012-04-08 18:03:59