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

TestProject.zip
0.01MB

▶ LoadingPanel.xaml

<UserControl x:Class="TestProject.LoadingPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <Color x:Key="FilledColorKey"
            A="255"
            B="155"
            R="155"
            G="155" />
        <Color x:Key="UnfilledColorKey"
            A="0"
            B="155"
            R="155"
            G="155" />
        <Style x:Key="BusyAnimationStyleKey" TargetType="Control">
            <Setter Property="Background" Value="#7f000000" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Control">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="Storyboard0Key"
                                BeginTime="00:00:00"
                                RepeatBehavior="Forever">
                                <ColorAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse0"
                                    Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColorKey}"   />
                                    <SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColorKey}" />
                                </ColorAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse0"
                                    Storyboard.TargetProperty="Width">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse0"
                                    Storyboard.TargetProperty="Height">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="Storyboard1Key"
                                BeginTime="00:00:00.2"
                                RepeatBehavior="Forever">
                                <ColorAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse1"
                                    Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColorKey}"   />
                                    <SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColorKey}" />
                                </ColorAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse1"
                                    Storyboard.TargetProperty="Width">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse1"
                                    Storyboard.TargetProperty="Height">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="Storyboard2Key"
                                BeginTime="00:00:00.4"
                                RepeatBehavior="Forever">
                                <ColorAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse2"
                                    Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColorKey}"   />
                                    <SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColorKey}" />
                                </ColorAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse2"
                                    Storyboard.TargetProperty="Width">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse2"
                                    Storyboard.TargetProperty="Height">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="Storyboard3Key"
                                BeginTime="00:00:00.6"
                                RepeatBehavior="Forever">
                                <ColorAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse3"
                                    Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColorKey}"   />
                                    <SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColorKey}" />
                                </ColorAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse3"
                                    Storyboard.TargetProperty="Width">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse3"
                                    Storyboard.TargetProperty="Height">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="Storyboard4Key"
                                BeginTime="00:00:00.8"
                                RepeatBehavior="Forever">
                                <ColorAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse4"
                                    Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColorKey}"   />
                                    <SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColorKey}" />
                                </ColorAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse4"
                                    Storyboard.TargetProperty="Width">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse4"
                                    Storyboard.TargetProperty="Height">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="Storyboard5Key"
                                BeginTime="00:00:01.0"
                                RepeatBehavior="Forever">
                                <ColorAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse5"
                                    Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColorKey}"   />
                                    <SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColorKey}" />
                                </ColorAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse5"
                                    Storyboard.TargetProperty="Width">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse5"
                                    Storyboard.TargetProperty="Height">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="Storyboard6Key"
                                BeginTime="00:00:01.2"
                                RepeatBehavior="Forever">
                                <ColorAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse6"
                                    Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColorKey}"   />
                                    <SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColorKey}" />
                                </ColorAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse6"
                                    Storyboard.TargetProperty="Width">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse6"
                                    Storyboard.TargetProperty="Height">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="Storyboard7Key"
                                BeginTime="00:00:01.4"
                                RepeatBehavior="Forever">
                                <ColorAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse7"
                                    Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColorKey}"   />
                                    <SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColorKey}" />
                                </ColorAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse7"
                                    Storyboard.TargetProperty="Width">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="ellipse7"
                                    Storyboard.TargetProperty="Height">
                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                        <SplineDoubleKeyFrame KeyTime="00:00:00.0" Value="12" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.0" Value="10" />
                                        <SplineDoubleKeyFrame KeyTime="00:00:01.6" Value="0"  />
                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsVisible" Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard Name="Storyboard0" Storyboard="{StaticResource Storyboard0Key}" />
                                    <BeginStoryboard Name="Storyboard1" Storyboard="{StaticResource Storyboard1Key}" />
                                    <BeginStoryboard Name="Storyboard2" Storyboard="{StaticResource Storyboard2Key}" />
                                    <BeginStoryboard Name="Storyboard3" Storyboard="{StaticResource Storyboard3Key}" />
                                    <BeginStoryboard Name="Storyboard4" Storyboard="{StaticResource Storyboard4Key}" />
                                    <BeginStoryboard Name="Storyboard5" Storyboard="{StaticResource Storyboard5Key}" />
                                    <BeginStoryboard Name="Storyboard6" Storyboard="{StaticResource Storyboard6Key}" />
                                    <BeginStoryboard Name="Storyboard7" Storyboard="{StaticResource Storyboard7Key}" />
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <StopStoryboard BeginStoryboardName="Storyboard0" />
                                    <StopStoryboard BeginStoryboardName="Storyboard1" />
                                    <StopStoryboard BeginStoryboardName="Storyboard2" />
                                    <StopStoryboard BeginStoryboardName="Storyboard3" />
                                    <StopStoryboard BeginStoryboardName="Storyboard4" />
                                    <StopStoryboard BeginStoryboardName="Storyboard5" />
                                    <StopStoryboard BeginStoryboardName="Storyboard6" />
                                    <StopStoryboard BeginStoryboardName="Storyboard7" />
                                </Trigger.ExitActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                        <Border
                            BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            Background="{TemplateBinding Background}">
                            <Grid>
                                <Canvas
                                    MinWidth="60"
                                    MinHeight="60">
                                    <Canvas.Resources>
                                        <Style TargetType="Ellipse">
                                            <Setter Property="Width"  Value="10"        />
                                            <Setter Property="Height" Value="10"        />
                                            <Setter Property="Fill"   Value="#009b9b9b" />
                                        </Style>
                                    </Canvas.Resources>
                                    <Ellipse Name="ellipse0" Canvas.Left="5.75"  Canvas.Top="25"    />
                                    <Ellipse Name="ellipse1" Canvas.Left="10.5"  Canvas.Top="11"    />
                                    <Ellipse Name="ellipse2" Canvas.Left="24.5"  Canvas.Top="4.75"  />
                                    <Ellipse Name="ellipse3" Canvas.Left="38.75" Canvas.Top="10.75" />
                                    <Ellipse Name="ellipse4" Canvas.Left="44.5"  Canvas.Top="24.75" />
                                    <Ellipse Name="ellipse5" Canvas.Left="38.75" Canvas.Top="38.5"  />
                                    <Ellipse Name="ellipse6" Canvas.Left="24.75" Canvas.Top="43.75" />
                                    <Ellipse Name="ellipse7" Canvas.Left="11"    Canvas.Top="38.25" />
                                </Canvas>
                                <Label
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Content="{Binding Path=Text}" />
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Control
            Style="{StaticResource BusyAnimationStyleKey}"
            HorizontalAlignment="Center"
            VerticalAlignment="Center" />
    </Grid>
</UserControl>

 

728x90

 

▶ LoadingPanel.xaml.cs

using System.Windows.Controls;

namespace TestProject
{
    /// <summary>
    /// 로딩 패널
    /// </summary>
    public partial class LoadingPanel : UserControl
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - LoadingPanel()

        /// <summary>
        /// 생성자
        /// </summary>
        public LoadingPanel()
        {
            InitializeComponent();
        }

        #endregion
    }
}

 

300x250

 

▶ 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:local="clr-namespace:TestProject"
    Width="800"
    Height="600"
    Title="UserControl 엘리먼트 : 로딩 패널 사용하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid>
        <local:LoadingPanel
            HorizontalAlignment="Center"
            VerticalAlignment="Center" />
    </Grid>
</Window>

 

반응형

 

▶ MainWindow.xaml.cs

using System.Windows;

namespace TestProject
{
    /// <summary>
    /// 메인 윈도우
    /// </summary>
    public partial class MainWindow : Window
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainWindow()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요