0

セッター値をプロパティにバインドしようとしていますが、壊滅的なエラー 0x8000ffff が発生し続けます

これを試しました:

<ItemsControl.Style>
    <Style TargetType="ContentPresenter">
        <Setter Property="Grid.Row"
                Value="{Binding GridRow}" />
        <Setter Property="Grid.Column"
                Value="{Binding GridColumn}" />
    </Style>
</ItemsControl.Style>

次に、これ:

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

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

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

1 に答える 1

0

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

于 2012-04-09T06:22:08.523 に答える