Я пытался создать простую галерею, которая бы загружала изображения из папки, а затем просто отображала их в сетке с помощью ползунка. Я провел некоторое исследование, но я просто не могу заставить изображения появляться - все, что я получаю, это пустое место. Ниже то, что я сделал до сих пор.
MainWindow.xaml
<Window x:Class="FGOhelper.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FGOhelper"
mc:Ignorable="d"
Title="FGO Little Helper" Height="350" Width="525">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="74*"/>
<ColumnDefinition Width="443*"/>
</Grid.ColumnDefinitions>
<ListBox x:Name="listBox" Grid.Column="1" HorizontalAlignment="Left" Height="257" Margin="0,10,0,0" VerticalAlignment="Top" Width="399" ScrollViewer.VerticalScrollBarVisibility="Visible">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="3" Columns="3"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ItemsControl x:Name="imageItems">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}" Margin="1"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ListBox>
</Grid>
MainWindow.xaml.cs
namespace FGOhelper{
public partial class MainWindow : Window{
public MainWindow(){
InitializeComponent();
String pathPhoto = @"D:\images\fgotest";
imageItems.ItemsSource = Directory.EnumerateFiles(pathPhoto, " *.jpg");
}}}