int GetFocusedItemIndex() { if (ElementTreeHelper.IsKeyboardFocusWithin(ItemsPresenter)) { return(0); } if (ElementTreeHelper.IsFocused(OKButton)) { return(1); } if (ElementTreeHelper.IsFocused(CancelButton)) { return(2); } return(-1); }