ImageList in WPF

0

I am using WPF and I need to use several images for my application. In WinForms I know that the ImageList component exists to be able to access them in a more comfortable way and I wanted to know if there is any component that fulfills the same function in WPF.

    
asked by Oscar 01.08.2017 в 08:41
source

1 answer

1

There is no ImageList as such but you can use a ItemsControl to achieve the effect.
You could do something like that and pass a list with the routes of the images.

<ItemsControl ItemsSource="{Binding Path=listaImagenes}" >
    <ItemsControl.ItemTemplate>
        <DataTemplate >
            <Image Source="{Binding RutaImagen}" />
        </DataTemplate>
    </ItemsControl.ItemTemplate>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate >
            <StackPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
</ItemsControl>
    
answered by 01.08.2017 / 08:51
source