1

so, i am trying to get the following to work:

<Style x:Key="ToolTipVisibility" TargetType="{x:Type StackPanel}">
   <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}},Path=EnabledToolTips}" />

calling this from inside of a xaml control, and the property is in my main window:

public Visibility EnabledToolTips {
    get { return Visibility.Collapsed; } //  testing
}

nothing fails, it just shows default tooltip behavior.

are there ways to profile wpf binding process to see why exactly this fails? Looking for ways to troubleshoot cases such as this one..

Sonic Soul
  • 23,855
  • 37
  • 130
  • 196
  • In this particular case you can put a breakpoint right on the "EnabledToolTips" property to see if it debugger stops on it. – VoodooChild Jun 25 '10 at 20:03
  • i have, and no, it isn't hit. the binding fails to find what i am binding it to.. i need to learn more about binding :) – Sonic Soul Jun 25 '10 at 20:58

3 Answers3

2

You need to read Bea Stollnitz Blog Basically, it boils down to this:

add this xmlns to your .xaml file....

xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"

now, add this to the binding you want to debug. you will get scads of information

diagnostics:PresentationTraceSources.TraceLevel=High
Muad'Dib
  • 28,542
  • 5
  • 55
  • 68
  • that is helpful thanks for the article. in my case, including these attributes did not give more debug info. just the same line that "cannot find source for binding..." etc .. – Sonic Soul Jun 25 '10 at 20:23
1

see How to detect broken WPF Data binding? and specifically the answer given here http://www.beacosta.com/blog/?p=52

Community
  • 1
  • 1
kenwarner
  • 28,650
  • 28
  • 130
  • 173
0

When debugging, the output window should give you some information.

James O'Sullivan
  • 498
  • 1
  • 4
  • 12