Questions tagged [visualtreehelper]

92 questions
0
votes
0 answers

How to find a child (Gridviewcolumn) of Listview / MVVM

inside a behavior (connected to windows.interactivity) im trying to find a child of a Listview - specifically Gridviewcolumn- to be able to resize its width, the code is built using MVVM without code-behind. the problem is simply that using the…
user188
  • 59
  • 3
  • 9
0
votes
1 answer

Iterate over VisualTreeHelper.GetChild() and call UpdateSource on Controls that contain databinding

I have a ContentControl in WPF which contains some input Controls, like TextBoxes and ComboBoxes. Each of these Controls is databound to a given property in the ViewModel, with UpdateSourceTrigger=Explicit. When I click some "Submit" button, I want…
heltonbiker
  • 26,657
  • 28
  • 137
  • 252
0
votes
1 answer

WPF remove/close/dispose CustomControl from the CustomControl

I have a CustomControl with some elements and a Button. I want to remove/close/dispose the CustomControl when the Button clicked. I tried to get the parent of the element when the Button is clicked but all I get is crush. My CustomControl is TabItem…
Ron
  • 3,975
  • 17
  • 80
  • 130
0
votes
1 answer

Get specific UIElemet from grid in Windows Phone with visual tree helper

I have grid view in windows phone xaml page and this grid contains many UI element like buttons, checkboxes and textboxes. I want to search some specific UIElement by name from that grid and want to get value of that UIElement and set some new…
Arslan Pervaiz
  • 1,575
  • 4
  • 29
  • 62
0
votes
1 answer

How can you "plug into" the WPF rendercycle to get accurate results from VisualTreeHelper?

I am currently writing a WPF User control (PARENT) which can contain multiple child (CHILD) user controls. I am connecting the (CHILD) controls with polylines. To do this I need the locations of the CHILD user controls. However, the locations i get…
Sjors Miltenburg
  • 2,540
  • 4
  • 33
  • 60
0
votes
0 answers

Visual and Logical tree traversal does not retrieve several levels

I'm exploring logical and visual trees from the same application without success going deeper through the levels. My code uses a generic explorer: private static void ProcessGenericTree(object current, List leaves, Type treeType) …
Francesco De Lisi
  • 1,493
  • 8
  • 20
0
votes
1 answer

Trying to create a recursive method to list Logical dependencies in hierarchical order

I used a VisualTree helper to get all the Visuals in my window but sometimes some certain controls are not listed in the returning list. That's because they are still not rendered, as far as I know, VisualTree enumeration will help only if the…
David von Tamar
  • 797
  • 3
  • 12
  • 29
0
votes
0 answers

Why is the Visual Tree empty on an ItemsControl Container?

I have a requirement get access to particular visual elements in any given view. This is easy on statically declared items in xaml since they are available anytime. However, datatemplated ItemsControls generate their visual tree at runtime. For…
trickdev
  • 627
  • 1
  • 7
  • 14
0
votes
3 answers

LogicalTree Control directly under mouse no VisualTree

This is a WPF application. I'm trying to get the control directly under the mouse and it's proving to be a surprising pain. Mouse.DirectlyOver, InputHitTest and VisualTreeHelper.HitTest all reference the VISUAL tree. I'm trying to grab the control…
tronious
  • 1,547
  • 2
  • 28
  • 45
0
votes
1 answer

Silverlight Custom effect, get parent

I am trying to create a custom effect by inheriting from Effect. The problem is in my effect code.…
Francisco Aguilera
  • 3,099
  • 6
  • 31
  • 57
0
votes
1 answer

C# WPF VisualTree for pageframe

Working with WPF, C# and a tabbed page window. I'm trying to cycle through all controls on the form, but its failing to do so with the VisualTreeHelper. If I have a window with a TabControl on it, and three TabItems on that tab control, visually,…
DRapp
  • 47,638
  • 12
  • 72
  • 142
0
votes
2 answers

Force visual tree creation with Prism

I have a TabControl containing Prism regions. I want to trigger some kind of notification (e.g. flashing the tab header) for certain events, and I want to trigger this notification from the components in the Prism regions. Once the tab containing…
Zak
  • 724
  • 4
  • 18
0
votes
1 answer

Get ContentPresenter/ItemsPresenter from control

I need a way to access the ContentPresenter/ItemsPresenter from a control if it does exist. I can't figure out how to easily do this with VisualTreeHelper. Will I need to recursively search all children?
Lee Louviere
  • 5,162
  • 30
  • 54
0
votes
3 answers

Searching the element using predicate condition

How could I find a framework element in VisualTree by a predicate? Something like that : public static FrameworkElement FindChild(FrameworkElement root, Predicate<> predicate) { ... } I'm goint to use it something like that: Button btn =…
Alexander Knoth
  • 137
  • 1
  • 13
-1
votes
1 answer

ArgumentOutOfRangeException when calling VisualTreeHelper.GetChild()

From time to time I'm running into an ArgumentOutOfRangeException when calling VisualTreeHelper.GetChild(). The exception mentions not to call that method when VisualChildrenCount equals 0 - which is what the if right before the call supposedly…