Display a bound image in a ListView with multiple columns in C#

513 Views Asked by At

I have a short question about WPF and C#. Can somebody give me an example how the following xaml code would look in C# code?

In xaml this works, but i would like to do some dynamic C# creation and need to do this in C# code as well. I am able to do every bit of binding in code, except this part..

<GridViewColumn>
    <GridViewColumn.CellTemplate>
         <DataTemplate>
              <Image Source="{Binding FileImage, Converter={StaticResource imageConverter}}" Width="32" Height="32"/>
         </DataTemplate>
    </GridViewColumn.CellTemplate>
</GridViewColumn>

The way i load my other columns is like this:

leftColumnOne = new GridViewColumn();
leftColumnOne.Header = "First name";
leftColumnOne.DisplayMemberBinding = new Binding("FirstName");
0

There are 0 best solutions below