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
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
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
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
>
>
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
>>
>>
>
>
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
>>>
>>>
>>
>>
>
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
>>>>
>>>>
>>>
>>>
>>
>
>
| Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Contact List on WinMail main window | BMeltzer | Vista mail | 3 | 21 Jul 2008 |
| Identify the list of controls in an app | Madmax42 | PowerShell | 3 | 19 May 2008 |
| Get Process List from window Service | kalpesh | Vista General | 5 | 27 Jun 2007 |
| how to list controls present on the Winfx window | sam | Avalon | 4 | 03 Jun 2006 |
| can we list the controls available on the WPF Window.. | sam | WinFX General | 0 | 30 May 2006 |