Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. winRT xaml/C# listview selected index

winRT xaml/C# listview selected index

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpasp-netdatabasewpfquestion
9 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Clodetta del Mar
    wrote on last edited by
    #1

    hi@all! :-) i have a listview control in my winRT application and, when the user taps a tile, i´d like to save the previously selectedIndex. i can´t find an appropriate eventhandler to achieve this; i only found SelectionChanged-event, but, as one might guess, at this particular time the Event is already fired and i retrieve only the new selected index... can anyone please Point me to the right direction... eh, to the right Event ? and - if someone knows where to get an elaborated overview for the LifeCycle - as known form ASP.NET pages - that would be highly appreciated... ;) thanks in advance, Kind regards, clodetta

    M C 2 Replies Last reply
    0
    • C Clodetta del Mar

      hi@all! :-) i have a listview control in my winRT application and, when the user taps a tile, i´d like to save the previously selectedIndex. i can´t find an appropriate eventhandler to achieve this; i only found SelectionChanged-event, but, as one might guess, at this particular time the Event is already fired and i retrieve only the new selected index... can anyone please Point me to the right direction... eh, to the right Event ? and - if someone knows where to get an elaborated overview for the LifeCycle - as known form ASP.NET pages - that would be highly appreciated... ;) thanks in advance, Kind regards, clodetta

      M Offline
      M Offline
      Marco Bertschi
      wrote on last edited by
      #2

      Hi Clodetta, The MouseDown[^]-Event might be worth a try.

      C 1 Reply Last reply
      0
      • M Marco Bertschi

        Hi Clodetta, The MouseDown[^]-Event might be worth a try.

        C Offline
        C Offline
        Clodetta del Mar
        wrote on last edited by
        #3

        hello, Marco. thank you for your suggestion!!! i´ll give that a try... i´m developing for surface, so I thought that this event isn´t what I want... i´ll report my findings... :) until then, clodetta edit: :-( that is winforms-related, I guess...

        M 1 Reply Last reply
        0
        • C Clodetta del Mar

          hello, Marco. thank you for your suggestion!!! i´ll give that a try... i´m developing for surface, so I thought that this event isn´t what I want... i´ll report my findings... :) until then, clodetta edit: :-( that is winforms-related, I guess...

          M Offline
          M Offline
          Marco Bertschi
          wrote on last edited by
          #4

          Hmm... Can you just look for a similar event in the XAML-control? Another solution could be that you have a second variable where your current index is stored... You would have to update this variable manually and it would end up kinda unclean but this could be the emergency-solution.

          C 1 Reply Last reply
          0
          • M Marco Bertschi

            Hmm... Can you just look for a similar event in the XAML-control? Another solution could be that you have a second variable where your current index is stored... You would have to update this variable manually and it would end up kinda unclean but this could be the emergency-solution.

            C Offline
            C Offline
            Clodetta del Mar
            wrote on last edited by
            #5

            Hi, Marco. sorry for replying late.... first of all: thank you for your help. :) I´ve found several events (ItemClick, Tapped etc) but none of them seem to suit. :(( your second suggestion leads me back to my initial question: where to save the old index...? I wonder what the softie´s intention was when they decided not to implement a SelectedIndex_Changing in addition to SelectedIndex_Changed. that would solve the issue perfectly... :sigh:

            M 1 Reply Last reply
            0
            • C Clodetta del Mar

              hi@all! :-) i have a listview control in my winRT application and, when the user taps a tile, i´d like to save the previously selectedIndex. i can´t find an appropriate eventhandler to achieve this; i only found SelectionChanged-event, but, as one might guess, at this particular time the Event is already fired and i retrieve only the new selected index... can anyone please Point me to the right direction... eh, to the right Event ? and - if someone knows where to get an elaborated overview for the LifeCycle - as known form ASP.NET pages - that would be highly appreciated... ;) thanks in advance, Kind regards, clodetta

              C Offline
              C Offline
              Clodetta del Mar
              wrote on last edited by
              #6

              ok, finally I got it... it´s more like right through the chest into the eye, but now it works... a healthy mixture of ListView.SelectedIndex_Change and Grid.GotFocus did the trick for me; now I can save the old AND the new index.... thanks to marco for his suggestions! post scriptum: I can´t find the checkbox for marking my thread as solved... I guess i´m blind...

              1 Reply Last reply
              0
              • C Clodetta del Mar

                Hi, Marco. sorry for replying late.... first of all: thank you for your help. :) I´ve found several events (ItemClick, Tapped etc) but none of them seem to suit. :(( your second suggestion leads me back to my initial question: where to save the old index...? I wonder what the softie´s intention was when they decided not to implement a SelectedIndex_Changing in addition to SelectedIndex_Changed. that would solve the issue perfectly... :sigh:

                M Offline
                M Offline
                Marco Bertschi
                wrote on last edited by
                #7

                Clodetta del Mar wrote:

                where to save the old index...?

                Create a new control which inherits from the listview control. In the code-behind you can add the logic to handle the case and are maybe able to fire your own, custom selected index changing event...

                cheers, Marco Bertschi

                C 1 Reply Last reply
                0
                • M Marco Bertschi

                  Clodetta del Mar wrote:

                  where to save the old index...?

                  Create a new control which inherits from the listview control. In the code-behind you can add the logic to handle the case and are maybe able to fire your own, custom selected index changing event...

                  cheers, Marco Bertschi

                  C Offline
                  C Offline
                  Clodetta del Mar
                  wrote on last edited by
                  #8

                  That´s also a good idea, but I have already solved the problem, I think, I´ll leave it at that. it now works the way it should, that´s sufficient for me! Thank you again for your help! kind regards! clodetta :)

                  M 1 Reply Last reply
                  0
                  • C Clodetta del Mar

                    That´s also a good idea, but I have already solved the problem, I think, I´ll leave it at that. it now works the way it should, that´s sufficient for me! Thank you again for your help! kind regards! clodetta :)

                    M Offline
                    M Offline
                    Marco Bertschi
                    wrote on last edited by
                    #9

                    Clodetta del Mar wrote:

                    Thank you again for your help!

                    You are welcome...

                    cheers, Marco Bertschi

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups