2012-04-08 17 views
0

私はプロパティにセッター値をバインドしようとしているが、私が試したSilverlightのバインディング問題

0x8000ffffが返さ致命的なエラーを得続けるこの:

​​

次に、この:

<ItemsControl.Style> 
    <Style TargetType="ContentPresenter"> 
     <Setter Property="Grid.Row" 
       Value="0" /> 
     <Setter Property="Grid.Column" 
       Value="0" /> 
    </Style> 
</ItemsControl.Style> 

TargetTypeを取得するためにSL5にアップグレードする必要がありました。 2番目の例では、バインドしようとする試みはすべて削除されますが、「Catastrophically」には失敗します。

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

このスタイルを使用している場所のコンテキストを表示できますか。 – ChrisF

+0

こんにちはChrisF、ItemsControlでこれを使用しています – AlwaysLearning

+0

あなたのスタイルが 'ItemsControl'の場合は、なぜTargetType =" ContentPresenter "を使用していますか? – Zabavsky

答えて

0

Style.TargetTypeプロパティは、スタイルが意図されているタイプを設定します。おそらくそれが落ちる理由は、ItemsControlに設定してみてください。

+0

ありがとう、私はContentPresenterがここで動作すると思っていました... – AlwaysLearning

関連する問題