Can I set Flexgrid cell to object and display a property?

Posted by: mr.raymond.brennan on 2 September 2021, 1:49 pm EST

  • Posted 2 September 2021, 1:49 pm EST

    I have a ```

    Person

    
    I want to set the grid cell to this object and display only the first name.
    
    [i]//set the cell value to the object[/i]
    

    myGrid.(row,col) = myPerson

    
    [i]//set the cell display value to FirstName[/i]
    

    myGrid

    
    
    Then later I want to be able to retrieve that object.
    
    

    myNewPerson = myGrid(row, col)

    
    
    Can this be done in the Winforms grid?  If so, how please?[img]https://gccontent.blob.core.windows.net/forum-uploads/file-2a85da95-2b16-4c61-8867-0a8ad7f70bde.png[/img]
  • Posted 2 September 2021, 4:00 pm EST

    I had a brainwave… I overrode the ToString() function of the class to return the Person.Name :))

    Still though, it would be nice if the grid would allow the developer to set the datacontext like in WPF.

        Public Overrides Function ToString() As String
            Return _customer.DisplayName
        End Function
    
    
  • Posted 2 September 2021, 4:31 pm EST

  • Posted 3 September 2021, 7:29 am EST

    Hello,

    It is good to hear that the issue has been resolved at your end for now.

    We have passed your concern to the developers and requested them to add this property to the API. We will let you know as soon as we get any update from their end.

    [Internal Tracking ID: C1WIN-25572]

    Regards,

    Prabhat Sharma

  • Posted 5 September 2021, 4:47 am EST

    Hello Prabhat

    It would be a very useful feature indeed. Already I am finding a need for it in a Parent / Child tables scenario.

    It’s great to be able to put an object into a cell, super useful, but now we need to be able to set the DataContext to different values. I could see 100 uses for it.

    I look forward with fingers crossed to an update on this feature soon :))

  • Posted 6 September 2021, 1:53 am EST

    Hello,

    We understand your concern and forwarded your comments to the developers. We will let you know as soon as we get the updates from the dev’s end.

    Regards,

    Prabhat Sharma.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels