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
4165
How to have first row in grid NOT selected on init?
posted

Hi,

How can I make the the first row of my Datagrid NOT selected when I initilize the grid? In other words, when I first load the form and grid, attach the datasource and then display to the user the first row is always selected and highlighted blue.

I want to keep the functionality of when a user selects a row it highlighting blue (or whatever color I set it to) but I don't want that to happen initially.

 

Thanks,

 

Parents
No Data
Reply
  • 37774
    posted

    I think that you're mistaking the ActiveRow of the grid as being selected.  The grid will stay in sync with the what the CurrencyManager says is the currently active row in the underlying DataSource.  When you bind the grid, if you check the BindingContext's Position property, you will see that it is 0, which corresponds to the first row in the grid and will be reflected as such.  You could either set the Appearance of the active row to be transparent, or when loading you could just set the SyncWithCurrencyManager property to false.

    -Matt 

Children