728x90
반응형
728x170
▶ 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
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] ComboBox 클래스 : 우선 순위 필터 콤보 박스 사용하기 (0) | 2021.09.17 |
---|---|
[C#/WPF] 대시보드 애니메이션 사용하기 (0) | 2021.09.16 |
[C#/WPF] 확장 메뉴 사용하기 (0) | 2021.09.15 |
[C#/WPF] ToggleButton 클래스 : 드롭 다운 버튼/분리 버튼 사용하기 (0) | 2021.09.14 |
[C#/WPF] 열거형 정렬하기 (0) | 2021.09.13 |
[C#/WPF] Adorner 클래스 : 슬라이딩 어도너 사용하기 (0) | 2021.09.13 |
[C#/WPF] UserControl 클래스 : 로딩 패널 사용하기 (0) | 2021.09.11 |
[C#/WPF] ImageAwesome 엘리먼트 : Spin/SpinDuration 속성을 사용해 아이콘 회전시키기 (0) | 2021.09.11 |
[C#/WPF] 누겟 설치 : FontAwesome.WPF (0) | 2021.09.11 |
[C#/WPF] GOM 플레이어 모방하기 (0) | 2021.09.05 |
댓글을 달아 주세요