आप इसे मूवफोकस कॉल के साथ कर सकते हैं। आप फोकसमेनर के माध्यम से वर्तमान में केंद्रित आइटम प्राप्त कर सकते हैं। निम्न कोड विंडो में सभी ऑब्जेक्ट्स को फिर से चालू करेगा और उन्हें एक सूची में जोड़ देगा। ध्यान दें कि यह ध्यान केंद्रित करके विंडो को भौतिक रूप से संशोधित करेगा। यदि विंडो सक्रिय नहीं है तो संभवतः कोड काम नहीं करेगा।
// Select the first element in the window
this.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
TraversalRequest next = new TraversalRequest(FocusNavigationDirection.Next);
List<IInputElement> elements = new List<IInputElement>();
// Get the current element.
UIElement currentElement = FocusManager.GetFocusedElement(this) as UIElement;
while (currentElement != null)
{
elements.Add(currentElement);
// Get the next element.
currentElement.MoveFocus(next);
currentElement = FocusManager.GetFocusedElement(this) as UIElement;
// If we looped (If that is possible), exit.
if (elements[0] == currentElement)
break;
}
स्रोत
2009-04-30 22:48:58
genial, बहुत बहुत धन्यवाद! – lamarmora