2009-12-01 75 views
0

我有一個ContentControlButton從左到右,分區和ComboBox。我希望ComboBox下拉列表與控件的左側相對,而不是ComboBox的左側。我在代碼中收到了一個方法,但是我想知道它是否可以在xaml中完成。WPF組合框DropDown使用PlacementTarget

這使我有控制的名字:

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

但我想控制一個參考:

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

有什麼想法?

+0

可能有人與代表創造一個PlacementTarget標籤?謝謝 – Brad 2009-12-01 19:25:06

回答

0

事實證明,如果你指定AncestorLevelAncestorType一個的RelativeSource正常工作:

Placement="Bottom" 

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