WPF简单画廊

时间:2019-03-11 17:49:43

标签: c# wpf

我一直在尝试创建一个简单的图库,该图库将从文件夹中加载图像,然后使用滑块将其简单地显示在网格上。我做了一些研究,但我只是无法显示图像-我得到的只是空白。这是我到目前为止所做的。

MainWindow.xaml

HttpComponentsClientHttpRequestFactory requestFactory = (HttpComponentsClientHttpRequestFactory) oAuth2RestTemplate.getRequestFactory();
int timeout = ReflectionHelper.getField(requestFactory, "connectTimeout", int.class);

MainWindow.xaml.cs

<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>

0 个答案:

没有答案