Image Source Converter

2 posts, 0 answers
  1. ITA
    ITA avatar
    387 posts
    Member since:
    Aug 2009

    Posted 24 Oct 2014 Link to this post


    i have to change the image of a GridViewCell dynamically.

    <local:ImageDayConverter x:Key="DayConverter" />
            <Style x:Key="CellStyle" TargetType="{x:Type telerik:GridViewCell}">
                <Setter Property="Background" Value="red" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="BorderBrush" Value="{x:Null}" />
                <Setter Property="Template">
                            <Border BorderBrush="#f2f2f2" BorderThickness="0,0,0,2" Padding="0,5,0,5">
                                <StackPanel Orientation="Horizontal">
                                    <Image Height="30" Source="{Binding DayImage, Converter={StaticResource DayConverter}}"/>
                                    <StackPanel Orientation="Vertical" Margin="10,0,0,0" VerticalAlignment="Top">
                                        <TextBlock Text="{Binding Titel}" />
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Start}" Foreground="#9fa2ae"/>
                                            <TextBlock Text=" - " />
                                            <TextBlock Text="{Binding Startzeit}" Foreground="#9fa2ae" />

    This is my Image:
    <Image Height="30" Source="{Binding DayImage, Converter={StaticResource DayConverter}}"/>

    How must the Converter look like? The Value of DayImage is a string "10,10,2014"

    Thanks a lot
    Best Regards
  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 28 Oct 2014 Link to this post

    Hello Rene,

    I would suggest you to specify CellTemplate directly on GridViewColumn instead. You can also check the following article in our online documentation suggesting how to do so: Setting CellTemplate and CellEditTemplate.
    Then, you can apply a CellTemplateSelector.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top