2012-06-17 185 views
5

我想將小部件插入我的ItemsControl並使其可調整大小。我如何實現這一目標?製作ItemsControl控件childs可使用分隔線調整大小

這是我的XAML:

<ItemsControl ItemsSource="{Binding TestForList, Mode=OneWay}"> 

    <ItemsControl.ItemsPanel> 
     <ItemsPanelTemplate> 
      <StackPanel Orientation="Horizontal"     
         VerticalAlignment="Stretch"     
         HorizontalAlignment="Stretch" /> 
     </ItemsPanelTemplate> 
    </ItemsControl.ItemsPanel> 

    <ItemsControl.ItemTemplate> 
     <DataTemplate> 
      <Border Margin="5" 
        BorderThickness="1" 
        BorderBrush="Black"> 
       <TextBlock FontSize="100" Text="{Binding}" />  
      </Border>      
     </DataTemplate> 
    </ItemsControl.ItemTemplate> 

</ItemsControl> 

結合到:

public List<string> TestForList 
{ 
    get 
    { 
     return new List<string> { "A", "B", "C" }; 
    } 
} 

我要項之間莫名其妙地加分路器,使他們可以調整大小。有什麼內置的實現嗎?

enter image description here

回答

1

我不認爲有內置的做這種事。我的第一個想法是,你需要創建自己的custom Panel實現來處理這個。

相關問題