locked
What Happened to SelectionMode.None? RRS feed

  • Question

  • Migrating our current 8.0 app to 8.1, it seems to binding a gridview's SelectionMode to SeelctionMode.None is no longer working. When I try to assign the value directly in C#, the intellisense doesn't even show a "None" option. It does, however show up in the xaml intellisense.

    Basically, I'm binding the gridview to different SelectionModes and I set the SelectionMode to None before setting it to any other mode to avoid having the view auto-select the 1st item. Is there a different and better way to do this? Again, the technique I'm using worked fine in 8.0.

    Thanks

    Saturday, October 12, 2013 4:24 PM

Answers

All replies

  • "Works on my machine" :-)

    (this is in the default grid project)


    Tim Heuer | Program Manager, UI Platforms (XAML, WinJS) | http://timheuer.com/blog | @timheuer | Callisto - XAML UI Toolkit

    (if my post has answered your question, please consider using the *mark as answer* feature in the forums to help others)

    Saturday, October 12, 2013 5:08 PM
  • Interesting Tim. Here's what I get. I'm running Ultimate 2013 RC. What about you?

    Saturday, October 12, 2013 5:33 PM
  • @Sparksteam - you are using the wrong type.  You need to be using the ListViewBase.SelectionMode enum.  What you see there looks to be for ListBox which does not enable a None option.

    Tim Heuer | Program Manager, UI Platforms (XAML, WinJS) | http://timheuer.com/blog | @timheuer | Callisto - XAML UI Toolkit

    (if my post has answered your question, please consider using the *mark as answer* feature in the forums to help others)

    Saturday, October 12, 2013 5:54 PM
  • Hi Sparksteam,

    it works also on my machine. :-)

    The SelectionMode-Enum you're using in your code is for the ListBox. The SelectionMode-Property of the ListBox-class is of type SelectionMode-Enum, and that enum has just the values Single, Multiple and Extended. So if the enum was suggested by Visual Studio, your element with the name ResultsGridView is in fact a ListBox. :-)

    For the real - yes, there's only the one and only - GridView (and also for the ListView), the SelectionMode-Property is of type ListViewSelectionMode-enum. And that enum has the additional value None. So if you look at Tim's snippet, you see that he's not using the SelectionMode-, but the ListViewSelectionMode-enum.

    Your XAML intellisense shows the value None, cause it's using the right enum for the Property.


    Thomas Claudius Huber

    "If you can´t make your app run faster, make it at least look & feel extremly fast"

    twitter: @thomasclaudiush
    homepage: www.thomasclaudiushuber.com
    author of: ultimate Windows Store Apps handbook | ultimate WPF handbook | ultimate Silverlight handbook


    Saturday, October 12, 2013 6:01 PM
  • I see guys, my bad, as they say. So for what I'm trying to do to prevent the auto-selection when I switch selection modes, which worked fine on 8.0, is there any reason why it's not working on 8.1? I definitely see the auto-selection happening on 8.1?
    Saturday, October 12, 2013 7:03 PM