views:

256

answers:

1

I have a ContentControl comprised from left to right of a Button, partition and a ComboBox. I want the ComboBox dropdown to line up with the left side of the control as opposed to the left side of the combobox. I received a method in code but I was wondering whether if it could be accomplished in xaml.

This gives me the name of the control:

ToolTip="{Binding Path=Name, RelativeSource={RelativeSource FindAncestor, AncestorLevel=2, AncestorType={x:Type Control}}}"

But I would like a reference to the control:

Placement="Bottom" PlacementTarget="{Binding ElementName=[Fancy-Smancy xaml goes here!]}"

Any thoughts?

TIA

A: 

Turns out that a RelativeSource works if you specify the AncestorLevel and the AncestorType:

Placement="Bottom"

PlacementTarget="{Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=2, AncestorType={x:Type Grid}}}"

Brad