Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

How to obtain the controls list of a window

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-23-2007   #1 (permalink)
Thierry
Guest


 

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 SpecsSystem Spec
Old 01-24-2007   #2 (permalink)
Bill Henning
Guest


 

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
news6543AF1-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 SpecsSystem Spec
Old 01-24-2007   #3 (permalink)
Bill Henning
Guest


 

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
news6543AF1-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 SpecsSystem Spec
Old 01-24-2007   #4 (permalink)
Stoitcho Goutsev \(100\)
Guest


 

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
> news6543AF1-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 SpecsSystem Spec
Old 01-24-2007   #5 (permalink)
Stoitcho Goutsev \(100\)
Guest


 

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
> news6543AF1-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 SpecsSystem Spec
Old 01-24-2007   #6 (permalink)
Thierry
Guest


 

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
>> news6543AF1-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 SpecsSystem Spec
Old 01-24-2007   #7 (permalink)
Thierry
Guest


 

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
>> news6543AF1-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 SpecsSystem Spec
Old 01-24-2007   #8 (permalink)
Stoitcho Goutsev \(100\)
Guest


 

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
>>> news6543AF1-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 SpecsSystem Spec
Old 01-24-2007   #9 (permalink)
Stoitcho Goutsev \(100\)
Guest


 

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
>>> news6543AF1-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 SpecsSystem Spec
Old 01-24-2007   #10 (permalink)
Thierry
Guest


 

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
>>>> news6543AF1-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 SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Contact List on WinMail main window BMeltzer Vista mail 3 07-21-2008 01:52 PM
Identify the list of controls in an app Madmax42 PowerShell 3 05-19-2008 03:42 PM
Get Process List from window Service kalpesh Vista General 5 06-27-2007 09:36 AM
how to list controls present on the Winfx window sam Avalon 4 06-02-2006 11:28 PM


Update your Vista Drivers Update Your Vista Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008
Page generated in 0.35424 seconds with 10 queries