Questions tagged [visualtreehelper]

92 questions
1
vote
3 answers

VisualTreeHelper not finding children of DependencyObject, How can I reliably find objects?

I have a UserControl called ZoneContainer. This has a property that which contains a ListBox containing a number of ListItems. Each ListItem contains a DockPanel. I'm trying to use a the following code to find the children that exist inside…
DaveDev
  • 41,155
  • 72
  • 223
  • 385
1
vote
1 answer

VisualCollection to Visual HitTest invisible?

I am working with VisualCollection, Visual and HitTest in WPF and encountered a problem. I tried to make a custom visual drawing as follows: public class MyDrawing : Visual { VisualCollection vc; public MyDrawing() { vc = new…
user1184598
  • 449
  • 1
  • 5
  • 11
1
vote
1 answer

Getting child properties in WPF Using VisualTreeHelper not returning values

Once I use visualTreeHelper.getchild to find a child object, how would I get the name of that object, or even other properties of the object like width or height? i.e. This doesnt work: For i As Integer = 0 To VisualTreeHelper.GetChildrenCount(Can1)…
SDanks
  • 609
  • 1
  • 7
  • 18
1
vote
0 answers

How can I perform a Hit Test on one specifc 3d object in WPF?

I have a SphereMesh (inherits from MeshGeneratorBase as part of the Petzold.Media3D.dll) in my WPF 3D Scene. I also have thousands of ScreenSpaceLines3D objects on that sphere. I want to ignore everything in my scene except the SphereMesh and find…
Ryan R
  • 167
  • 7
0
votes
1 answer

"VisualTreeHelper.GetDescendantBounds()" returns Infinity

Why does the VisualTreeHelper.GetDescendantBounds(SomeVisualItem) method return (-Infinity,-Infinity,Infinity,Infinity)? The SomeVisualItem's Canvas.Left, Canvas.Top, Width, ... are explicitly assigned.
Ali Adlavaran
  • 3,697
  • 2
  • 23
  • 47
0
votes
2 answers

If the DataTemplate is nested in another Datatemplate it's hard the binding with a father-template property

Have youI know that the problem has been many times discussed in the web. But mine is a particular case and I still haven't found the right solution. Scenario: Silverlight 4 - A TreeView with data showed by two HierarchicalDataTemplate, one to show…
lamarmora
  • 1,116
  • 4
  • 16
  • 32
0
votes
1 answer

What causes VisualTreeHelper::HitTest to return incomplete results, and sometimes no results?

I had a scenario where I was connecting to a Windows WPF app, through a network connection to drive UI for the purposes of test automation. Sometimes my requests to the UI using VisualTreeHelper returned no results regardless of the apparent state…
Bulmaro
  • 21
  • 4
0
votes
1 answer

Silverlight 4 - Visual Tree helper returns 0 child Elements?

I have the following code that is supposed to find an element inside of something. The problem is that I have a DataGrid, whose first column has a CheckBox in it's header. The checkbox itself is defined in a Style, which exists in the…
bleepzter
  • 9,607
  • 11
  • 41
  • 64
0
votes
1 answer

WPF 3.5 nested datagrid row details not showing in Visual Tree

So I build a nice nested datagrid that look something like this:
asuciu
  • 1,234
  • 2
  • 21
  • 35
0
votes
1 answer

UWP VisualTreeHelper Wrong Parameter Reference

I want to modify the content in a TabItem of a TabView. And that TabItem uses DataTemplate. When I am trying to access the children of that item like the following: var container = tabview.ContainerFromIndex(tabview.SelectedIndex); …
Seaky Lone
  • 992
  • 1
  • 10
  • 29
0
votes
1 answer

WPF ViewBox blocks VisualTreeHelper search

I have tried this Navigation Service approach (View First) for MVVM-Light WPF https://stackoverflow.com/a/28968560/5272185 I realized that the VisualTreeHelper search for the Frame element does not find the Frame if the Frame is located inside a…
Johan
  • 502
  • 4
  • 18
0
votes
1 answer

How to make method, that finds sepcific type of child user control, more generic?

I have some few cases in my WPF application that requires me to find a specific type of user control in a given user control. For example I'm having the following method that already works nicely: public static System.Windows.Controls.CheckBox…
Ralf
  • 293
  • 5
  • 15
0
votes
2 answers

VisualTreeHelper doesn't find control in DataGridTemplateColumn.CellTemplate

I use this method to list all the buttons of a usercontrol: private static IEnumerable FindVisualChildren(DependencyObject depObj) where T : DependencyObject { if (depObj != null) { int NbChild =…
Marc
  • 107
  • 8
0
votes
1 answer

How to convert a DependencyObject into an AutomationElement?

I am traversing a WPF application through its VisualTree, using the VisualTreeHelper, which is returning DependencyObjects. for(int i = 0; i < VisualTreeHelper.GetChildrenCount(rootObject); i++) { var child =…
Olian04
  • 6,480
  • 2
  • 27
  • 54
0
votes
2 answers

VisualTreeHelper.GetDescendantBounds returns 'Empty' (Infinity)

In my WPF app I dynamically load a XAML drawing from XML at runtime. This drawing is a complex series of nested canvas and geometry 'Path's (for example):
JohnKoz
  • 908
  • 11
  • 21