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
760
Show/Hide cell programmatically
posted

I have a grid with an unbound field containing an image in control template for a CellValuePresenter. I want to show/hide this image or cell contents in code-behind. I am trying InitializeRecord event with this code:

Dim dr As DataRecord = CType

(e.Record, DataRecord)

 

 

Dim c As Cell = dr.Cells(5)

 

 

Dim cp As CellValuePresenter = CellValuePresenter.FromCell(c)

cp.IsEnabled = False (based on some condition of course)

But the cp is Nothing!

Can any help please?

Tahir

Parents
No Data
Reply
  • 69686
    posted

    Hello Tahir,

    InitializeRecord event s too early for the presenters to be generated. You will be able to access them as early as the Loaded event of the XamDataGrid. Because of the default virtualization settings, only the currently visible presenters will be generated, so you can use the GetRecordsInView() method to access only those.

Children
No Data