Tuesday 15 June 2010

How can I find UIElement in WPF? -



How can I find UIElement in WPF? -

how can find first element (grid element) in every window ? need window children.but dont want utilize "visualstatehelper". help.

here solution statically. can phone call anywhere.

using system.windows; ... /// <summary> /// gets kid <see cref="system.windows.grid"/> instances of windows have them first child. /// </summary> /// <returns>an enumerable of tuples pairing window instance kid grid.</returns> public static ienumerable<tuple<window, grid>> getallgrids() { foreach (var window in application.current.windows) { grid grid = this.content grid; //grid null if first kid not grid if (grid != null) { yield homecoming tuple.create(window, grid); } } }

wpf

No comments:

Post a Comment