728x90
반응형
728x170
▶ MainWindow.xaml
<Window x:Class="TestProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
Width="800"
Height="600"
Title="EventTrigger 엘리먼트 : CallMethodAction 객체를 사용해 객체 메소드 실행하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Grid Margin="10">
<Border
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderBrush="Black"
BorderThickness="1">
<ScrollViewer Name="scrollViewer"
Width="200"
Height="200">
<StackPanel>
<StackPanel.Resources>
<Style TargetType="TextBlock">
<Setter Property="Padding" Value="5" />
</Style>
</StackPanel.Resources>
<TextBlock Text="A" />
<TextBlock Text="B" />
<TextBlock Text="C" />
<TextBlock Text="D" />
<TextBlock Text="E" />
<TextBlock Text="F" />
<TextBlock Text="G" />
<TextBlock Text="H" />
<TextBlock Text="I" />
<TextBlock Text="J" />
<TextBlock Text="K" />
<TextBlock Text="L" />
<TextBlock Text="M" />
<TextBlock Text="N" />
<TextBlock Text="O" />
<TextBlock Text="P" />
<TextBlock Text="Q" />
<TextBlock Text="R" />
<TextBlock Text="S" />
<TextBlock Text="T" />
<TextBlock Text="U" />
<TextBlock Text="V" />
<TextBlock Text="W" />
<TextBlock Text="X" />
<TextBlock Text="Y" />
<TextBlock Text="Z" />
</StackPanel>
</ScrollViewer>
</Border>
<Button
Content="↑"
FontWeight="Bold"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="20">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<ei:CallMethodAction
TargetObject="{Binding ElementName=scrollViewer}"
MethodName="ScrollToHome" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</Grid>
</Window>
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] 누겟 설치 : Expression.Blend.Sdk (0) | 2020.09.18 |
---|---|
[C#/WPF] 누겟 설치 : WindowsAPICodePack-Shell (0) | 2020.09.18 |
[C#/WPF] 누겟 설치 : Microsoft.Xaml.Behaviors.Wpf (0) | 2020.09.18 |
[C#/WPF] MultiBinding 엘리먼트 : StringFormat 속성을 사용해 문자열 포맷 설정하기 (0) | 2020.09.18 |
[C#/WPF] Binding 태그 확장 : StringFormat 속성을 사용해 문자열 포맷 설정하기 (0) | 2020.09.18 |
[C#/WPF] DataGridColumnHeader 엘리먼트 : ContextMenu 속성을 사용해 컬럼 헤더 컨텍스트 메뉴 실행하기 (0) | 2020.09.18 |
[C#/WPF] DataGrid 엘리먼트 : FrozenColumnCount 속성을 사용해 컬럼 고정하기 (0) | 2020.09.17 |
[C#/WPF] DataGridCheckBoxColumn 엘리먼트 : IsThreeState 속성 사용하기 (0) | 2020.09.17 |
[C#/WPF] DataGrid 엘리먼트 : SelectionChanged/SelectedCellsChanged 이벤트를 사용해 셀 선택 변경시 처리하기 (0) | 2020.09.17 |
[C#/WPF] DataGrid 엘리먼트 : AutoGeneratingColumn 이벤트를 사용해 자동 생성 컬럼 설정하기 (0) | 2020.09.17 |
댓글을 달아 주세요