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的更多相关文章
随机推荐
- [Angular 2] Passing data to components with @Input
@Input allows you to pass data into your controller and templates through html and defining custom p ...
- Android(java)学习笔记245:ContentProvider使用(银行数据库创建和增删改查的案例)
1. Android的四大组件: (1)Activity 用户交互的UI界面 (2)Service 后台运行的服务 (3)BroadcastReceiver 广播接收者 (4)ContentPro ...
- lvs+heartbeat搭建负载均衡高可用集群
[172.25.48.1]vm1.example.com [172.25.48.4]vm4.example.com 集群依赖软件:
- Spring框架
Spring框架的根本使命是:简化JAVA开发,为了简化开发,有以下四个策略 基于POJO的轻量级和最小侵入性编程: 通过依赖注入和面向接口实现松耦合: 基于切面和惯性进行声明式编程: 通过切面和模板 ...
- Directive Definition Object
不知道为什么这个我并没有想翻译过来的欲望,或许我并没有都看熟透,不好误人子弟,原版奉上. Here's an example directive declared with a Directive D ...
- YII数据库增删查改操作
初学YII, 整理了一些YII数据库的相关操作, 共同学习,共同进步. 一.查询数据集合 //1.该方法是根据一个条件查询一个集合 $admin=Admin::model()->findAll ...
- c - 折半查找(二分法检索)
#include <stdio.h> #define LEN 10 /* 折半查找(二分法检索). */ int index_of(int *a, int k) { ; ; int m; ...
- [转] iOS SDK:iOS调试技巧
原文: http://www.cocoachina.com/ios/20130517/6225.html 为什么你的数组包含3个项目而不是5个?为什么你的游戏运行缓慢?这些都跟调试有关,调试是开发过 ...
- NSUserDefaults 很详细的介绍使用(转发)
http://my.oschina.net/u/1245365/blog/294449
- Qt信号槽连接在有默认形参下的情况思考
写下这个给自己备忘,比如函数 ) 你在调用端如论是test(3)或者test(),都可以正确调用到这个函数. 但是,如果放到Qt中的信号槽的话,这个还是值得讲一讲的,不然的话,可能会引起相应的误会. ...