Questions tagged [visual-tree]

106 questions
1
vote
0 answers

ContentControl get all Elements inside DataTemplate without knowing the Name?

i want to get a list with all elements of my current usercontrol. Not only the one in the LogicalTree, ALL elements inside the defined and used datatemplates in the usercontrol. When iam iterating threw the VisualTree it dont have VisualTree items…
Simon
  • 21
  • 1
  • 3
1
vote
1 answer

WPF Printing large custom control

I'm sorry if this is a duplicate, but I couldn't find anything relating to it. I'm trying to create an XpsDocument from a custom control that I have. The custom control already defines properties for a header and a footer, along with the body. The…
1
vote
0 answers

ZIndex on different visual trees

I have to implement a design for a TabControl. This design uses a DropShadowEffect surrounding the border of the content part of that control. This shadow should overlap those elements of the TabControl that are not selected, but it should not…
Chris
  • 527
  • 3
  • 15
0
votes
4 answers

Visual Tree - Find a label (anywhere on the window) where content equals

I have many labels as children of many different stack panels which are all children of a list box, and I need to reference one of these labels were the Content.toString() == "criteria". In other words, traversing the visual tree in WPF would be a…
user1017882
0
votes
2 answers

Get Window's visual content

I currently have this line of code which I want to work in all cases: var visualWindowContent = (UIElement)window.Content; This approach will work when Window.Content is a UIElement. But what about when it's a non-visual object which then has a…
HappyNomad
  • 4,458
  • 4
  • 36
  • 55
0
votes
0 answers

How can I detect when the Flyout for a given DatePicker opens in WinUI 3?

I have a DatePicker on a Page and would like to know whenever the DatePickerFlyout associated with the DatePicker is opened. This would be straightforward if I had a reference to the relevant DatePickerFlyout (DatePickerFlyout has Opened and Opening…
aturnbul
  • 347
  • 2
  • 12
0
votes
2 answers

WPF - fast way of getting the visual tree

I am adding some controls dynamically within a grid. I will not know how many and I will not know the exact hierarchy. What I want to do is to access some controls that have a specific type (Button for example) and instantiate some properties. What…
Cornel
0
votes
1 answer

How do I use parent's ItemsHost for HierarchicalDataTemplate in XAML?

I have a tree- or menu-like data structure which I want to display in a Panel (specifically a self-made PolarPanel), but all items must be VisualChildren of the same panel. If I define a HierarchicalDataTemplate, I need to create an ItemsControls…
Martin Hennings
  • 16,418
  • 9
  • 48
  • 68
0
votes
1 answer

Get Control (Button) from parent in usercontrol

I have a window with different items and different views for each type. I would like to access the button in the window (parent) from my code behind from the content control. OutputConfigView:
Max
  • 68
  • 8
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

How may my Style Setter get at the DataContext of the of the element whose style is being set?

This seems like it should be simple as pie but I can't figure it out. I am trying to change a working Style Setter for a "Fill" property on an element to actually declare a SolidColorBrush object in XAML in the Setter.Value. Unfortunately, in my…
Joe
  • 5,394
  • 3
  • 23
  • 54
0
votes
1 answer

How to get the underlying (TextBox) Control of a DataGridTemplateColumn

I use this code to add a TextBox to a DataGrid cell: (no, I can't use XAML here) Binding binding = new Binding("Fld_Company"); binding.Mode = BindingMode.OneWay; FrameworkElementFactory frameworkElementFactory = new…
marsh-wiggle
  • 2,508
  • 3
  • 35
  • 52
0
votes
0 answers

Why can't I get the RootVisual Of External App?

I am working on an automated testing framework in WPF. I am finding that while it is possible to automate most things using the basic WPF automation framework, it is very difficult to get down to the fine grained details of what is happening at the…
Christian Findlay
  • 6,770
  • 5
  • 51
  • 103
0
votes
1 answer

Datagridcolumn: Binding Visibility and Width via BindingProxy show different behavior

As the columns of a data grid aren't in the visual tree of datagrid I'm m using this approach of Binding Proxy to bind Visibility of a…
pedrito
  • 87
  • 9
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