locked
Default Selection of the Grid RRS feed

  • Question

  • Hi

    In my Grid I want to select rows from the different pages and maintain the selection when I navigate between pages. I am able to store and show as selected while navigating. Here are the problems

    1. When ever I navigate between pages the first row gets selected by default. I tried the solution by declaring FirstRow and setting SelectedItem = -1, but when I go to the next page and clicks on that then first time it is not get selected.

    2. SEcondly when ever I make th row as selected by adding the objects to the SelectedItems.add(obj) it shows selected but it is in different color. I tried to get focus to the Grid so that the selection will be highlighted but not highlighted.

    Thanks

    Anandraj.A.

    Thursday, February 19, 2009 1:19 AM

Answers

  • When ever I navigate between pages the first row gets selected by default. I tried the solution by declaring FirstRow and setting SelectedItem = -1, but when I go to the next page and clicks on that then first time it is not get selected.

    When ever you load/reload the datagrid, the first row is selected by default, you could use a flag to overcome the situation. If the row is not getting selected then i would suggest you to debug on your selection changed event. See if it is being triggered or not. The problem should be lying there.

    http://silverlight.net/forums/t/61567.aspx

    2. SEcondly when ever I make th row as selected by adding the objects to the SelectedItems.add(obj) it shows selected but it is in different color. I tried to get focus to the Grid so that the selection will be highlighted but not highlighted.

    try adding item in a List<Person> lst...something like this and bind the lst to the datagrid.Itemsource = lst, then try selecting a row,...Any selection to the row by default gets highlighted

    Sharker Khaleed Mahmud
    Software Developer
    (MCP,MCTS,MCPD[web])

    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.

     

    Thursday, February 26, 2009 12:08 AM