Questions tagged [logical-tree]
20 questions
24
votes
4 answers
Disconnecting an element from any/unspecified parent container in WPF
I have a control that is a child of another control (as all non-root controls/elemts are in WPF).
If I want to move the control to another container I have to disconnect it from its current container first (otherwise an exception is thrown).
If I…

Björn
- 3,098
- 2
- 26
- 40
20
votes
2 answers
Binding ElementName. Does it use Visual Tree or Logical Tree
Having {Binding ElementName=foo}, will it lookup visual or logical tree?
Of logical and visual trees in WPF | Data See, Data Do
When does the logical tree matter?
When looking up a name, such as in
{Binding ElementName=Foo}, the search
walks up…

alex2k8
- 42,496
- 57
- 170
- 221
5
votes
0 answers
Concepts of Visual tree and Logical tree
I understand the concepts of Visual and logical tree but still I am not able to understand the real use and need of these. Although its not necessary to know everything about these trees but I believe it will benefit in some advanced scenarios.
I…

akjoshi
- 15,374
- 13
- 103
- 121
5
votes
4 answers
Algorithm for evaluating nested logical expression
I have a logical expression that I would like to evaluate.
The expression can be nested and consists of T (True) or F (False) and parenthesis.
The parenthesis "(" means "logical OR".
Two terms TF beside each others (or any other two combinations…

Traveling Salesman
- 2,209
- 11
- 46
- 83
4
votes
2 answers
Why does binding fail when binding a child element to another element when the parent succeeds?
Say I have two classes that can reference a third UI object (in this example a button).
In addition, the parent class can contain an element of the child class.
If they both are bound to the same control, the same way, the child will fail but the…

Jeremy White
- 901
- 2
- 9
- 21
4
votes
1 answer
Find logical child including hidden and collapsed nodes
I have tried finding an answer to this problem and in every post I find there is an answer to finding children recursively but none of them work with hidden or collapsed children
Also in every post someone has asked if this is possible but no one…

Kezza
- 736
- 9
- 25
3
votes
2 answers
WPF: Why is DataContextChanged not raised on a logical child?
I have a problem with DataContextChanged not being raised on a logical child of my custom Panel control. I've narrowed it down to this:
Starting from a wizard-generated WPF application I add:
private void Window_Loaded( object sender,…

Danko Durbić
- 7,077
- 5
- 34
- 39
2
votes
1 answer
How to debug a "Specified element is already the logical child of another element" in the release
I know I'm supposed to post a very specific question with a code sample, but I wouldn't know where to start with this:
While running my app in Visual Studio it is ok, both in Debug and in Release modes. But when I create an InstallShield installer,…

Hannish
- 1,482
- 1
- 21
- 33
1
vote
0 answers
WPF: Is every visual tree also a combination of visual and logical trees?
As far as I understand, a logical tree is always a subset of the visual tree of some element in WPF. Technically, the distinction between the two is whether or not they are assigned to the Template property of an element (= visual) or to the…

domin
- 1,192
- 1
- 7
- 28
1
vote
1 answer
Binding a DependencyObject outside the Logical Tree to the property an element in the Logical Tree
Edited
Problem Summary:
I have a custom control that has an ObservableCollection of DependencyObjects. Because the DependencyObjects are not children of the control, they are not in the Logical Tree. However, I need them to bind to properties of…

Ketfera
- 33
- 3
1
vote
1 answer
WPF - PreviewMouseLeftButtonDown finding the visual owning control of e.OriginalSource
Very simple question.
I have attached to the PreviewMouseLeftButtonDown event. I know this event Tunnels so the first item in the visual tree is going to get flagged as the e.OriginalSource.
Example:
I have a Grid named "MainGrid". This Grid…

tronious
- 1,547
- 2
- 28
- 45
0
votes
1 answer
How to get the parent of a UserControl hosted in a ContentControl?
In a WPF application, I've a ContentControl. In this ContentControl, I've a View.
Starting from a specific UserControl, I'm trying to go up in its logical tree, and "Activate" every component on the way. By example, if one parent is a Tab, I select…

J4N
- 19,480
- 39
- 187
- 340
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
Parsing visual elements inside Content Control : View Model issue
I want a clean solution to a little problem i have : i have a standard main page view and its view model, inside the view i display a user control (Dossier) with its view model (DossierViewModel).
To dynamically instantiate my view from the main…

Sicha
- 139
- 1
- 12
0
votes
2 answers
Use function of logical parent
maybe my question is totally stupit but I'm trying to do my best.
All I want to do is to use a function/property of a parent element.
I have prepared a simple example with no sense:
class A
{
public List myBs = new List();
public int…

MisterPresident
- 563
- 7
- 20