WPF中应用行为实现对媒体的控制
2021-02-28霍晓钢
霍晓钢








摘要: 为了解决没有编程基础的数字媒体开发人员,对数字媒体的控制需求,WPF开发工具Expression Blend引入行为(behavior)编程包直接作用于控件,使得只需修改对应属性参数就可方便对数字媒体对象加以有效地控制。本文介绍WPF行为的应用,展示不用编程完成应用程序中对数字媒体控制的设计与制作过程。
关键词:WPF;行为;数字媒体;编程
中图分类号:TP311 文献标识码:A
文章编号:1009-3044(2021)35-0102-03
Application Behavior in WPF to Control Media
HUO Xiao-gang
(Zhejiang Technical Institute of Economics,Hangzhou 310006,China)
Abstract: In order to solve the control requirements of digital media developers without programming foundation, WPF development tool expression blend introduces behavior programming package to directly act on the control, which makes it easy to control digital media objects effectively by modifying the corresponding attribute parameters. This paper introduces the application of WPF behavior, and shows the design and production process of digital media control without programming.
Key words : WPF;behavior;digital media;computer coding
WPF(Windows Presentation Foundation,直譯为:窗口展示平台)是微软新一代矢量图形系统,WPF有着灵活、易扩展的动画机制,接口设计非常直观,能方便地进行可视化编辑[1]。也能够方便快捷地制作精美复杂的UI(用户界面设计)并无须大量的程序代码的设计。
微软开发了Expression Studio套装工具可视化的设计界面中的Expression Blend,自Visual Studio2013以后全部集成安装在开发系统中。所写的目标代码适用于微软支持的所有平台,在Expression Blend中,通过美工板上绘制形状、路径和控件,然后修改其外观、动画和行为,能够直观地设计应用程序。也可以通过导入图像、视频和声音,只需修改其属性就可以对项目对象进行有效地控件,大大方便没有程序设计基础的制作人员。本文通过介绍Expression Blend中行为的应用,展示不用编写程序代码或较少地编写程序代码,对数字媒体控制的方法。
1 Blend行为的设置
1.1 Expression Blend内置行为
Expression Blend中的“行为”是一些可重用的封装代码段,将这些代码段拖动到控件对象上后,仅通过更改其行为属性进行微调,不需要编写任何代码[2],就可向应用程序添加交互、动画等功能,设计出所需的应用程序响应的方式[3]。……
