DataGrid Multiple Selection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ahmet AKGUN

    #1

    DataGrid Multiple Selection


    Hi;

    How can we get multiple selections on a datagrid ?
    There is one property called CurrentRowIndex but it always retrieves last
    selection.
    On grid I have lots of selections, all selected using Ctrl key and I need
    all of them.

    Any way to get all selections ?

    Thanks...


  • Dmitriy Lapshin [C# / .NET MVP]

    #2
    Re: DataGrid Multiple Selection

    Hello Akhmet,

    Yes, there is a way. The DataGrid has IsSelected method enabling you to
    query any row whether it is selected. This, however, could kill the
    performance should you have thousands or rows and each of them has to be
    probed. Unfortunately, there is no kind of "SelectedRo ws" collection
    available. Hope this will be changed in the next version of the .NET
    Framework.

    --
    Dmitriy Lapshin [C# / .NET MVP]
    X-Unity Test Studio

    Bring the power of unit testing to VS .NET IDE

    "Ahmet AKGUN" <akgun_ahmet@ho tmail.com> wrote in message
    news:OUnV7oCeDH A.892@TK2MSFTNG P12.phx.gbl...[color=blue]
    >
    > Hi;
    >
    > How can we get multiple selections on a datagrid ?
    > There is one property called CurrentRowIndex but it always retrieves last
    > selection.
    > On grid I have lots of selections, all selected using Ctrl key and I need
    > all of them.
    >
    > Any way to get all selections ?
    >
    > Thanks...
    >
    >[/color]

    Comment

    • Ahmet AKGUN

      #3
      Re: DataGrid Multiple Selection


      IsSelected will work for now,
      Thansk Dmitriy.

      "Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.c om> wrote
      in message news:%23Uv0UgDe DHA.1764@TK2MSF TNGP09.phx.gbl. ..[color=blue]
      > Hello Akhmet,
      >
      > Yes, there is a way. The DataGrid has IsSelected method enabling you to
      > query any row whether it is selected. This, however, could kill the
      > performance should you have thousands or rows and each of them has to be
      > probed. Unfortunately, there is no kind of "SelectedRo ws" collection
      > available. Hope this will be changed in the next version of the .NET
      > Framework.
      >
      > --
      > Dmitriy Lapshin [C# / .NET MVP]
      > X-Unity Test Studio
      > http://x-unity.miik.com.ua/teststudio.aspx
      > Bring the power of unit testing to VS .NET IDE
      >
      > "Ahmet AKGUN" <akgun_ahmet@ho tmail.com> wrote in message
      > news:OUnV7oCeDH A.892@TK2MSFTNG P12.phx.gbl...[color=green]
      > >
      > > Hi;
      > >
      > > How can we get multiple selections on a datagrid ?
      > > There is one property called CurrentRowIndex but it always retrieves[/color][/color]
      last[color=blue][color=green]
      > > selection.
      > > On grid I have lots of selections, all selected using Ctrl key and I[/color][/color]
      need[color=blue][color=green]
      > > all of them.
      > >
      > > Any way to get all selections ?
      > >
      > > Thanks...
      > >
      > >[/color]
      >[/color]


      Comment

      Working...