첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
다운로드

▶ 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
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요