2.编译后ClientBin文件夹中多了个SilverlightApplication3.xap文件,感觉类似于Silverlight项目的dll文件等的压缩包。
<UserControlx:Class="SilverlightApplication3.MainPage"
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"
mc:Ignorable="d"d:DesignWidth="640"d:DesignHeight="480">
<Gridx:Name="LayoutRoot">
<Buttonx:Name="myButton"Content="ClickMe"
Width="240"Height="100"
FontSize="24"Foreground="#FF7800"
Click="myButton_Click">
</Button>
</Grid>
</UserControl>
MainPage.XAML.cs文件中加入按钮变化,很熟悉的C#代码
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Net;
usingSystem.Windows;
usingSystem.Windows.Controls;
usingSystem.Windows.Documents;
usingSystem.Windows.Input;
usingSystem.Windows.Media;
usingSystem.Windows.Media.Animation;
usingSystem.Windows.Shapes;
namespaceSilverlightApplication3
{
publicpartialclassMainPage:UserControl
{
publicMainPage()
{
InitializeComponent();
}
privatevoidmyButton_Click(objectsender,RoutedEventArgse)
{
this.myButton.Content="clicked";
this.myButton.Background=newSolidColorBrush(Colors.Red);
}
}
}
之后在web项目中使用即可
<asp:SilverlightID="Items"runat="server"Source="~/ClientBin/SilverlightApplication3.xap"Width="100%"Height="100%"/>
执行效果如下:
PS:
这个小例子中也遇到了些问题,找不到System.web.Silverlight。最后没办法在一个项目包中拿来一个用。不知是不是因为TerryLee的演示时Silverlight2。而我使用的是3,期间有了什么变化。至今仍困惑。
优质内容筛选与推荐>>
1、Most used CSS tricks 2、Netty实战十之编解码器框架3、调试工具Chisel-LLDB插件4、谏啬实八吨都称劳仝端敦肆5、HDU 2686 Matrix (多线程DP)
长按二维码向我转账
受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。
阅读
好看
已推荐到看一看
你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
取消
分享想法到看一看
确定
最多200字,当前共字