Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1160
How to add multiple images in one column using XAMGrid.
posted

Hi,

We are using XAMGrid and trying to add multiple images in one column like we can add ListView with in that can show multiple images.

How we can show multiple image in one column. We are following MVVM pattern. Please help us how we can achieve it.

Thanks. Your help would be appreciate.

  • 6365
    Offline posted

    Hello kanwar,

    In order to display multiple images in a ListView within a cell in the XamGrid, I can suggest you use a TemplateColumn and set its ItemTemplate property to a DataTemplate that contains the respective ListView (bound to a collection of images for every underlying Data object).

    XAML:

    <ig:TemplateColumn Key="Images" HeaderText="Cars">
        <ig:TemplateColumn.ItemTemplate>
            <DataTemplate>
                <ListView ItemsSource="{Binding Path=Images}" HorizontalAlignment="Stretch">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <Image Source="{Binding}" Width="30" Height="30" />
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </DataTemplate>
        </ig:TemplateColumn.ItemTemplate>
    </ig:TemplateColumn>

    In order to display a single image inside of a column, you can always use an ImageColumn (refer to the "XamGrid > Display > Image Column" sample from our WPF Samples Browser)

    I have attached a sample application that demonstrates the approach from above.

    If you have any questions, please let me know.

    XamGrid_sample.zip