• 博客园Logo
  • 会员
  • 周边
  • 捐助
  • 新闻
  • 博问
  • 闪存
  • 赞助商
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 简洁模式 ... 退出登录
    注册 登录
统哥
博客园    首页    新随笔    联系   管理    订阅  订阅

自学Windows Phone 7随笔

自学Windows Phone 开发揭幕篇

      移动开发是趋势,作为程序员应该不断学习,我现在开始自学Windows Phone 7移动开发。其他的不多说了直接开始:

  1、我的开发环境:(http://msdn.microsoft.com/zh-cn/library/ff402535%28v=vs.92%29.aspx)

    *Windows 7 Vdisual Studio 2010 Express for Windows Phone 

           *安装Windows Phone SDK (工具)

           *Windows Phone Emulator (模拟器)也可以使用Windows Phone系统的真机

           *Expression Bleed 、SilverLight、XNA

     2、基本概念:

          *Metro、Zure、XNA、XMAl

     3、创建第一个Windows Phone 应用程序

         先看看模拟器:

         * vs 2010中创建项目

           打开:MainPage.xaml 

            <!--TitlePanel 包含应用程序的名称和页标题-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="我的应用程序" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="  Hello World" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - 在此处放置其他内容-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Button Content="Say Hi" Height="72" HorizontalAlignment="Left" Margin="37,49,0,0" Name="button1" VerticalAlignment="Top" Width="160" Click="button1_Click" />
        </Grid>

         MainPage.xaml .cs

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            PageTitle.Text = "Good morning!";  //标题
            MessageBox.Show("Welcome to Windows Phone 7 application","Message",MessageBoxButton.OK); //信息框
            this.NavigationService.Navigate(new Uri("/Second.xaml", UriKind.Relative));  //页面跳转
        }

        启动调试看效果:

  

    WMAppManifest.xml  中的修改

    1.设置默认启动页面

        <Tasks>
           <DefaultTask  Name ="_default" NavigationPage="MainPage.xaml"/>
        </Tasks>

       2.设置My First PhoneApp的图标 上图红框处

       <IconPath IsRelative="true" IsResource="false">myico.gif</IconPath>

      3.鼠标在My First PhoneApp上点击不放可以设置到Start中显示,BackgroundImageURI 可以设置该程序在Start中显示的图标

       <Tokens>
      <PrimaryToken TokenID="PhoneApp1Token" TaskName="_default">
        <TemplateType5>
          <BackgroundImageURI IsRelative="true" IsResource="false">myBackgroudimg.gif</BackgroundImageURI>
          <Count>0</Count>
          <Title>Welcome</Title>
        </TemplateType5>
      </PrimaryToken>
    </Tokens>

 

      好,第一个Windows Phone应用程序就基本完成了。第一次写博客,文笔和页面布局都不理想,请大家多多原谅,指正。希望跟喜欢Windows Phone的高手们多多交流。 续。。。

 

       

posted @ 2012-02-18 14:28  统哥  阅读(1535)  评论(5)  编辑  收藏  举报
会员力量,点亮园子希望
刷新页面返回顶部
Copyright © 2024 统哥
Powered by .NET 8.0 on Kubernetes