Home Forums WPF controls Xceed DataGrid for WPF Image on column with Combo Box

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #25678 |

    I have a Combo box, and would like to put an image along with the text in a column’s cell. I need to bind with a converter to get the image as well.

    The pull down gets the image and text fine using the converter, but I can’t get the chosen item to have its image displayed in the column alongside the text.

    Here is my XAML code:

    <c:MyShapeToSmallImageConverter x:Key=”ShapeToSmallImageConverter”/>

    <DataTemplate x:Key=”imageAndTypeCell”>
    <StackPanel Style=”{StaticResource ComboBoxItemStackPanel}” Orientation=”Horizontal” >
    <Image Source=”{Binding Path=NotchShape, Converter={StaticResource ShapeToSmallImageConverter}}”/>
    <TextBlock Text=”{Binding Converter={StaticResource ShapeToStringConverter}}” VerticalAlignment=”Center”/>
    </StackPanel>
    </DataTemplate>

    <xcdg:Column FieldName=”Shape”
    Title=”Shape”
    CellContentTemplate=”{StaticResource imageAndTypeCell}”>

    Can you see the problem? I’m sure data binding has something to do with it.

    Thanks,
    Shelley

    Imported from legacy forums. Posted by Shelley (had 3313 views)

    User (Old forums)
    Member
    Post count: 23064

    I think you should use xcdg:CellEditorBinding or xcdg:CellContentBinding instead of Binding

    Imported from legacy forums. Posted by nat (had 256 views)

    User (Old forums)
    Member
    Post count: 23064

    Ooops. I may be wrong. What is the definition of Shape?

    Imported from legacy forums. Posted by nat (had 256 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for your help!

    Shape is an enumerated type, there are 7 shapes and each correspond to a small image file that represent how they look. The MyShapeToImageConverter function does the convertion.

    Imported from legacy forums. Posted by Shelley (had 217 views)

    User (Old forums)
    Member
    Post count: 23064

    Path=NotchShape is not going to work then since it tries to find Path=NotchShape in enum which doesn’t exist

    Imported from legacy forums. Posted by nat (had 4408 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.