Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - How to access Parent Element of the ItemsControl's Panel?

 
 
Old 01-23-2007   #1 (permalink)
Anton


 
 

How to access Parent Element of the ItemsControl's Panel?

Here is the situation: I have created an overloaded Canvas object as an
external assembly.
Now I use it as a panel object in ItemsControl:

<Viewbox
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:Custom="clr-namespace:CustomNamespace"
Stretch="Fill">
<ItemsControl>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Custom:CustomCanvas/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
........
</Viewbox>

How can I access that ItemsControl object from my assembly. Thing is
that I define some resources on ItemsControl and I want to use them in
my Canvas Assebmly C# code. On runtime the CustomCanvas has Parent
property set to null, so I'm really interested almost all the day how
to get that damn parent.

I will really appreciate your help with that.
Anton


My System SpecsSystem Spec
Old 01-24-2007   #2 (permalink)
Bill Henning


 
 

Re: How to access Parent Element of the ItemsControl's Panel?

Hi Anton,

Parent refers to the logical tree. Perhaps try checking the visual tree
using the VisualTreeHelper.GetParent method.

--

Bill Henning
Actipro Software

WPF Wizard Control -
http://www.actiprosoftware.com/Produ...d/Default.aspx


"Anton" <akhodakivskiy@gmail.com> wrote in message
news:1169585562.903229.58600@j27g2000cwj.googlegroups.com...
> Here is the situation: I have created an overloaded Canvas object as an
> external assembly.
> Now I use it as a panel object in ItemsControl:
>
> <Viewbox
> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
> xmlns:Custom="clr-namespace:CustomNamespace"
> Stretch="Fill">
> <ItemsControl>
> <ItemsControl.ItemsPanel>
> <ItemsPanelTemplate>
> <Custom:CustomCanvas/>
> </ItemsPanelTemplate>
> </ItemsControl.ItemsPanel>
> </ItemsControl>
> .......
> </Viewbox>
>
> How can I access that ItemsControl object from my assembly. Thing is
> that I define some resources on ItemsControl and I want to use them in
> my Canvas Assebmly C# code. On runtime the CustomCanvas has Parent
> property set to null, so I'm really interested almost all the day how
> to get that damn parent.
>
> I will really appreciate your help with that.
> Anton
>



My System SpecsSystem Spec
Old 01-25-2007   #3 (permalink)
Florian Kruesch


 
 

Re: How to access Parent Element of the ItemsControl's Panel?

TemplatedParent lets you access the itemspresenter, which should give
you access to the itemscontrol via parent or templatedparent.
if you don't expect things to change much, use visualtreehelper.

Florian

Bill Henning wrote:
> Hi Anton,
>
> Parent refers to the logical tree. Perhaps try checking the visual tree
> using the VisualTreeHelper.GetParent method.
>

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
control panel access General Discussion
Solved Can't Access NVIDIA Control Panel Graphic cards
cannot access control panel General Discussion
Control Panel access Vista General
Control Panel Access Vista performance & maintenance


Vista Forums 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 Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46