私の環境はWindows Phone 7.1です。ListBoxとしてのキャンバスItemTemplate
<ListBox ItemsSource="{Binding Path=Items}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<Canvas Background="Black" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Canvas Width="200" Height="400"
Canvas.Top="400"> <====== This is not working
... Some content ...
</Canvas>
</DataTemplate>
</ListBox.ItemTemplate>
Canvas
ItemsPanel
ようがありListBox
あり:
は、私は、次のコードを持っています。
ListBoxItems
自体もCanvas
です。 ListBoxItems
をCanvas.Top =400
に設定した場合、ItemsPanel
に400のオフセットで表示されます。
アレント理由:これは動作しない残念ながら、アイテムが(ItemsPanel
が黒である、カラフルな長方形がリストアイテムである)、このイメージに示すように、0のオフセットでレンダリングさ
ListBoxItems
は、オフセットが400?あなたのListBox
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListBox.ItemContainerStyle>
にこれを追加すること
あなたのソリューションは動作しますが、今はwp7のsilverlightがbindinをサポートしていないことに気付きましたg:ItemContainerStyle、aaaarrrrgh:/ – thumbmunkeys
いいえ、バインディングは残念ながら銀色のスタイルでサポートされていません(まだ) SL5にはそれらがありますので、私はWP12でも何かもそうです。 –
hehe、私はそれを待つことができないと思う:) – thumbmunkeys