Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
230
Unbound Column image
posted

Hi,

I want to dynamically add an unbound column on my grid.

This unbound column will display an image depending on the data bound.

e.g.

AnimalID    Name       UnboundCol

1                   Dog           Shows an image of a dog based on Animal ID = 1

2                   Cat            Shows cat image

Parents
  • 69832
    Verified Answer
    Offline posted

    Handle the InitializeLayout event, and add a new UltraGridColumn instance to the Columns collection of the band that should contain it, making that column's DataType typeof(Image), and assign an EmbeddableImageRenderer to its Editor property.

    Example:
    private void ultraGrid_InitializeLayout(object sender, InitializeLayoutEventArgs e)
    {
        ColumnsCollection columns = e.Layout.Bands[0].Columns;
        UltraGridColumn imageColumn = columns.Add( "imageColumn" );
        imageColumn.DataType = typeof(Image);
        imageColumn.Editor = new EmbeddableImageRenderer();
    }

     

Reply Children