HelloSilverlight
一:输入姓名并选中一个日期,将在下面显示

二:XAML代码
<UserControl x:Class="HelloSilverlight.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:DesignHeight="" d:DesignWidth="" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"> <Grid x:Name="LayoutRoot" Background="Beige" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition Height=""/>
<RowDefinition Height=""/>
<RowDefinition Height=""/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="" />
<ColumnDefinition Width=""/>
</Grid.ColumnDefinitions>
<TextBlock Text="姓名:" Grid.Row="" Grid.Column=""></TextBlock>
<TextBlock Text="日期:" Grid.Row="" Grid.Column=""></TextBlock>
<TextBlock x:Name="message1" Text="消息:" Grid.Row="" Grid.Column=""
Grid.ColumnSpan=""></TextBlock>
<TextBox x:Name="name1" Text="你的名字" Grid.Row="" Grid.Column=""
Width="" HorizontalAlignment="Left"></TextBox>
<StackPanel Grid.Column="" Grid.Row="" Orientation="Vertical">
<sdk:Calendar x:Name="cal1" SelectionMode="SingleDate" HorizontalAlignment="Left"></sdk:Calendar>
<Button Click="Button_Click" x:Name="OKbutton" Width="" Height=""
HorizontalAlignment="Left" Content="显示"></Button>
</StackPanel>
</Grid>
</UserControl>
后台代码:
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 HelloSilverlight
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
} #region 显示事件
private void Button_Click(object sender, RoutedEventArgs e)
{
string dateString;
if (cal1.SelectedDate == null)
{
dateString = "请选择一个日期!";
}
else
{
dateString = cal1.SelectedDate.ToString();
}
message1.Text = "你好! " + name1.Text + "\n" +
"选择的日期是: " + dateString;
}
#endregion
}
}
HelloSilverlight的更多相关文章
随机推荐
- Java 删除当前文件夹及其文件夹下的全部文件
删除文件夹2以下的全部文件及其文件夹 演示样例文件夹例如以下:D:/test/1/2 1.使用FileUtils类.静默删除 String url = "D:/test/1/2"; ...
- ScriptManager的使用方法
脚本管理控件(ScriptManger)是ASP.NET AJAX中很重要的控件,通过使用ScriptManger可以进行整个页面的局部更新的管理.ScriptManger用来处理页面上局部更新,同一 ...
- jboss7 Java API for RESTful Web Services (JAX-RS) 官方文档
原文:https://docs.jboss.org/author/display/AS7/Java+API+for+RESTful+Web+Services+(JAX-RS) Content Tuto ...
- xcode中的第三方库配置问题总结
xcode中的第三方库配置总结 在导入第三方库的时候,总是会遇到许多的问题.在这里,我记录一下学到的一些知识点.写得比较乱.只要是想要记录下来,在第三方库导入的时候,遇到的一些问题. 参考网址: ht ...
- JDK5-自动拆装箱
拆装箱:在基本类型与其对应的引用类型之间转换 装箱:Integer iObj = 5; 拆箱:int i = 5 + iObj; 装箱时,一个字节以内的数据在一个常量池中(小整数的使用频率高),即-1 ...
- 移动Web开发技巧
META相关 1. 添加到主屏后的标题(IOS) <meta name="apple-mobile-web-app-title" content="标题" ...
- apple
you are the apple of my eye
- 【Usaco2008 Mar】土地购买
[题目描述] 农夫John准备扩大他的农场,他正在考虑N (1 <= N <= 50,000) 块长方形的土地. 每块土地的长宽满足(1 <= 宽 <= 1,000,000; ...
- jQuery图片滑动
一个非常简单实用的jQuery插件 可以用在页面的顶部广告展示 http://slidesjs.com/ 一个需要注意的问题, 就是在手机等客户端(IOS8以上), 使用此插件时, 经常会触发插件的r ...
- Json处理函数json_encode json_decode
json_decode — 对 JSON 格式的字符串进行编码 mixed json_decode ( string $json [, bool $assoc = false [, int $dept ...