BitmapImage as source for an Image in the RadGridView column header

2 posts, 1 answers
  1. Matus
    Matus avatar
    5 posts
    Member since:
    Sep 2014

    Posted 02 Sep 2015 Link to this post

    We have a property

    public BitmapImage ImageProperty{...}

     which is bound to a radgridview column header

    <telerik:RadGridView AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed" ShowGroupPanel="False"
                                         Grid.Row="1" >
                                    <telerik:GridViewDataColumn  DataMemberBinding="{Binding ​Value1}" IsFilterable="False" MinWidth="40">
                                            <Image Source="​some_valid_path.png" Height="16" Margin="4"/>
                                    <telerik:GridViewDataColumn  DataMemberBinding="{Binding ​Value2}" IsFilterable="False" MinWidth="40">
                                                Source="{Binding ​ImageProperty}"  Height="16" Margin="4"/>



    At some point, the ImageProperty is set (and corresponding PropertyChangedEventHandler is created and triggered). It is loaded from backend and is not bound to any file.

    The image in the first column is shown, but the one in the second column is not.

    An image outside of the radgridview

    <Image Source="{Binding ​ImageProperty}"  Height="16" Margin="4" Grid.Column="3"/> 

    will show the image as expected, so the property seems to be propely bound.

    How to make the image bound to a BitmapImage work in the RadGridView header?


    Telerik.Windows.Controls.GridView version is 2014.3.1021.1050.​

  2. Answer
    Ivan Ivanov
    Ivan Ivanov avatar
    1114 posts

    Posted 02 Sep 2015 Link to this post


    GridViewColumn.Header does not inherit its DataContext from RadGridView. Thus you need to specify a precise source in the binding definition. You can try declaring your view model as a static resource and then refer to it in the binding definition:
    <Image Source="{Binding ​ImageProperty, Source={StaticResource . . . }}"  . . . />

    Ivan Ivanov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top