![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | How to obtain the controls list of a window hi all i would obtain the controls list of a window (same as the this.Controls property of a winform) is there any method or property to do this ? thanks for your help ! -- Thierry |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How to obtain the controls list of a window It's up to the control's implementor to provide access to its logical parent/children. However you can walk the visual tree by using the VisualTreeHelper class. There are static methods like GetParent, GetChild, GetChildrenCount, etc. on there. -- Bill Henning Actipro Software WPF Wizard Control - http://www.actiprosoftware.com/Produ...d/Default.aspx "Thierry" <newsgroup@delacroix62.fr> wrote in message news 6543AF1-0524-4D2F-A211-92B19031A147@microsoft.com...> hi all > > i would obtain the controls list of a window (same as the this.Controls > property of a winform) > > is there any method or property to do this ? > > thanks for your help ! > > > -- > Thierry |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How to obtain the controls list of a window You can use control's VisualChildrenCount property and GetVisualChild method. These members are protected so you can use them only of you derive from some control. For other cases use VisualTreeHelper and LogicalTreeHelper classes. -- HTH Stoitcho Goutsev (100) "Bill Henning" <no_spam@hotmail.com> wrote in message news:OhkAWJ7PHHA.404@TK2MSFTNGP02.phx.gbl... > It's up to the control's implementor to provide access to its logical > parent/children. However you can walk the visual tree by using the > VisualTreeHelper class. There are static methods like GetParent, > GetChild, GetChildrenCount, etc. on there. > > -- > > Bill Henning > Actipro Software > > WPF Wizard Control - > http://www.actiprosoftware.com/Produ...d/Default.aspx > > > > "Thierry" <newsgroup@delacroix62.fr> wrote in message > news 6543AF1-0524-4D2F-A211-92B19031A147@microsoft.com...>> hi all >> >> i would obtain the controls list of a window (same as the this.Controls >> property of a winform) >> >> is there any method or property to do this ? >> >> thanks for your help ! >> >> >> -- >> Thierry > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: How to obtain the controls list of a window hi thanks stoitcho and bill it works with LogicalTreeHelper but not with VisualTree in the window constructor foreach (object child in LogicalTreeHelper.GetChildren(this)) works but VisualTreeHelper.GetChildrenCount(this) always return 0 ! "Stoitcho Goutsev (100)" <100@100.com> a écrit dans le message de news:u3Pbs78PHHA.780@TK2MSFTNGP03.phx.gbl... > You can use control's VisualChildrenCount property and GetVisualChild > method. These members are protected so you can use them only of you derive > from some control. For other cases use VisualTreeHelper and > LogicalTreeHelper classes. > > > -- > HTH > Stoitcho Goutsev (100) > > "Bill Henning" <no_spam@hotmail.com> wrote in message > news:OhkAWJ7PHHA.404@TK2MSFTNGP02.phx.gbl... >> It's up to the control's implementor to provide access to its logical >> parent/children. However you can walk the visual tree by using the >> VisualTreeHelper class. There are static methods like GetParent, >> GetChild, GetChildrenCount, etc. on there. >> >> -- >> >> Bill Henning >> Actipro Software >> >> WPF Wizard Control - >> http://www.actiprosoftware.com/Produ...d/Default.aspx >> >> >> >> "Thierry" <newsgroup@delacroix62.fr> wrote in message >> news 6543AF1-0524-4D2F-A211-92B19031A147@microsoft.com...>>> hi all >>> >>> i would obtain the controls list of a window (same as the this.Controls >>> property of a winform) >>> >>> is there any method or property to do this ? >>> >>> thanks for your help ! >>> >>> >>> -- >>> Thierry >> >> > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: How to obtain the controls list of a window It is possible that there is a logical tree, but the vsiual tree doesn't exist. What is the control you are playing with? If it is a control that you wrote make sure that you override and provide implementation for VisualChildrenCount and GetVisualChild members. These are the methods that the VisualTreeHelper uses to walk the visual tree. -- Stoitcho Goutsev (100) "Thierry" <newsgroup@delacroix62.fr> wrote in message news:1294C214-8329-464A-9F96-5118EAD8C8E0@microsoft.com... > hi thanks stoitcho and bill > > it works with LogicalTreeHelper but not with VisualTree > > in the window constructor > > foreach (object child in LogicalTreeHelper.GetChildren(this)) works > > but VisualTreeHelper.GetChildrenCount(this) always return 0 ! > > > > > "Stoitcho Goutsev (100)" <100@100.com> a écrit dans le message de > news:u3Pbs78PHHA.780@TK2MSFTNGP03.phx.gbl... >> You can use control's VisualChildrenCount property and GetVisualChild >> method. These members are protected so you can use them only of you >> derive from some control. For other cases use VisualTreeHelper and >> LogicalTreeHelper classes. >> >> >> -- >> HTH >> Stoitcho Goutsev (100) >> >> "Bill Henning" <no_spam@hotmail.com> wrote in message >> news:OhkAWJ7PHHA.404@TK2MSFTNGP02.phx.gbl... >>> It's up to the control's implementor to provide access to its logical >>> parent/children. However you can walk the visual tree by using the >>> VisualTreeHelper class. There are static methods like GetParent, >>> GetChild, GetChildrenCount, etc. on there. >>> >>> -- >>> >>> Bill Henning >>> Actipro Software >>> >>> WPF Wizard Control - >>> http://www.actiprosoftware.com/Produ...d/Default.aspx >>> >>> >>> >>> "Thierry" <newsgroup@delacroix62.fr> wrote in message >>> news 6543AF1-0524-4D2F-A211-92B19031A147@microsoft.com...>>>> hi all >>>> >>>> i would obtain the controls list of a window (same as the >>>> this.Controls property of a winform) >>>> >>>> is there any method or property to do this ? >>>> >>>> thanks for your help ! >>>> >>>> >>>> -- >>>> Thierry >>> >>> >> >> > |
My System Specs![]() |
| | #6 (permalink) |
| | Re: How to obtain the controls list of a window hi in fact i want to obtain all the control with an existing binding to add validation rule, maxlenght, etc.. i'm storing the rules in a custm attribute of the property of the object the object is the datacontext and i bind the property to the control (textbox, slider, ect...) so in the window constructor i want to enumerate the controls of this window an detect if a binding exist and in this case if the binding property contains a custom attribute i want to apply validation rules etc.... "Stoitcho Goutsev (100)" <100@100.com> a écrit dans le message de news:%233$yUT$PHHA.3944@TK2MSFTNGP06.phx.gbl... > It is possible that there is a logical tree, but the vsiual tree doesn't > exist. > > What is the control you are playing with? If it is a control that you > wrote make sure that you override and provide implementation for > VisualChildrenCount and GetVisualChild members. These are the methods that > the VisualTreeHelper uses to walk the visual tree. > > > -- > Stoitcho Goutsev (100) > > "Thierry" <newsgroup@delacroix62.fr> wrote in message > news:1294C214-8329-464A-9F96-5118EAD8C8E0@microsoft.com... >> hi thanks stoitcho and bill >> >> it works with LogicalTreeHelper but not with VisualTree >> >> in the window constructor >> >> foreach (object child in LogicalTreeHelper.GetChildren(this)) works >> >> but VisualTreeHelper.GetChildrenCount(this) always return 0 ! >> >> >> >> >> "Stoitcho Goutsev (100)" <100@100.com> a écrit dans le message de >> news:u3Pbs78PHHA.780@TK2MSFTNGP03.phx.gbl... >>> You can use control's VisualChildrenCount property and GetVisualChild >>> method. These members are protected so you can use them only of you >>> derive from some control. For other cases use VisualTreeHelper and >>> LogicalTreeHelper classes. >>> >>> >>> -- >>> HTH >>> Stoitcho Goutsev (100) >>> >>> "Bill Henning" <no_spam@hotmail.com> wrote in message >>> news:OhkAWJ7PHHA.404@TK2MSFTNGP02.phx.gbl... >>>> It's up to the control's implementor to provide access to its logical >>>> parent/children. However you can walk the visual tree by using the >>>> VisualTreeHelper class. There are static methods like GetParent, >>>> GetChild, GetChildrenCount, etc. on there. >>>> >>>> -- >>>> >>>> Bill Henning >>>> Actipro Software >>>> >>>> WPF Wizard Control - >>>> http://www.actiprosoftware.com/Produ...d/Default.aspx >>>> >>>> >>>> >>>> "Thierry" <newsgroup@delacroix62.fr> wrote in message >>>> news 6543AF1-0524-4D2F-A211-92B19031A147@microsoft.com...>>>>> hi all >>>>> >>>>> i would obtain the controls list of a window (same as the >>>>> this.Controls property of a winform) >>>>> >>>>> is there any method or property to do this ? >>>>> >>>>> thanks for your help ! >>>>> >>>>> >>>>> -- >>>>> Thierry >>>> >>>> >>> >>> >> > > |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Showing contacts list in main window | Vista mail | |||
| Identify the list of controls in an app | PowerShell | |||
| Get Process List from window Service | Vista General | |||