When I databind my GridView to an ObservableCollection, the first item of the collection is automatically selected. The SelectionMode
property of the GridView is set to multiple
. Is there some way to prevent this auto-selection? Or on what event should I listen so that I can reset the SelectedIndex
of the GridView back to -1?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
My situation is the opposite. I have a
GridView
that was bind to anObservableCollection
, and I wanted the 1st item to be selected but it was not! I figured out why that was the case though. There are 2 ways to generate myObservableCollection
and depending on which method I chose, the 1st item is either selected or not.for example, I have a variable ItemList in my viewmodel which I bind to my GridView
Method 1 (nothing selected)
Method 2 (1st item automatically selected)
Set the
IsSynchronizedWithCurrenItem
property tofalse
on the gridview in xamlThere is acutally a pretty simple solution. I set the
SelectionMode
of the GridView toNone
in the XAML. Then, when the page is created, I change theSelectionMode
toMultiple
.However, the problem I am having seems to be caused by my own program. This is a workaround for the issue I am having, the autoselection is not the default behavior.
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/da7e9f3b-9a3e-47ca-8223-b50539293f5f