Questions tagged [visual-tree]

106 questions
0
votes
1 answer

How do I get the default tab order in WPF (i.e. Visual Tree order)?

I'm adding a validation module to my application which will guide the user to the inputs that need attention. I would like to go through these controls in the same order that they were added to the Visual Tree. The Tab Index for each control is…
NielW
  • 3,626
  • 1
  • 30
  • 38
0
votes
1 answer

How do I add an element to the visual tree in Silverlight

Here is my specific problem: Xaml:
ryhzhang
  • 92
  • 1
  • 4
0
votes
2 answers

Create snapshot of a non-shown UserControl

I want to take a snapshot of my UserControl, which has not been shown yet. That's my code: public Screenshot(MyViewModel viewModel) { if (viewModel == null) return; // Create a TabControl, where View is hosted…
Benny
  • 25
  • 8
0
votes
2 answers

How to specify a DataContext whet adding the ContextMenu to the DataGridTemplateColumn?

I am cooking up DataGridTemplateColumns programmatically via DataTemplate dtStringTemplate = (DataTemplate)XamlReader.Load(sr, pc); dataGridTemplateColumn.CellTemplate = dtStringTemplate; I tried adding the ContextMenu to the DataGrid, but any…
Number8
  • 12,322
  • 10
  • 44
  • 69
0
votes
1 answer

Check if specified element is already the logical child of another element

I a beginner in C# and WPF. I'm programming plugin for a node based software called vvvv. I have implemented sliders, buttons and other simple ui elements. The following code shows how a sliders node look in c# : using System.Windows; using…
lecloneur
  • 424
  • 5
  • 20
0
votes
0 answers

How to set TabIndex of all the visible and focusable controls of the current window in WPF

Upon click of a button I am trying to traverse the visual tree and list all the visible and focusable component controls (e.g. buttons, images, textBoxes etc) of the current window and set their TabIndex to some value. However several of the…
Waterfr Villa
  • 1,217
  • 1
  • 10
  • 33
0
votes
1 answer

How do I find the image in a WPF Datagrid ColumnHeader so I can change the image?

I'm attempting to implement Excel-like column filtering and sorting. To do this, I used a DataTemplate to define the Column Header.
tolsen64
  • 881
  • 1
  • 9
  • 22
0
votes
1 answer

Find visual children recursively is not adding the root object in WPF?

I have the following implementation to get all the children in a VisualTree of a type T: IEnumerable FindVisualChildrenRecurse(DependencyObject root) where T : DependencyObject { if (root != null) { for (int…
Daniel Peñalba
  • 30,507
  • 32
  • 137
  • 219
0
votes
1 answer

Pop out view model into separate window (like a Chrome tab)

My application consists of a single window with various view models displaying graphs/charts/tables, etc. My users have decided they want the ability to pop out a chart and have it display in its own window, similar to how you can drag a tab out of…
NielW
  • 3,626
  • 1
  • 30
  • 38
0
votes
1 answer

How can I initialize TabItem content on TabItem load?

Is there a way to initialize Tab content on Tab load? I'm having an issue, when Tab is created it doesnt initialize it components immediately. Only when I click on Tab the content will show up.
Mrg Gek
  • 906
  • 2
  • 10
  • 31
0
votes
1 answer

Resetting the visual offset of an usercontrol WPF

There is treeview whose nodes are bound to usercontrols which are loaded using view injection on selection. At this point the visual offset for the control is set to (0,0). Is there a way I can alter this visual offset later. O How can I unload this…
Synster
  • 329
  • 6
  • 16
0
votes
1 answer

How to access a ListBoxItem from a button created by the DataTemplate of this same ListBoxItem

Problem Given this piece of code, I want to have access to the properties (more specifically, its index) of the ListBoxItem that contains a Button when I press it. I've figured that I need to obtain the Button's parent (which is an StackPanel) and…
Edd
  • 1,948
  • 4
  • 21
  • 29
0
votes
0 answers

VisualTree property set more than once error

Why does this code throw the "VisualTree set more than once" error on the textblock with the run for Employee number, name, and truck number? It is in within the data template. I tried wrapping that portion in a grid and it didn't work.
JTester
  • 463
  • 1
  • 8
  • 19
0
votes
1 answer

Where is ComboBox popup in visual tree?

Where in the visual tree can I find the ComboBox popup (the list with the ComboBoxItems)? I have programmatically opened a ComboBox and when watching it in the WPF Tree Visualizer in the debugger I see the following: : ComboBox templateRoot :…
Torbjörn Kalin
  • 1,976
  • 1
  • 22
  • 31
0
votes
0 answers

WPF Detect UserControl beeing covered / not displayed

If I have a Usercontrol, which is overlayed by another control (a Grid for example), is there an event or trigger to find out that the UserControl is currently covered by something? Maybe an event from VisualTree or some kind of listener?
Johannes Wanzek
  • 2,825
  • 2
  • 29
  • 47