GridViewImageColumn - code behind

3 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 25 Oct 2012 Link to this post

    Hi,

    i use a RadGridView with a "GridViewImageColumn" like this:
    <telerik:GridViewImageColumn DataMemberBinding="{Binding Bild}" Width="50" IsEnabled="False" ImageStretch="None" />

    But how do i bind an image to this column:
    public class Calls
    {
    public string Name { get; set; }
    public string Tele { get; set; }
    public string time { get; set; }
    public string Datum { get; set; }
    public Image bild { get; set; }
    }
    ObservableCollection<Calls> _CallCollection = new ObservableCollection<Calls>();
    _CallCollection.Add(new Calls
    {
    Name = name_s,
    Tele = tele_s,
    time = time_s,
    Datum = datum_s,
    bild = image
    });

    Name, Tele, time and Datum is ok, but i can't see an image. How do i solve this?

    i tried:
    var image = new Image();
    image.Source = new BitmapImage(new Uri("pack://application:,,/Images/settings.png", UriKind.Absolute));

    But this is wrong...

    thanks a lot
    Rene
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 25 Oct 2012 Link to this post

    Hello Rene,

    You may bind the GridViewImageColumn to a string or a byte[] data using the DataMemberBinding property. Please check this forum thread for further information.

    Kind regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 25 Oct 2012 Link to this post

    Hi,

    i solved se Problem by using a string and a Converter.

    thanks
Back to Top