0
我在組合框中有30個項目。我正在尋找在組合框中添加列和行的方式。
這是我想做的事:組合框中的網格列和行
組合框有4列,7行(行= ITEMCOUNT /列)。
項目類:
public class ItemSymbol{
public string ImageName{
get; set;
}
public string Comment{
get; set;
}
}
視圖模型:
List<ItemSymbol> lstsymbol=new List<ItemSymbol>(30){
new ItemSymbol(){[email protected]"Resources\bunny.png",Comment="funny"},
new ItemSymbol(){[email protected]"Resources\hand.png",Comment="communication"},
new ItemSymbol(){[email protected]"Resources\heart1.png",Comment="love"},
new ItemSymbol(){[email protected]"Resources\heart2.png",Comment="love"}
};
Window1.xaml:
<ComboBox x:Name="cbo"
ItemsSource="{Binding lstsymbol}"
SelectedItem="{Binding SelectedItem}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<Image Width="30" Height="30"
Source="{Binding ImageRes}" Margin="5" ToolTip="{Binding Comment}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
是的,我知道that.thank!這是working.How調整均勻的寬度高度,以適應有內容@Fratyx – Jandy
您的意思是UnformGrid的屏幕大小或行數和列數。 – Fratyx
我更新了[email protected] – Jandy