稳扎稳打Silverlight(31) - 2.0Tip/Trick之加载XAP, 加载XAML, 加载DLL, AppManifest.xaml文件说明, 自定义鼠标指针
2009-06-01 09:09
621 查看
[索引页]
[源码下载]
[align=center]稳扎稳打Silverlight(31) - 2.0Tip/Trick之加载XAP, 加载XAML, 加载DLL, AppManifest.xaml文件说明, 自定义鼠标指针[/align]
作者:webabcd
介绍
Silverlight 2.0 提示和技巧系列
加载XAP - 加载指定的 xap 文件到当前的 Silverlight 应用程序中
加载XAML - 加载指定的 xaml 文件到当前的 Silverlight 应用程序中
加载DLL - 加载指定的 dll 文件,并调用其中的方法或加载其中的控件
AppManifest.xaml文件说明 - 简要说明 AppManifest.xaml 文件内容中各个节点的作用
自定义鼠标指针 - 实现自定义的鼠标指针,即鼠标跟随
在线DEMO
/article/4589581.html
示例
1、在 Silverlight 程序中加载指定的 xap 文件
LoadXap.xaml
<UserControl x:Class="Silverlight20.Tip.LoadXap"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel>
<Button x:Name="load" Content="加载游戏 - 俄罗斯方块" Click="load_Click" Margin="5" />
<Grid x:Name="container" Margin="5" />
</StackPanel>
</Grid>
</UserControl>
LoadXap.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Resources;
using System.IO;
using System.Xml.Linq;
using System.Reflection;
namespace Silverlight20.Tip
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Resources;
using System.IO;
namespace Silverlight20.Tip
3、在 Silverlight 程序中加载指定的 dll 文件,并调用其中的方法或加载其中的控件
LoadDllDemo.Test.cs
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace LoadDllDemo
LoadDll.xaml
<UserControl x:Class="Silverlight20.Tip.LoadDll"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Name="LayoutRoot" Background="White">
<TextBlock x:Name="lblResult" Margin="5" />
</Grid>
</UserControl>
LoadDll.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Reflection;
namespace Silverlight20.Tip
4、简要说明 AppManifest.xaml 文件内容中各个节点的作用
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" EntryPointAssembly="Silverlight20" EntryPointType="Silverlight20.App" RuntimeVersion="2.0.31005.0">
<Deployment.Parts>
<AssemblyPart x:Name="Silverlight20" Source="Silverlight20.dll" />
<AssemblyPart x:Name="Microsoft.Windows.Controls" Source="Microsoft.Windows.Controls.dll" />
</Deployment.Parts>
</Deployment>
一个 Silverlight 应用程序包(xap)内都会包含 AppManifest.xaml 文件,其内标识着打包的程序集和程序入口等信息
Deployment - 根节点
EntryPointAssembly - 程序入口的程序集
EntryPointType - 程序入口的类型
RuntimeVersion - 所需的 Silverlight 插件的版本
AssemblyPart - 标识 Silverlight 程序包(xap)内的程序集。其中的 Source 属性用于标识程序集的路径
5、自定义鼠标指针,即鼠标跟随
CustomMouseCursor.xaml
<UserControl x:Class="Silverlight20.Tip.CustomMouseCursor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Name="LayoutRoot" Background="Bisque">
<Canvas x:Name="canvas">
<Ellipse x:Name="ellipse" Width="30" Height="30" Fill="Red" />
</Canvas>
</Grid>
</UserControl>
CustomMouseCursor.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace Silverlight20.Tip
OK
[源码下载]
[源码下载]
[align=center]稳扎稳打Silverlight(31) - 2.0Tip/Trick之加载XAP, 加载XAML, 加载DLL, AppManifest.xaml文件说明, 自定义鼠标指针[/align]
作者:webabcd
介绍
Silverlight 2.0 提示和技巧系列
加载XAP - 加载指定的 xap 文件到当前的 Silverlight 应用程序中
加载XAML - 加载指定的 xaml 文件到当前的 Silverlight 应用程序中
加载DLL - 加载指定的 dll 文件,并调用其中的方法或加载其中的控件
AppManifest.xaml文件说明 - 简要说明 AppManifest.xaml 文件内容中各个节点的作用
自定义鼠标指针 - 实现自定义的鼠标指针,即鼠标跟随
在线DEMO
/article/4589581.html
示例
1、在 Silverlight 程序中加载指定的 xap 文件
LoadXap.xaml
<UserControl x:Class="Silverlight20.Tip.LoadXap"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel>
<Button x:Name="load" Content="加载游戏 - 俄罗斯方块" Click="load_Click" Margin="5" />
<Grid x:Name="container" Margin="5" />
</StackPanel>
</Grid>
</UserControl>
LoadXap.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Resources;
using System.IO;
using System.Xml.Linq;
using System.Reflection;
namespace Silverlight20.Tip
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Resources;
using System.IO;
namespace Silverlight20.Tip
3、在 Silverlight 程序中加载指定的 dll 文件,并调用其中的方法或加载其中的控件
LoadDllDemo.Test.cs
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace LoadDllDemo
LoadDll.xaml
<UserControl x:Class="Silverlight20.Tip.LoadDll"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Name="LayoutRoot" Background="White">
<TextBlock x:Name="lblResult" Margin="5" />
</Grid>
</UserControl>
LoadDll.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Reflection;
namespace Silverlight20.Tip
4、简要说明 AppManifest.xaml 文件内容中各个节点的作用
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" EntryPointAssembly="Silverlight20" EntryPointType="Silverlight20.App" RuntimeVersion="2.0.31005.0">
<Deployment.Parts>
<AssemblyPart x:Name="Silverlight20" Source="Silverlight20.dll" />
<AssemblyPart x:Name="Microsoft.Windows.Controls" Source="Microsoft.Windows.Controls.dll" />
</Deployment.Parts>
</Deployment>
一个 Silverlight 应用程序包(xap)内都会包含 AppManifest.xaml 文件,其内标识着打包的程序集和程序入口等信息
Deployment - 根节点
EntryPointAssembly - 程序入口的程序集
EntryPointType - 程序入口的类型
RuntimeVersion - 所需的 Silverlight 插件的版本
AssemblyPart - 标识 Silverlight 程序包(xap)内的程序集。其中的 Source 属性用于标识程序集的路径
5、自定义鼠标指针,即鼠标跟随
CustomMouseCursor.xaml
<UserControl x:Class="Silverlight20.Tip.CustomMouseCursor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Name="LayoutRoot" Background="Bisque">
<Canvas x:Name="canvas">
<Ellipse x:Name="ellipse" Width="30" Height="30" Fill="Red" />
</Canvas>
</Grid>
</UserControl>
CustomMouseCursor.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace Silverlight20.Tip
OK
[源码下载]
相关文章推荐
- 稳扎稳打Silverlight(31) - 2.0Tip/Trick之加载XAP, 加载XAML, 加载DLL, AppManifest.xaml文件说明, 自定义鼠标指针
- 稳扎稳打Silverlight(31) - 2.0Tip/Trick之加载XAP, 加载XAML, 加载DLL, AppManifest.xaml文件说明, 自定义鼠标指针
- 稳扎稳打Silverlight(31) - 2.0Tip/Trick之加载XAP, 加载XAML, 加载DLL, AppManifest.xaml文件说明
- 2.0Tip/Trick之加载XAP, 加载XAML, 加载DLL, AppManifest.xaml文件说明, 自定义鼠标指针
- 稳扎稳打Silverlight(30) - 2.0Tip/Trick之Silverlight.js, Silverlight.supportedUserAgent.js, 自定义启动界面, 响应鼠标滚轮事件
- 稳扎稳打Silverlight(29) - 2.0Tip/Trick之Cookie, 自定义字体, 为程序传递参数, 自定义鼠标右键, 程序常用配置参数
- 稳扎稳打Silverlight(30) - 2.0Tip/Trick之Silverlight.js, Silverlight.supportedUserAgent.js, 自定义启动界面, 响应鼠标滚
- 稳扎稳打Silverlight(29) - 2.0Tip/Trick之Cookie, 自定义字体, 为程序传递参数, 自定义鼠标右键, 程序常用配置参数
- 稳扎稳打Silverlight(30) - 2.0Tip/Trick之Silverlight.js, Silverlight.supportedUserAgent.js, 自定义启动界面, 响应鼠标滚轮事件
- 稳扎稳打Silverlight(29) - 2.0Tip/Trick之Cookie, 自定义字体, 为程序传递参数, 自定义鼠标右键, 程序常用配置参数
- 稳扎稳打Silverlight(29) - 2.0Tip/Trick之Cookie, 自定义字体, 为程序传递参数, 自定义鼠标右键
- 稳扎稳打Silverlight(32) - 2.0Tip/Trick之MessageBox, Popup, 循环的几种实现方法, 动态变换主题, 本地化(多语言), 响应鼠标双击事件
- 稳扎稳打Silverlight(32) - 2.0Tip/Trick之MessageBox, Popup, 循环的几种实现方法, 动态变换主题, 本地化(多语言), 响应鼠标双击事件
- 2.0Tip/Trick之Silverlight.js, Silverlight.supportedUserAgent.js, 自定义启动界面, 响应鼠标滚轮事件
- Silverlight_ MIME(xap,xaml,bin)文件类型大全
- 31.Silverlight中WebClient+StreamResourceInfo+反射实现动态加载外部XAP程序
- 稳扎稳打Silverlight(32) - 2.0Tip/Trick之MessageBox, Popup, 循环的几种实现方法, 动态变换主题
- 懵懵懂懂 silverlight: 创建自己的xaml文件,加载xaml文件
- Silverlight:利用异步加载Xap实现自定义loading效果
- silverlight beet - 从xap文件中加载图片