![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| control panel access | General Discussion | |||
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 | |||