私は、WPF ListBox(またはItemsControl)にGridSplitterのような機能を持たせたいと考えています。次のコードは機能しませんが、達成したいことを示しています:Resizeable WPF ListBox/ItemsControl items
<ListBox ItemsSource="{Binding MyCollection}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding MyTextProperty}" Margin="0,0,10,0"/>
<GridSplitter
Width="5"
Background="Red"
HorizontalAlignment="Right"
ResizeBehavior="CurrentAndNext"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
誰でもこれを実装する方法についてのアイデアはありますか?
"動作しない"部分はありますか? –
GridSplitterは、グリッド内の行/列のサイズを変更します。コードには、各リストボックス項目に対して1行と1列のグリッドが1つあります。スプリッタは何もしません。 – Phil
@jberger:gridsplitter – eriksmith200