[C#/WPF] Binding 태그 확장 : RelativeSource 속성에서 RelativeSource 태그 확장의 AncestorType 속성을 사용해 부모 엘리먼트 속성 바인딩하기
C#/WPF 2015. 9. 18. 07:32728x90
반응형
728x170
<UserControl
x:Class="TestProject.MultiComboBox"
...
d:DesignHeight="30">
<Grid Name="grid" Margin="0">
<Button Name="button"
...
Padding="0">
...
</Button>
<Popup Name="popup"
MinWidth="{Binding ElementName=button, Path=ActualWidth}"
MinHeight="100"
Width="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=PopupWidth}"
Height="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=PopupHeight}"
PlacementTarget="{Binding ElementName=button}"
Placement="Bottom"
IsOpen="False"
StaysOpen="False">
...
</Popup>
</Grid>
</UserControl>
※ PopupWidth 및 PopupHeight 속성은 UserControl을 상속한 MultiComboBox 클래스에서 정의한 의존 속성이다.
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] LineGeometry 엘리먼트 : StartPoint/EndPoint 속성을 사용해 선 그리기 (0) | 2015.09.19 |
---|---|
[C#/WPF] Button 클래스 : 코드로 클릭 이벤트 발생시키기 (0) | 2015.09.18 |
[C#/WPF] Binding 태그 확장 : Source 속성에서 x:Static 태그 확장을 사용해 정적 객체 속성 바인딩하기 (0) | 2015.09.18 |
[C#/WPF] Trigger 엘리먼트 : Property 속성을 사용해 컨트롤 템플리트 트리거에서 해당 엘리먼트에서 정의한 속성 설정하기 (0) | 2015.09.18 |
[C#/WPF] DataTemplate 엘리먼트 : Triggers 속성 사용하기 (0) | 2015.09.18 |
[C#/WPF] DataTemplate 엘리먼트 : 대상 엘리먼트 속성 바인딩 하기 (0) | 2015.09.18 |
[C#/WPF] ToolBar 클래스 : 오버플로우 패널 숨기기 (0) | 2015.09.17 |
[C#/WPF] 컨트롤 템플리트에서 컨트롤 객체 구하기 (0) | 2015.09.14 |
[C#/WPF] Point 구조체 : 회전하기 (0) | 2015.09.14 |
[C#/WPF] Viewbox 엘리먼트 사용하기 (0) | 2015.09.10 |
댓글을 달아 주세요