WPF MoveFocus () works on Vista, not XP

The next bit of code works on Vista as expected (focus moves down the list), but on XP SP3 (with .Net 3.5 SP1 on both) it only moves between the first two ListView items.

if (myListView.SelectedItem != null) {
    IInputElement orig = FocusManager.GetFocusedElement(this);
    FocusManager.SetFocusedElement(this, myListView);
    ListViewItem lvi = myListView.ItemContainerGenerator.ContainerFromItem(myListView.SelectedItem) as ListViewItem;
    TraversalRequest down = new TraversalRequest(FocusNavigationDirection.Down);

    Boolean result = lvi.MoveFocus(down);
    Console.WriteLine(result.ToString());
    FocusManager.SetFocusedElement(this, orig);
}

      

I am calling this code from the event preview window when the focus is on the textbox. I'm diving into the box right now to try and find what's different between XP and Vista inside MoveFocus (). I feel like I'm doing web development again, testing browsers for quirks ...

+2


source to share


3 answers


You have run Windows XP Service Pack2, in the requirements document: Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

Msdn doc



For me I am developing WPF applications under XP and everything is working correctly ...

+1


source


My overall feeling is that many of the features in WPF use technology that is new in Vista and not supported in XP. The things I've experienced are mostly related to visuals, but in your case, this is obviously something else.



My initial thought in your case is that there are new Windows messages in Vista that don't work in XP.

0


source


Requirements for VS2008 are met by XP SP2, WPF is best suited for Windows Vista / Windows 7, which may be the case.

0


source







All Articles