When I set a ToolTip Binding In a WPF Custom Control, this way it works perfect:
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
...
SetBinding(ToolTipProperty, new Binding
{
Source = this,
Path = new PropertyPath("Property1"),
StringFormat = "ValueOfProp1: {0}"
});
}
But when I try to use MultiBinding to have several properties in the ToolTip, it doesn't work:
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
...
MultiBinding multiBinding = new MultiBinding();
multiBinding.StringFormat = "ValueOfProp1: {0}\nValueOfProp2: {1}\nValueOfProp3: {2}\n";
multiBinding.Bindings.Add(new Binding
{
Source = this,
Path = new PropertyPath("Property1")
});
multiBinding.Bindings.Add(new Binding
{
Source = this,
Path = new PropertyPath("Property2")
});
multiBinding.Bindings.Add(new Binding
{
Source = this,
Path = new PropertyPath("Property3")
});
this.SetBinding(ToolTipProperty, multiBinding);
}
In this case I have no ToolTip shown at all.
Where am I wrong?