WPF 四种不同效果呼吸灯

wpf中的Border、Border.Effect和Background WPF(Windows Presentation Foundation)中,Border和Background是两个非常重要的属性,它们通常用于定义用户界面元素的外观样式。都是用于增强视觉效果和布局的重要工具,前者提供了一种。总的来说,在设计WPF应用程序的用户界面时,允许您为任何嵌套的内容添加边框。它不是一个单独的控件。 阅读详情

WPF开发者QQ群: 340500857  | 微信群 -> 进入公众号主页 加入组织

      由于微信群人数太多入群请添加小编微信号

(yanjinhuawechat)或(W_Feng_aiQ)入群

(需备注WPF开发者

  PS:有更好的方式欢迎推荐。

01

代码如下

一、创建 BreathLamp.cs 继承 ContentControl代码如下。

a69c2a7d91cddfbf379d1c425f400b61.png

using System.Windows;
using System.Windows.Controls;


namespace WPFDevelopers.Controls
{
    public enum LampEffect
    {
        OuterGlow,
        Eclipse,
        Ripple,
        Streamer
    }


    public class BreathLamp : ContentControl
    {
        static BreathLamp()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(BreathLamp), new FrameworkPropertyMetadata(typeof(BreathLamp)));
        }


        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
        }




        public static readonly DependencyProperty CornerRadiusProperty =
            DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(BreathLamp), new PropertyMetadata(new CornerRadius(60d)));


        public static readonly DependencyProperty LampEffectProperty =
            DependencyProperty.Register("LampEffect", typeof(LampEffect), typeof(BreathLamp), new PropertyMetadata(default(LampEffect), OnLampEffectPropertyChangedCallBack));


        public static readonly DependencyProperty IsLampStartProperty =
            DependencyProperty.Register("IsLampStart", typeof(bool), typeof(BreathLamp), new PropertyMetadata(true));




        public CornerRadius CornerRadius
        {
            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
            set { SetValue(CornerRadiusProperty, value); }
        }


        public LampEffect LampEffect
        {
            get { return (LampEffect)GetValue(LampEffectProperty); }
            set { SetValue(LampEffectProperty, value); }
        }


        private static void OnLampEffectPropertyChangedCallBack(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
        }


        public bool IsLampStart
        {
            get { return (bool)GetValue(IsLampStartProperty); }
            set { SetValue(IsLampStartProperty, value); }
        }
    }
}

二、BreathLamp.xaml 代码如下

0df6858fe44b8e2974552f4807edc3c9.png

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:WPFDevelopers.Controls">


    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Basic/ControlBasic.xaml"/>
        <ResourceDictionary Source="Basic/Animations.xaml"/>
    </ResourceDictionary.MergedDictionaries>


    <ControlTemplate x:Key="LampEffect_Eclipse" TargetType="{x:Type controls:BreathLamp}">
        <Grid>
            <Viewbox>
                <Grid Width="60" Height="60">
                    <Border x:Name="PART_LampEclipse"  
                            BorderThickness="0" 
                            BorderBrush="Transparent" 
                            CornerRadius="{TemplateBinding CornerRadius}" 
                            Background="{DynamicResource DangerSolidColorBrush}"
                            RenderTransformOrigin="0.5,0.5">
                        <!--<Border.Effect>
                            <DropShadowEffect BlurRadius="25" ShadowDepth="0" Color="{DynamicResource DangerColor}"/>
                        </Border.Effect>-->
                        <Border.RenderTransform>
                            <ScaleTransform CenterX="0" CenterY="0" ScaleX="0.8" ScaleY="0.8"></ScaleTransform>
                        </Border.RenderTransform>
                    </Border>
                    <Border CornerRadius="{TemplateBinding CornerRadius}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"/>
                </Grid>
            </Viewbox>
            <ContentPresenter/>
        </Grid>


        <ControlTemplate.Triggers>
            <Trigger Property="IsLampStart" Value="True">
                <Setter Property="Effect" TargetName="PART_LampEclipse">
                    <Setter.Value>
                        <DropShadowEffect BlurRadius="25" ShadowDepth="0" Color="{DynamicResource DangerColor}"/>
                    </Setter.Value>
                </Setter>
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard RepeatBehavior="Forever" AutoReverse="True">
                            <DoubleAnimation Duration="0:0:1" BeginTime="0" From="0.8" To="1.1" Storyboard.TargetName="PART_LampEclipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" EasingFunction="{StaticResource SineEaseOut}"/>
                            <DoubleAnimation Duration="0:0:1" BeginTime="0" From="0.8" To="1.1" Storyboard.TargetName="PART_LampEclipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" EasingFunction="{StaticResource SineEaseOut}"/>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
            </Trigger>
        </ControlTemplate.Triggers>


    </ControlTemplate>


    <ControlTemplate x:Key="LampEffect_Ripple" TargetType="{x:Type controls:BreathLamp}">
        <Grid>
            <Viewbox>
                <Grid Width="60" Height="60">
                    <Border x:Name="PART_LampRipple_1" 
                            RenderTransformOrigin="0.5,0.5"
                            Background="Transparent" 
                            BorderThickness="1"
                            CornerRadius="{TemplateBinding CornerRadius}" 
                            BorderBrush="{DynamicResource DangerSolidColorBrush}">
                        <Border.RenderTransform>
                            <ScaleTransform CenterX="0" CenterY="0" ScaleX="0.8" ScaleY="0.8"></ScaleTransform>
                        </Border.RenderTransform>
                    </Border>
                    <Border x:Name="PART_LampRipple_2" 
                            RenderTransformOrigin="0.5,0.5"
                            Background="Transparent" 
                            BorderThickness="1"
                            CornerRadius="{TemplateBinding CornerRadius}" 
                            BorderBrush="{DynamicResource DangerSolidColorBrush}">
                        <Border.RenderTransform>
                            <ScaleTransform ScaleX="0.8" ScaleY="0.8"></ScaleTransform>
                        </Border.RenderTransform>
                    </Border>
                    <Border CornerRadius="{TemplateBinding CornerRadius}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"/>
                </Grid>
            </Viewbox>
            <ContentPresenter/>
        </Grid>


        <ControlTemplate.Triggers>
            <Trigger Property="IsLampStart" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard RepeatBehavior="Forever" AutoReverse="True">
                            <DoubleAnimation Duration="0:0:1" BeginTime="0" From="0.8" To="1.3" Storyboard.TargetName="PART_LampRipple_1" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" EasingFunction="{StaticResource SineEaseOut}"/>
                            <DoubleAnimation Duration="0:0:1" BeginTime="0" From="0.8" To="1.3" Storyboard.TargetName="PART_LampRipple_1" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" EasingFunction="{StaticResource SineEaseOut}"/>


                            <DoubleAnimation Duration="0:0:1" BeginTime="0:0:0.4" From="0.8" To="1.3" Storyboard.TargetName="PART_LampRipple_2" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" EasingFunction="{StaticResource SineEaseOut}"/>
                            <DoubleAnimation Duration="0:0:1" BeginTime="0:0:0.4" From="0.8" To="1.3" Storyboard.TargetName="PART_LampRipple_2" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" EasingFunction="{StaticResource SineEaseOut}"/>


                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
            </Trigger>
        </ControlTemplate.Triggers>


    </ControlTemplate>


    <ControlTemplate x:Key="LampEffect_OuterGlow" TargetType="{x:Type controls:BreathLamp}">
        <Grid>
            <Viewbox>
                <Grid Width="60" Height="60">
                    <Border x:Name="PART_LampOuterGlow"
                            Margin="1"
                            BorderThickness="0" 
                            BorderBrush="Transparent" 
                            CornerRadius="{TemplateBinding CornerRadius}" 
                            Background="{DynamicResource DangerSolidColorBrush}"
                            RenderTransformOrigin="0.5,0.5">
                        <Border.Effect>
                            <DropShadowEffect x:Name="PART_LampOuterGlow_Effect" BlurRadius="0" ShadowDepth="0" Color="{DynamicResource DangerColor}"/>
                        </Border.Effect>
                    </Border>
                    <Border CornerRadius="{TemplateBinding CornerRadius}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"/>
                </Grid>
            </Viewbox>
            <ContentPresenter/>
        </Grid>


        <ControlTemplate.Triggers>
            <Trigger Property="IsLampStart" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard RepeatBehavior="Forever" >
                            <DoubleAnimation Duration="0:0:0.6" AutoReverse="True" BeginTime="0" From="0" To="40" Storyboard.TargetName="PART_LampOuterGlow_Effect" Storyboard.TargetProperty="BlurRadius" EasingFunction="{StaticResource SineEaseInOut}"/>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
            </Trigger>
        </ControlTemplate.Triggers>
            
    </ControlTemplate>


    <ControlTemplate x:Key="LampEffect_Streamer" TargetType="{x:Type controls:BreathLamp}">
        <Grid>
            <Viewbox>
                <Grid Width="60" Height="60">
                    <Border x:Name="PART_LampContainer" CornerRadius="{TemplateBinding CornerRadius}" BorderThickness="{TemplateBinding BorderThickness}"  Background="Transparent" >
                        <Border.BorderBrush>
                            <LinearGradientBrush >
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="#FF00cec9" Offset="0"/>
                                    <GradientStop Color="#2000cec9" Offset="0.3"/>
                                    <GradientStop Color="Transparent" Offset="1" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Border.BorderBrush>
                    </Border>
                </Grid>
            </Viewbox>
            <Border Padding="{TemplateBinding BorderThickness}">
                <ContentPresenter Margin="{TemplateBinding BorderThickness}"/>
            </Border>
        </Grid>


        <ControlTemplate.Triggers>
            <Trigger Property="IsLampStart" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard x:Name="PART_LampStoryboard">
                        <Storyboard RepeatBehavior="Forever">
                            <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(LinearGradientBrush.StartPoint)"  Storyboard.TargetName="PART_LampContainer">
                                <EasingPointKeyFrame KeyTime="0:0:0.0" Value="0,1"/>
                                <EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/>
                                <EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/>
                                <EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/>
                                <EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/>
                                <EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/>
                            </PointAnimationUsingKeyFrames>
                            <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(LinearGradientBrush.EndPoint)"  Storyboard.TargetName="PART_LampContainer">
                                <EasingPointKeyFrame KeyTime="0:0:0.0" Value="0,1"/>
                                <EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/>
                                <EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/>
                                <EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/>
                                <EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/>
                                <EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/>


                            </PointAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <StopStoryboard BeginStoryboardName="PART_LampStoryboard"/>
                </Trigger.ExitActions>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    
    <Style TargetType="{x:Type controls:BreathLamp}" BasedOn="{StaticResource ControlBasicStyle}">
        <Setter Property="BorderThickness" Value="1"/>
        
        <Style.Triggers>
            <Trigger Property="LampEffect" Value="Eclipse">
                <Setter Property="Template" Value="{StaticResource LampEffect_Eclipse}"/>
            </Trigger>


            <Trigger Property="LampEffect" Value="Ripple">
                <Setter Property="Template" Value="{StaticResource LampEffect_Ripple}"/>
            </Trigger>


            <Trigger Property="LampEffect" Value="OuterGlow">
                <Setter Property="Template" Value="{StaticResource LampEffect_OuterGlow}"/>
            </Trigger>


            <Trigger Property="LampEffect" Value="Streamer">
                <Setter Property="Template" Value="{StaticResource LampEffect_Streamer}"/>
            </Trigger>
        </Style.Triggers>
</Style>
</ResourceDictionary>

二、BreatheLightExample.xaml 代码如下

7dc472a8d0aeb92704073061df23f9ff.png

<UserControl x:Class="WPFDevelopers.Samples.ExampleViews.BreatheLightExample"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:WPFDevelopers.Samples.ExampleViews"
             xmlns:wpfdev="https://github.com/yanjinhuagood/WPFDevelopers"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <UniformGrid Columns="2">
        <Border Effect="{StaticResource NormalShadowDepth}" Width="400" Height="140" Background="{StaticResource WhiteSolidColorBrush}"
                CornerRadius="3">
            <Grid Margin="20,20,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <wpfdev:BreathLamp Width="60" Height="60" LampEffect="OuterGlow" Background="Transparent" IsLampStart="true"
                                   VerticalAlignment="Top" HorizontalAlignment="Left">
                    <Ellipse>
                        <Ellipse.Fill>
                            <ImageBrush ImageSource="pack://application:,,,/WPFDevelopers.Samples;component/Images/Breathe/2.jpg"/>
                        </Ellipse.Fill>
                    </Ellipse>
                </wpfdev:BreathLamp>


                <TextBlock Grid.Column="1" 
                           Margin="10,20"
                           FontSize="{StaticResource MediumFontSize}">
                    <Run Foreground="{StaticResource PrimaryTextSolidColorBrush}">
                        周星星|达叔
                    </Run>
                    <Run Foreground="{StaticResource SuccessPressedSolidColorBrush}">正在直播</Run>
                </TextBlock>
                <Button Style="{StaticResource PrimaryButton}" Grid.Column="1" 
                        HorizontalAlignment="Right" 
                        VerticalAlignment="Bottom" Content="进入直播"/>
            </Grid>
            
        </Border>


        <Border Effect="{StaticResource NormalShadowDepth}" Width="400" Height="140" Background="{StaticResource WhiteSolidColorBrush}"
                CornerRadius="3">
            <Grid Margin="20,20,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <wpfdev:BreathLamp Width="60" Height="60" LampEffect="Eclipse" Background="LightGray" IsLampStart="true"
                                   VerticalAlignment="Top" HorizontalAlignment="Left">
                    <Ellipse>
                        <Ellipse.Fill>
                            <ImageBrush ImageSource="pack://application:,,,/WPFDevelopers.Samples;component/Images/Breathe/1.jpg"/>
                        </Ellipse.Fill>
                    </Ellipse>
                </wpfdev:BreathLamp>


                <TextBlock Grid.Column="1" 
                           Margin="10,20"
                           FontSize="{StaticResource MediumFontSize}"
                           TextWrapping="Wrap">
                    <Run Foreground="{StaticResource PrimaryTextSolidColorBrush}">
                        大话西游之大圣娶亲&#x000A;
                    </Run>
                    <Run Foreground="{StaticResource SuccessPressedSolidColorBrush}">正在直播</Run>
                </TextBlock>
                <Button Style="{StaticResource PrimaryButton}" Grid.Column="1" 
                        HorizontalAlignment="Right"
                        VerticalAlignment="Bottom" Content="进入直播" Width="100"/>
            </Grid>
        </Border>
        <Border Effect="{StaticResource NormalShadowDepth}" Width="400" Height="140" Background="{StaticResource WhiteSolidColorBrush}"
                CornerRadius="3">
           
            <Grid Margin="20,20,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <wpfdev:BreathLamp Width="60" Height="60" LampEffect="Ripple" Background="LightGray" IsLampStart="true"
                                   VerticalAlignment="Top" HorizontalAlignment="Left">
                    <Ellipse>
                        <Ellipse.Fill>
                            <ImageBrush ImageSource="pack://application:,,,/WPFDevelopers.Samples;component/Images/Breathe/0.jpg"/>
                        </Ellipse.Fill>
                    </Ellipse>
                </wpfdev:BreathLamp>


                <TextBlock Grid.Column="1" 
                           Margin="10,20"
                           FontSize="{StaticResource MediumFontSize}">
                    <Run Foreground="{StaticResource PrimaryTextSolidColorBrush}">
                        XXXYYY
                    </Run>
                    <Run Foreground="{StaticResource SuccessPressedSolidColorBrush}">正在直播</Run>
                </TextBlock>
                <Button Style="{StaticResource PrimaryButton}" Grid.Column="1" 
                        HorizontalAlignment="Right"
                        VerticalAlignment="Bottom" Content="进入直播" Width="100"/>
            </Grid>
        </Border>


        <Border Effect="{StaticResource NormalShadowDepth}" Width="400" Height="140" Background="{StaticResource WhiteSolidColorBrush}"
                CornerRadius="3">


            <Grid Margin="20,20,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <wpfdev:BreathLamp Width="60" Height="60" LampEffect="Streamer" Background="LightGray" IsLampStart="True"
                                   VerticalAlignment="Top" HorizontalAlignment="Left">
                    <Ellipse Width="53" Height="53">
                        <Ellipse.Fill>
                            <ImageBrush ImageSource="pack://application:,,,/WPFDevelopers.Samples;component/Images/Chat/UserImages/yanjinhua.png"/>
                        </Ellipse.Fill>
                    </Ellipse>
                </wpfdev:BreathLamp>


                <TextBlock Grid.Column="1" 
                           Margin="10,20"
                           FontSize="{StaticResource MediumFontSize}">
                    <Run Foreground="{StaticResource PrimaryTextSolidColorBrush}">
                        WPF开发者
                    </Run>
                    <Run Foreground="{StaticResource SuccessPressedSolidColorBrush}">正在直播</Run>
                </TextBlock>
                <Button Style="{StaticResource PrimaryButton}" Grid.Column="1" 
                        HorizontalAlignment="Right" 
                        VerticalAlignment="Bottom" Content="进入直播" />
            </Grid>
        </Border>
    </UniformGrid>
</UserControl>

02


效果预览

鸣谢素材提供者 - 吴锋

源码地址如下

github:https://github.com/yanjinhuagood/WPFDevelopers.git

gitee:https://gitee.com/yanjinhua/WPFDevelopers.git

WPF开发者QQ群: 340500857 

blogs: https://www.cnblogs.com/yanjinhua

Github:https://github.com/yanjinhuagood

出处:https://www.cnblogs.com/yanjinhua

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。

转载请著名作者 出处 https://github.com/yanjinhuagood

005a570e6117cfacc744547f890cc442.png

扫一扫关注我们,

4e6837d20c69ea44b22d34d8857bb725.gif

更多知识早知道!

399c3b8f05142376528803ad06592f9d.gif

点击阅读原文可跳转至源代码

好玩的WPF第二弹:电子表字体显示时间+多彩呼吸特效按钮 我们先来看看Quartz MS字体动态显示系统时间的效果,难度相较于上一篇也要简单许多。首先是定义一个TextBlock如下。<Grid> <TextBlock Name="tBlockTime" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="68" Foreground="Green 阅读详情

相关推荐

WPF 动画闪烁效果

WPF 动画闪烁效果 一、按钮外边缘呼吸闪烁 点击触发效果; 代码: <Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.c

韬光养晦 7804

WPF 开发LED效果

这个用WPF做的LED值得学习借鉴,在此基础上进行扩展是不错的

WPF呼吸闪烁效果例子

一个WPF呼吸闪烁效果的例子 更多资源: http://cleopard.download.csdn.net

WPF 使用VisualStateManager实现自定义控件闪烁呼吸警报

1.添加一个新建的自定义控件LightControl1(注意不是用户控件!

weixin_65414269的博客 2573

WPF 呼吸特效

path >> Ellipse的呼吸特效         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         Title="MainWindow" Height="3

戮筱沫博客 6307

WPF呼吸闪烁效果例子:为界面注入活力

WPF呼吸闪烁效果例子:为界面注入活力 去发现同类优质开源项目:https://gitcode.com/ 在当今信息时代,用户体验成为软件设计的关键因素之一。WPF(Windows Presentation Foundation)以其强大的图形和界面设计能力,在桌面应用程序开发中占据了一席之地。今天,我们将为您介绍一个开源项目——WPF呼吸闪烁效果例子,它能够为您的应用程序界面增添动态美感。 项目...

gitblog_06707的博客 842

WPF 呼吸闪烁效果

<Style x:Key="OuterGlowStyle" TargetType="{x:Type FrameworkElement}"> <Setter Property="Effect"> <Setter.Value> <DropShadow...

aochicong0476的博客 1607

wpf border控件和Effect学习

wpf Border(边框)控件绘制一个边框、一个背景;

bcbobo21cn的专栏 2046

WPF TextBox 动画阴影(呼吸

&lt;TextBox Height="30" Width="300" TextWrapping="Wrap" Text="TextBox"&gt; &lt;TextBox.Template&gt; &lt;ControlTemplate&gt; &lt;Con

HeBizhi1997的博客 1273

wpf实现无边框 带阴影效果的窗口 DropShadowEffect属性的应用

1、首先设置窗口的属性 WindowStyle=“None” AllowsTransparency=“True” 2、窗口里面包一个border 3、设置border的effect属性 <Border.Effect> </Border.Effect> 4、设置border的Margin为ShadowDepth的值 5、窗口的width和height属性都加ShadowDepth的即可 ...

淡淡的幸福 1041

WPF实现TextBlock呼吸效果WPF禁用TextBox中文输入法

实现效果: 实现代码: <TextBlock Text="录像中" FontSize="48" Foreground="#ED4646" HorizontalAlignment="Center" FontWeight="Medium" x:Name="TextBlockRecording"> <TextBlock.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"&g.

5653325的专栏 908

WPF 编程宝典》14.2:Effect

<Border.Effect> <DropShadowEffect Color="Red" ShadowDepth="10" BlurRadius="15" Opacity="0.3" Direction="0"/> </Border.Effect>

LeoChaw 666

WPF进阶第一课 阴影效果

WPF 阴影效果

weixin_43783135的博客 659
上一篇: 当.NET遇到机器学习
下一篇: C# WPF MVVM开发框架Caliburn.Micro Screens, Conductors 和 Composition⑦
dotNET跨平台
博客等级 码龄9年 6204粉丝 1791原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值