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的更多相关文章
随机推荐
- S2SH框架集成详解(Struts 2.3.16 + Spring 3.2.6 + Hibernate 3.6.10)
近期集成了一次较新版本的s2sh,出现了不少问题,网上资料也是良莠不齐,有的甚至就是扯淡,简单的把jar包扔进去就以为是集成成功了,在这里整理一下详细的步骤,若哪位有什么不同看法,可以留言,欢迎批评改 ...
- xeam Build Definition Extension uninstall 卸载
之前在VS上装了Build definition 的扩展,后来发现很不好用,想卸载掉,就增 工具下面找add-in manager, 结果找不到,external tools下面也找不到, googl ...
- 设置listview的header不能点击
View headView = inflater.inflate(R.layout.search_top, null); mListView.addHeaderView(headView ,null, ...
- codevs 1515 跳
/* 画矩阵找规律发现是杨辉三角 Cg (i,j)= C (i+j,i); 贪心走的话 沿着0行(列)一直走然后拐直角 拐弯后每个格子都累加 Cg (n,0) + Cg (n,1) + Cg (n,2 ...
- Ext4.1 grid 多选(可无checkbox)
转载 在Ext4.1中的grid默认只能实现单选的. 如果你想要你的grid有多选功能,需要给grid增加selModel 如果你使用了Ext.create('Ext.selection.Checkb ...
- windows 8.1 administrator相关设置
一.windows 8.1 开启administrator用户 windows8.1中文版,由于默认不开启administrator用户,所以需要自己手动开启 启用administrator:在cmd ...
- Swift - 31 - 常量参数, 变量参数和inout参数
//: Playground - noun: a place where people can play import UIKit // swift中默认情况下, 传入的参数是不可以修改的, 也就是l ...
- Swift - 02 - 常量和变量
//: Playground - noun: a place where people can play import UIKit var str = "Hello, playground& ...
- RSA PKCS1padding 填充模式
在BouncyCastle实现RSA的PKCS1V1.5模式中,如果是公钥加密信息(forEncryption=true),密钥长度为1024位,那么输出的密文块长度为128个字节,输入的明文块长度为 ...
- cas配置全攻略(转)
转:http://www.blogjava.net/tufanshu/archive/2011/01/21/343290.html 经过将近两天的测试,参考众多网友的贡献,终于完成了对cas的主要配置 ...