<Window x:Class="PhotoData.AddPhotosWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="AddPhotosWindow" Height="600" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="26"/>
<RowDefinition/>
<RowDefinition Height="26"/>
</Grid.RowDefinitions>
<Button Content="批量添加照片" Width="100" HorizontalAlignment="Left" Margin="5,2"
Click="AddPhotoes"/>
<ListBox Grid.Row="1" ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<HierarchicalDataTemplate>
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="26"/>
</Grid.RowDefinitions>
<Image Stretch="Fill" Width="100" Height="100" Source="{Binding ImageSourcePath}"/>
<TextBlock Grid.Row="1" HorizontalAlignment="Center" Text="{Binding PhotoName}"/>
</Grid>
</HierarchicalDataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Grid.Row="2" HorizontalAlignment="Right" Margin="5,2" Height="22" Width="60" Content="保存"
Click="SavePhotos"/>
</Grid>
</Window>
Listbox橫向顯示和dataTemplate
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.