Wednesday, December 29, 2010

WPF Make a Button invoked by Enter Key, set it as IsDefault=true

In the window, I try to use focus manager to set the button focused to invoke Enter Key, but the focus may lost.

By setting the IsDefault property, problem solved.

public void EnableFinish()
    btnNext.Visibility = Visibility.Hidden;
    btnFinish.Visibility = Visibility.Visible;
    btnFinish.IsDefault = true;

No comments:

Post a Comment