Welcome

首页 / 软件开发 / Silverlight / 稳扎稳打Silverlight(47) - 4.0UI之操作剪切板,隐式样式,CompositeTransform,

稳扎稳打Silverlight(47) - 4.0UI之操作剪切板,隐式样式,CompositeTransform,2010-11-01 博客园 webabcd稳扎稳打Silverlight(47) - 4.0UI之操作剪切板,隐式样式,CompositeTransform,拖放外部文件到程序中

介绍

Silverlight 4.0 用户界面(UI)相关:

* 操作剪切板 - 支持获取或设置剪切板中的文本信息

* 隐式样式(Implicit Style) - 将某种样式应用到某种类型的所有元素,即全局样式

* CompositeTransform - 将多种转换方式合而为一

* 拖动(Drag)外部文件,并将其放到(Drop) Silverlight 程序中

在线DEMO

http://www.cnblogs.com/webabcd/archive/2010/08/09/1795417.html

示例

1、演示如何操作剪切板

Clipboard.xaml

代码

<navigation:Page x:Class="Silverlight40.UI.Clipboard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
Title="Clipboard Page">
<Grid x:Name="LayoutRoot">
<StackPanel HorizontalAlignment="Left">

<TextBox Name="txtMsg" Width="200" Height="50" Margin="5" />
<!-- 复制 txtMsg 中的文本 -->
<Button Name="btnCopy" Content="复制" Margin="5" Click="btnCopy_Click" />
<!-- 将剪切板中的文本粘贴到 txtMsg -->
<Button Name="btnPaste" Content="粘贴" Margin="5" Click="btnPaste_Click" />
</StackPanel>
</Grid>
</navigation:Page>