Note that there are some explanatory texts on larger screens.

plurals
  1. PODebug ElementName binding
    primarykey
    data
    text
    <p>Is there a way to futher debug bindings other than using PresentationTraceSources.TraceLevel?</p> <p>I have a rather complex issue, where an ElementName-binding fails (the element is not found) when it is used on a CommandParameter on a Button that is a child on UserControl2 which is placed inside UserControl1. The output of PresentationTraceSources.TraceLevel=High is (PåstandsListe is UserControl2):</p> <pre><code>System.Windows.Data Warning: 52 : Created BindingExpression (hash=8957325) for Binding (hash=61342683) System.Windows.Data Warning: 54 : Path: 'SelectedItem' System.Windows.Data Warning: 56 : BindingExpression (hash=8957325): Default mode resolved to OneWay System.Windows.Data Warning: 57 : BindingExpression (hash=8957325): Default update trigger resolved to PropertyChanged System.Windows.Data Warning: 58 : BindingExpression (hash=8957325): Attach to System.Windows.Controls.Button.CommandParameter (hash=426476) System.Windows.Data Warning: 63 : BindingExpression (hash=8957325): Resolving source System.Windows.Data Warning: 66 : BindingExpression (hash=8957325): Found data context element: &lt;null&gt; (OK) System.Windows.Data Warning: 70 : Lookup name PåstandsListe: queried Button (hash=426476) System.Windows.Data Warning: 61 : BindingExpression (hash=8957325): Resolve source deferred 'Domstolene.JFS.GUI.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\System.Transactions\2.0.0.0__b77a5c561934e089\System.Transactions.dll', Symbols loaded. System.Windows.Data Warning: 63 : BindingExpression (hash=8957325): Resolving source System.Windows.Data Warning: 66 : BindingExpression (hash=8957325): Found data context element: &lt;null&gt; (OK) System.Windows.Data Warning: 70 : Lookup name PåstandsListe: queried Button (hash=426476) System.Windows.Data Warning: 63 : BindingExpression (hash=8957325): Resolving source System.Windows.Data Warning: 66 : BindingExpression (hash=8957325): Found data context element: &lt;null&gt; (OK) System.Windows.Data Warning: 70 : Lookup name PåstandsListe: queried Button (hash=426476) System.Windows.Data Warning: 63 : BindingExpression (hash=8957325): Resolving source System.Windows.Data Warning: 66 : BindingExpression (hash=8957325): Found data context element: &lt;null&gt; (OK) System.Windows.Data Warning: 70 : Lookup name PåstandsListe: queried Button (hash=426476) System.Windows.Data Warning: 63 : BindingExpression (hash=8957325): Resolving source System.Windows.Data Warning: 66 : BindingExpression (hash=8957325): Found data context element: &lt;null&gt; (OK) System.Windows.Data Warning: 70 : Lookup name PåstandsListe: queried Button (hash=426476) System.Windows.Data Warning: 63 : BindingExpression (hash=8957325): Resolving source System.Windows.Data Warning: 66 : BindingExpression (hash=8957325): Found data context element: &lt;null&gt; (OK) System.Windows.Data Warning: 70 : Lookup name PåstandsListe: queried Button (hash=426476) System.Windows.Data Warning: 63 : BindingExpression (hash=8957325): Resolving source System.Windows.Data Warning: 66 : BindingExpression (hash=8957325): Found data context element: &lt;null&gt; (OK) System.Windows.Data Warning: 70 : Lookup name PåstandsListe: queried Button (hash=426476) System.Windows.Data Warning: 63 : BindingExpression (hash=8957325): Resolving source (last chance) System.Windows.Data Warning: 66 : BindingExpression (hash=8957325): Found data context element: &lt;null&gt; (OK) System.Windows.Data Warning: 70 : Lookup name PåstandsListe: queried Button (hash=426476) System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=PåstandsListe'. BindingExpression:Path=SelectedItem; DataItem=null; target element is 'Button' (Name=''); target property is 'CommandParameter' (type 'Object') </code></pre> <p>Changes without any effect:</p> <ul> <li>Binding to the parent element of UserControl2 instead of UserControl2.</li> </ul> <p>Non-failing scenarios (here the ElementName-binding works):</p> <ul> <li>UserControl2 is not placed within UserControl1.</li> <li>Button is added as a child to UserControl1 instead of UserControl2.</li> </ul> <p>Futhermore when I attach Snoop to the application the ElementName-binding starts working when I select the Button within Snoop (but no information is displayed in the VS Output window). Does Snoop somehow refresh the binding?</p> <h2>Update</h2> <p>It seems the problem only occurs when the Button is not initially visible, e.g. placed in an Expander og TabItem which are not visible.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload