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
70
xamDataGrid programmatic set row be selected
posted

My xamDataGrid use theme Office2010Blue. I want to programmatically set the first row be default selected. The first time load is OK, the first row background color is orange. But when I submit a query to reload or refresh the grid, the first row background color is silver. How to make it still be orange color? I use the following code:

          record.IsActive = true;
          record.IsSelected = true;

But doesn't work, once grid refresh or reload, the record background color becomes silver.

Thanks,

 

  • 35319
    posted

    Hello biwst1,

     

    I have been looking into your post and I can suggest setting the ‘DataContext’ property of Grid to your data and setting the ‘DataSource’ property of the XamDataGrid to “{Binding}”. After that you can handle the ‘DataContextChanged’ event of the XamDataGrid and implement the functionality that will make the first record become activated. This way every time when you update the data source, the first record will be active and colored in orange. I am attaching a simple sample application(DataGridOffice2010Blue.zip) where this functionality is demonstrated.

     

    If you have any other questions, feel free to ask.

    DataGridOffice2010Blue.zip
  • 35319
    posted

    Hello biwst1,

     

    I am just checking if my last reply was helpful for you.

     

    If you require any further assistance please do not hesitate to ask.