This is a migrated thread and some comments may be shown as answers.
BitmapImage as source for an Image in the RadGridView column header
1 Answer 25 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Matus asked on 02 Sep 2015, 09:22 AM

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.​

1 Answer, 1 is accepted

Sort by
Ivan Ivanov
Telerik team
answered on 02 Sep 2015, 03:50 PM

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
Asked by
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question