반응형
ElementName에 추적하고 싶은 컨트롤 이름 물리고 땡겨오면 된다.
<UserControl.Resources>
<converter:MultiInputConverter x:Key="multiParam"/>
</UserControl.Resources>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SizeChanged">
<i:InvokeCommandAction Command="{Binding VIewSizeChangeCommand}">
<i:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource multiParam}">
<Binding Path="ActualWidth" ElementName="hvView"/>
<Binding Path="ActualHeight" ElementName="hvView"/>
</MultiBinding>
</i:InvokeCommandAction.CommandParameter>
</i:InvokeCommandAction>
</i:EventTrigger>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding VIewSizeChangeCommand}">
<i:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource multiParam}">
<Binding Path="ActualWidth" ElementName="hvView"/>
<Binding Path="ActualHeight" ElementName="hvView"/>
</MultiBinding>
</i:InvokeCommandAction.CommandParameter>
</i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
public class MultiInputConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return values.Clone();
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return (object[])value;
}
}
반응형
'프로그래밍 > WPF' 카테고리의 다른 글
[WPF] canvas 내용을 비트맵 이미지로 저장 (0) | 2021.09.09 |
---|---|
[WPF] DataGrid Style 설정 (0) | 2021.09.01 |
[WPF] UserControl DependencyProperty 설정과 Binding 방법 (0) | 2021.07.21 |
[WPF] ItemControl에서 Item Index binding (0) | 2021.05.11 |
[WPF] Value Converter (0) | 2021.05.10 |