2

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

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'm calling this code from the window's previewkeydown event, when the focus is in a textbox. I'm digging into the framework now to try and find what is different between XP and Vista inside of MoveFocus(). I feel like I'm doing web development again, testing browsers for quirks...

1
  • In my tests it works the same (only moves between the first two items) both on XP and Vista. Weird as it is, but it must be something else in the settings somewhere that causes this behavior. Nov 26, 2009 at 10:02

3 Answers 3

1

Did you run Windows XP Service Pack2, in the doc the requirements are : Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

Msdn doc

For me, I develop WPF apps under XP and all is working right...

0

My feeling in general is that many features in WPF uses technology that is new in Vista, and not supported in XP. Things I have experienced are mainly related to visual effects, but in your case, it is obviously something else.

My initial thought in your case is that there are some windows messages that are new in Vista that does not work in XP.

0

The requirements for VS2008 are met by XP SP2, WPF is best suited for Windows Vista/Windows 7, that might be the case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.