用户操作
[即时聊天] [发私信] [加为好友]
王卫星ID:wangweixing2000
58818次访问,排名1795好友68人,关注者200
爱好:足球,健身,看电影.
wangweixing2000的文章
原创 70 篇
翻译 0 篇
转载 41 篇
评论 44 篇
星的公告
知识共享,快乐coding!! 千里之行﹐始於足下! Locations of visitors to this page
最近评论
hailongxl://修改employee密码
extern "C" XDATAMANAGER_API int __stdcall DBChangePassword(const char *user,const char*pass)
{
#if USE_SQLITE
if( db == NULL )return X_DB_NOT_INIT;

……
lhtang:Program file does not exist
E:\S60\devices\S60_3rd_FP2_SDK_v1.1\epoc32\release\WINSCW\UDEB\first_syb_hello_0xE40082A0.exe not found

这是为什么?
lhtang:里面只是些zip压缩包,ide里是不是有个添加插件的界面,还有下的1.3的carbide打不开
wangweixing2000:http://www.forum.nokia.com/info/sw.nokia.com/id/48a93bd5-028a-4b3e-a0b1-148ff203b2b3/Extensions_plugin_S60_3rd_ed.html
这里去下载
lhtang:Extensions plug-in如何安装,里面没有安装文件,我邮箱tlhad@126.com,请赐教.
文章分类
收藏
相册
csdn友情连接
COM集中营
kennykerr的blog
休闲空间(RSS)
婉儿的blog(RSS)
数字金刚
推荐经典网站
Codeguru
CodeProject
我的网站
我的免费代码垃圾堆
我的网站
存档
软件项目交易
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
订阅到BlogLines
订阅到Yahoo
订阅到GouGou
订阅到飞鸽
订阅到Rojo
订阅到newsgator
订阅到netvibes

原创 Silverlight2 + VS2008支持C#的SilverLightHelloworld教程收藏

新一篇: Silverlight 入门 | 旧一篇: Silverlight2 Beta1,the project type is not supported by this installation,解决方案

今天装好Silverlight后,第一个程序就是写个helloworld,这里贡献给Silverlight的初学者,希望对你有用! 

这里我认为您已经装好VS2008和Siverlight2 beta1,:)

下面就开始我们的helloworld之旅吧!hoho

1、打开vs2008-〉创建Siverlight Application项目

2、输入SilverLightHelloWorld->OK我们将看到:

3、选择第二项Generate an ....   ->OK,我们将看到下图创建好的工程:

4、我们试着编译以下F7:

编译通过没有问题,哈哈

我们将看到page.xaml代码:

 

<UserControl x:Class="SilverlightHelloWorld.Page"
    xmlns
="http://schemas.microsoft.com/client/2007" 
    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width
="400" Height="300">
    
<Grid x:Name="LayoutRoot" Background="White">

    
</Grid>
</UserControl>

 

5、我们需要更改其xaml代码,更改Grid的背景色并添加一个Button,如下代码:

 

<UserControl x:Class="SilverlightHelloWorld.Page"
    xmlns
="http://schemas.microsoft.com/client/2007" 
    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width
="400" Height="300">
    
<Grid x:Name="LayoutRoot" Background="Red">
    
<Button Content="HelloWorld" Width="100" Height="20">
    
</Button>
    
</Grid>
</UserControl>

背景改成了红色,添加了HelloWorld按钮,效果如下图:

6、我们再给HelloWorld加个Click事件,代码入下:

 

<UserControl x:Class="SilverlightHelloWorld.Page"
    xmlns
="http://schemas.microsoft.com/client/2007" 
    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width
="400" Height="300">
    
<Grid x:Name="LayoutRoot" Background="Red">
    
<Button Content="HelloWorld" Width="100" Height="20" Click="Button_Click">
    
</Button>
    
</Grid>
</UserControl>

还需要添加事件的处理,在Page.xaml.cs中,代码如下:

 

using System;
using System.Collections.Generic;
using System.Linq;
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 SilverlightHelloWorld
{
    
public partial class Page : UserControl
    
{
        
public Page()
        
{
            InitializeComponent();
        }


        
private void Button_Click(object sender, RoutedEventArgs e)
        
{
            
//这里添加代码
      SolidColorBrush brush = (SolidColorBrush)this.LayoutRoot.Background;
            
if (brush.Color == Colors.Red)
            
{
                
this.LayoutRoot.Background = new SolidColorBrush(Colors.Blue);
            }

        }

    }

}

代码逻辑很简单,每点击一次按钮会更改一次背景色。

F5运行看看效果:

点击后的效果:

XAML何以玩出很多花样,剩下的就看你了,hoho!

作者:王卫星

转载注明出处,谢谢!

发表于 @ 2008年04月16日 16:33:00|评论(loading...)|收藏

新一篇: Silverlight 入门 | 旧一篇: Silverlight2 Beta1,the project type is not supported by this installation,解决方案

评论

#zhujian888 发表于2008-04-20 11:07:37  IP: 124.147.157.*
兄弟,你的IE上的工具条太猛了。呵呵
#wangweixing2000 发表于2008-04-20 11:38:18  IP: 221.219.136.*
HEHE,感觉这些工具条比较好玩:)
#xiaotiange 发表于2008-04-20 12:46:44  IP: 59.46.28.*
工具条多了也比较好看哈~~~~~~~~~~~
发表评论  


当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
Csdn Blog version 3.1a
Copyright © 星