文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>silverlight(一.安装和新建项目)

silverlight(一.安装和新建项目)

时间:2010-09-28  来源:Simcoder

1.下载安装silverlight:Microsoft® Silverlight™ 3 Tools (安装之前需要升级VS2008到SP1)

2.和多数人一样我的程序新建好运行调试报错,提示“未安装silverlight托管调试包”,后来我使用VS2010新建的时候提示安装silverlight更高版本Silverlight_Developer.exe,我安装好后就OK了,然后运行VS2008的项目也没有报错了,整理一下我自己的安装顺序: VS2008(后来又安装了VS2010),framework3.5-SP1, VS2008—SP1 ,silverlight3,Silverlight_Developer.exe。

3.新建项目 新建一个silverlight导航应用程序

然后找到Views中的Home.xaml文件 F5调试运行

然后添加silverlight控件:button 和 textbox

双击按钮书写代码

Home.xaml页面代码:

代码 <navigation:Page x:Class="SilverlightApplication3.Home" 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" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" Title="主页" Style="{StaticResource PageStyle}" xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input">

    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}">

            <StackPanel x:Name="ContentStackPanel">

                <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" Text="主页"/>
                <Button Content="点我" Height="42" Name="button1" Width="119" Click="button1_Click" FontSize="16" FontWeight="Bold" />
                <TextBlock x:Name="ContentText" Style="{StaticResource ContentTextStyle}" Text="主页内容"/>
                <TextBox Height="23" Name="textBox1" Width="120" />
            </StackPanel>

        </ScrollViewer>
    </Grid>

</navigation:Page>

 

Home.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.Navigation;
using System.Windows.Shapes;

namespace SilverlightApplication3
{
    public partial class Home : Page
    {
        public Home()
        {
            InitializeComponent();
        }

        // 当用户导航到此页面时执行。
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            HeaderText.Text = "我的第一个silverlight应用程序!";
            textBox1.Text = DateTime.Now.ToString();
        }
    }
}

 

 

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载