葡京在线开户三思而行Silverlight(34) – 三.0控件之Frame, Page, Label, DescriptionViewer, ValidationSummary

逆天SQL Server
二〇一二装的不要不要的,最终发现。。。竟然没帮助文书档案。。。汗啊!原来它跟vs同样要协调装扶助文书档案。。。

[索引页]
[源码下载]

好吧,官方网站一下载,妹的。。。报错。。。然后就让大家还原那一个装置进程以及逆天是怎么排错的呢。。。
1、去官方网址上下载离线包(http://www.microsoft.com/zh-cn/download/details.aspx?id=347
葡京在线开户 1 
二、解压离线包–Unzip
葡京在线开户 2

多加商量Silverlight(3四) – 3.0控件之Frame, Page, Label,
DescriptionViewer, ValidationSummary

3、张开SQL Server 2013 采纳管理支持设置
葡京在线开户 3
四、采用磁盘安装内容 
葡京在线开户 4

作者:webabcd

5、选取刚刚的解压路线并选择X.msha文件
葡京在线开户 5

介绍
Silverlight 3.0 控件1览:

陆、真的怎么归纳吗?那要自小编何用?哈哈,邪恶的笑了~~~

  • Frame – 与 Page 控件结合使用,从而达成导航功效(能够经过实现 Deep
    Linking)
  • Page – 与 Frame 控件结合使用
  • Label – 比 TextBlock 作用多1些,能够用来对不当的辨证消息做提醒
  • DescriptionViewer – 鼠标经过时的提示新闻 
  • ValidationSummary – 汇总展现验证错误的音信 

葡京在线开户 6

在线DEMO
http://www.cnblogs.com/webabcd/archive/2009/08/04/1538238.html

柒、我们来查看查看(显明是X.msha文件出现难题)
葡京在线开户 7

示例
壹、Frame 控件的应用演示。其得以导航 Page,能够做url映射
Frame.xaml

八、上边大家展开看壹看瞧1瞧~~ 
葡京在线开户 8

葡京在线开户 9<navigation:Page x:Class=”Silverlight30.Control.Frame” 
葡京在线开户 10           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”  
葡京在线开户 11           xmlns:uriMapper=”clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation”
葡京在线开户 12           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
葡京在线开户 13           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
葡京在线开户 14           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
葡京在线开户 15           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
葡京在线开户 16           mc:Ignorable=”d”
葡京在线开户 17           d:DesignWidth=”640″ d:DesignHeight=”480″
葡京在线开户 18           Title=”Frame Page”>
葡京在线开户 19    <Grid x:Name=”LayoutRoot”>
葡京在线开户 20        
葡京在线开户 21        <StackPanel HorizontalAlignment=”Left”>
葡京在线开户 22            <Border BorderBrush=”Gray” BorderThickness=”3″ Padding=”10″>
葡京在线开户 23            
葡京在线开户 24                <!–
葡京在线开户 25                    Frame – 与 Page 控件结合使用,从而落成导航作用(能够经过落成 Deep Linking)
葡京在线开户 26                    Source – 须求在 Frame 中显得的 Page 的地点
葡京在线开户 27                    JournalOwnership – 导航日志的记录方式 [System.Windows.Navigation.JournalOwnership 枚举]
葡京在线开户 28                        Automatic – 假若 Frame 是最顶尖的 Frame,则在浏览器端记录导航日志,不然由此 Frame 自行记录
葡京在线开户 29                        OwnsJournal – 自行记录
葡京在线开户 30                        UsesParentJournal – 当 Frame 是最一级的 Frame 时,由浏览器记录。倘诺是非拔尖 Frame 的话,则会抛出尤其
葡京在线开户 31                    UriMapper – Uri 映射器。能够在其内编写制定映射规则
葡京在线开户 32                    UriMapping – 具体的炫彩规则(在 System.Windows.Navigation 命名空间下)
葡京在线开户 33                        如本例正是把看似 Silverlight30TestPage.aspx#/Control/Page德姆o 的地址映射到近似 Silverlight30TestPage.aspx#/Control/PageDemo.xaml 的地址
葡京在线开户 34                –>            
葡京在线开户 35                <navigation:Frame x:Name=”frame” Source=”/Control/PageDemo” JournalOwnership=”OwnsJournal”>
葡京在线开户 36                    <navigation:Frame.Content>
葡京在线开户 37                        <TextBlock Text=”我是 Frame 的 Content” />
葡京在线开户 38                    </navigation:Frame.Content>
葡京在线开户 39                    <navigation:Frame.UriMapper>
葡京在线开户 40                        <uriMapper:UriMapper>
葡京在线开户 41                            <uriMapper:UriMapping Uri=”/{address}” MappedUri=”/{address}.xaml”/>
葡京在线开户 42                        </uriMapper:UriMapper>
葡京在线开户 43                    </navigation:Frame.UriMapper>
葡京在线开户 44                </navigation:Frame>
葡京在线开户 45            </Border>
葡京在线开户 46            <Button x:Name=”navigateToPageDemo” Content=”链接到 PageDemo” Click=”navigateToPageDemo_Click” Width=”200″ />
葡京在线开户 47            <Button x:Name=”navigateToPageDemo2″ Content=”链接到 PageDemo2″ Click=”navigateToPageDemo2_Click” Width=”200″ />
葡京在线开户 48        </StackPanel>
葡京在线开户 49        
葡京在线开户 50    </Grid>
葡京在线开户 51</navigation:Page>
葡京在线开户 52

九、 再尝试看
葡京在线开户 53 

Frame.xaml.cs

10、更新吧~~哦耶 
葡京在线开户 54 

葡京在线开户 55using System;
葡京在线开户 56using System.Collections.Generic;
葡京在线开户 57using System.Linq;
葡京在线开户 58using System.Net;
葡京在线开户 59using System.Windows;
葡京在线开户 60using System.Windows.Controls;
葡京在线开户 61using System.Windows.Documents;
葡京在线开户 62using System.Windows.Input;
葡京在线开户 63using System.Windows.Media;
葡京在线开户 64using System.Windows.Media.Animation;
葡京在线开户 65using System.Windows.Shapes;
葡京在线开户 66using System.Windows.Navigation;
葡京在线开户 67
葡京在线开户 68namespace Silverlight30.Control
葡京在线开户 69葡京在线开户 70葡京在线开户 71{
葡京在线开户 72    public partial class Frame : Page
葡京在线开户 73葡京在线开户 74    葡京在线开户 75{
葡京在线开户 76        public Frame()
葡京在线开户 77葡京在线开户 78        葡京在线开户 79{
葡京在线开户 80            InitializeComponent();
葡京在线开户 81        }
葡京在线开户 82
葡京在线开户 83        private void navigateToPageDemo_Click(object sender, RoutedEventArgs e)
葡京在线开户 84葡京在线开户 85        葡京在线开户 86{
葡京在线开户 87葡京在线开户 88            /**//*
葡京在线开户 89             * Navigate() – 导航到钦定的 Uri 地址
葡京在线开户 90             * CanGoBack – 是不是可后退
葡京在线开户 91             * CanGoForward – 是不是可提升
葡京在线开户 92             * GoBack() – 后退
葡京在线开户 93             * GoForward() – 前进
葡京在线开户 94             */
葡京在线开户 95            
葡京在线开户 96            frame.Navigate(new Uri(“/Control/PageDemo”, UriKind.Relative));
葡京在线开户 97        }
葡京在线开户 98
葡京在线开户 99        private void navigateToPageDemo2_Click(object sender, RoutedEventArgs e)
葡京在线开户 100葡京在线开户 101        葡京在线开户 102{
葡京在线开户 103            frame.Navigate(new Uri(“/Control/PageDemo2”, UriKind.Relative));
葡京在线开户 104        }
葡京在线开户 105    }
葡京在线开户 106}
葡京在线开户 107

11、最后一步(重点啊,不然你装好后还感觉本身骗你呢,哈哈)

二、Page 控件的施用演示。在 Page 间做导航,以及中间的参数字传送递
PageDemo.xaml

葡京在线开户 108

葡京在线开户 109<navigation:Page x:Class=”Silverlight30.Control.PageDemo” 
葡京在线开户 110           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
葡京在线开户 111           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
葡京在线开户 112           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
葡京在线开户 113           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
葡京在线开户 114           mc:Ignorable=”d”
葡京在线开户 115           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
葡京在线开户 116           d:DesignWidth=”640″ d:DesignHeight=”480″
葡京在线开户 117           Title=”PageDemo Page”>
葡京在线开户 118    <Grid x:Name=”LayoutRoot”>
葡京在线开户 119        <StackPanel>
葡京在线开户 120            <TextBlock Text=”我是 PageDemo” />
葡京在线开户 121            <Button Content=”链接到 PageDemo2″ Click=”Button_Click” />
葡京在线开户 122            <TextBlock x:Name=”lblMsg” />
葡京在线开户 123        </StackPanel>
葡京在线开户 124    </Grid>
葡京在线开户 125</navigation:Page>
葡京在线开户 126

选拔使用本地扶助(暗中同意是在线支持)

PageDemo.xaml.cs

葡京在线开户 127

葡京在线开户 128using System;
葡京在线开户 129using System.Collections.Generic;
葡京在线开户 130using System.Linq;
葡京在线开户 131using System.Net;
葡京在线开户 132using System.Windows;
葡京在线开户 133using System.Windows.Controls;
葡京在线开户 134using System.Windows.Documents;
葡京在线开户 135using System.Windows.Input;
葡京在线开户 136using System.Windows.Media;
葡京在线开户 137using System.Windows.Media.Animation;
葡京在线开户 138using System.Windows.Shapes;
葡京在线开户 139using System.Windows.Navigation;
葡京在线开户 140
葡京在线开户 141namespace Silverlight30.Control
葡京在线开户 142葡京在线开户 143葡京在线开户 144{
葡京在线开户 145    public partial class PageDemo : Page
葡京在线开户 146葡京在线开户 147    葡京在线开户 148{
葡京在线开户 149        public PageDemo()
葡京在线开户 150葡京在线开户 151        葡京在线开户 152{
葡京在线开户 153            InitializeComponent();
葡京在线开户 154        }
葡京在线开户 155
葡京在线开户 156        // 当用户导航至此控件时,会调用如下方法
葡京在线开户 157        protected override void OnNavigatedTo(NavigationEventArgs e)
葡京在线开户 158葡京在线开户 159        葡京在线开户 160{
葡京在线开户 161葡京在线开户 162            /**//*
葡京在线开户 163             * NavigationService – 在 Page 控件中做导航的类
葡京在线开户 164             * NavigationContext – 导航的上下文,其 QueryString 属性可用以获取导航参数
葡京在线开户 165             * Navigation伊夫ntArgs.Uri – 当前导航地址
葡京在线开户 166             */
葡京在线开户 167
葡京在线开户 168            lblMsg.Text += “当前的导航地址:” + e.Uri.ToString() + “\n”;
葡京在线开户 169
葡京在线开户 170            if (this.NavigationContext.QueryString.ContainsKey(“param1”))
葡京在线开户 171                lblMsg.Text += “参数1:” + NavigationContext.QueryString[“param1”] + “\n”;
葡京在线开户 172            if (this.NavigationContext.QueryString.ContainsKey(“param2”))
葡京在线开户 173                lblMsg.Text += “参数2:” + NavigationContext.QueryString[“param2”];
葡京在线开户 174        }
葡京在线开户 175
葡京在线开户 176        private void Button_Click(object sender, RoutedEventArgs e)
葡京在线开户 177葡京在线开户 178        葡京在线开户 179{
葡京在线开户 180            if (((System.Windows.Controls.Frame)this.Parent).UriMapper == null)
葡京在线开户 181                NavigationService.Navigate(new Uri(“/Control/PageDemo2.xaml”, UriKind.Relative));
葡京在线开户 182            else
葡京在线开户 183                NavigationService.Navigate(new Uri(“/Control/PageDemo2”, UriKind.Relative));
葡京在线开户 184        }
葡京在线开户 185    }
葡京在线开户 186}
葡京在线开户 187

12、查查看~【小秘技:要查什么,选中你要查的按F一】

PageDemo2.xaml

葡京在线开户 188

葡京在线开户 189<navigation:Page x:Class=”Silverlight30.Control.PageDemo2″ 
葡京在线开户 190           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
葡京在线开户 191           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
葡京在线开户 192           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
葡京在线开户 193           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
葡京在线开户 194           mc:Ignorable=”d”
葡京在线开户 195           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
葡京在线开户 196           d:DesignWidth=”640″ d:DesignHeight=”480″
葡京在线开户 197           Title=”PageDemo2 Page”>
葡京在线开户 198    <Grid x:Name=”LayoutRoot”>
葡京在线开户 199        <StackPanel>
葡京在线开户 200            <TextBlock Text=”我是 PageDemo2″ />
葡京在线开户 201            <Button Content=”链接到 PageDemo” Click=”Button_Click” />
葡京在线开户 202        </StackPanel>
葡京在线开户 203    </Grid>
葡京在线开户 204</navigation:Page>
葡京在线开户 205

PageDemo2.xaml.cs

葡京在线开户 206using System;
葡京在线开户 207using System.Collections.Generic;
葡京在线开户 208葡京在线开户,using System.Linq;
葡京在线开户 209using System.Net;
葡京在线开户 210using System.Windows;
葡京在线开户 211using System.Windows.Controls;
葡京在线开户 212using System.Windows.Documents;
葡京在线开户 213using System.Windows.Input;
葡京在线开户 214using System.Windows.Media;
葡京在线开户 215using System.Windows.Media.Animation;
葡京在线开户 216using System.Windows.Shapes;
葡京在线开户 217using System.Windows.Navigation;
葡京在线开户 218
葡京在线开户 219namespace Silverlight30.Control
葡京在线开户 220葡京在线开户 221葡京在线开户 222{
葡京在线开户 223    public partial class PageDemo2 : Page
葡京在线开户 224葡京在线开户 225    葡京在线开户 226{
葡京在线开户 227        public PageDemo2()
葡京在线开户 228葡京在线开户 229        葡京在线开户 230{
葡京在线开户 231            InitializeComponent();
葡京在线开户 232        }
葡京在线开户 233
葡京在线开户 234        private void Button_Click(object sender, RoutedEventArgs e)
葡京在线开户 235葡京在线开户 236        葡京在线开户 237{
葡京在线开户 238            if (((System.Windows.Controls.Frame)this.Parent).UriMapper == null)
葡京在线开户 239                NavigationService.Navigate(new Uri(“/Control/PageDemo.xaml?param1=param1&param2=param2”, UriKind.Relative));
葡京在线开户 240            else
葡京在线开户 241                NavigationService.Navigate(new Uri(“/Control/PageDemo?param1=param1&param2=param2”, UriKind.Relative));
葡京在线开户 242        }
葡京在线开户 243    }
葡京在线开户 244}
葡京在线开户 245

3、演示 Label 控件
Label.xaml

葡京在线开户 246<navigation:Page xmlns:dataInput=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input”  x:Class=”Silverlight30.Control.Label” 
葡京在线开户 247           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
葡京在线开户 248           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
葡京在线开户 249           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
葡京在线开户 250           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
葡京在线开户 251           mc:Ignorable=”d”
葡京在线开户 252           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
葡京在线开户 253           d:DesignWidth=”640″ d:DesignHeight=”480″
葡京在线开户 254           Title=”Label Page”>
葡京在线开户 255    <Grid x:Name=”LayoutRoot”>
葡京在线开户 256        <StackPanel>
葡京在线开户 257        
葡京在线开户 258            <!–Label 控件的以身作则–>
葡京在线开户 259            <dataInput:Label Content=”我是 Label” Foreground=”White”>
葡京在线开户 260                <dataInput:Label.Background>
葡京在线开户 261                    <LinearGradientBrush StartPoint=”0,0″ EndPoint=”1,1″>
葡京在线开户 262                        <GradientStop Color=”Red” Offset=”0″ />
葡京在线开户 263                        <GradientStop Color=”Green” Offset=”0.5″ />
葡京在线开户 264                        <GradientStop Color=”Blue” Offset=”1″ />
葡京在线开户 265                    </LinearGradientBrush>
葡京在线开户 266                </dataInput:Label.Background>
葡京在线开户 267            </dataInput:Label>
葡京在线开户 268
葡京在线开户 269        </StackPanel>
葡京在线开户 270    </Grid>
葡京在线开户 271</navigation:Page>
葡京在线开户 272

4、演示 DescriptionViewer 控件
DescriptionViewer.xaml

葡京在线开户 273<navigation:Page xmlns:dataInput=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input”  x:Class=”Silverlight30.Control.DescriptionViewer” 
葡京在线开户 274           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
葡京在线开户 275           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
葡京在线开户 276           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
葡京在线开户 277           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
葡京在线开户 278           mc:Ignorable=”d”
葡京在线开户 279           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
葡京在线开户 280           d:DesignWidth=”640″ d:DesignHeight=”480″
葡京在线开户 281           Title=”DescriptionViewer Page”>
葡京在线开户 282    <Grid x:Name=”LayoutRoot”>
葡京在线开户 283        <StackPanel Margin=”10″>
葡京在线开户 284        
葡京在线开户 285            <!–
葡京在线开户 286                Description – 鼠标经过时的提示音讯
葡京在线开户 287                GlyphTemplate – 展现提醒新闻的Logo部分的外观
葡京在线开户 288            –>
葡京在线开户 289            <dataInput:DescriptionViewer Description=”设置 DescriptionViewer 的 Description 属性” />
葡京在线开户 290            
葡京在线开户 291        </StackPanel>
葡京在线开户 292    </Grid>
葡京在线开户 293</navigation:Page>
葡京在线开户 294

伍、ValidationSummary, Label, DescriptionViewer
的咬合使用,达成数传说明的 UI 部分。验证的逻辑部分由
System.ComponentModel.DataAnnotations 达成
EmployeeModel.cs

葡京在线开户 295葡京在线开户 296/**//*
葡京在线开户 297 * Silverlight 协理 System.ComponentModel.DataAnnotations 格局的数目表明。同样协理该数额证实的还有 Dynamic Data, asp.net mvc 二
葡京在线开户 298 */
葡京在线开户 299
葡京在线开户 300using System;
葡京在线开户 301using System.Net;
葡京在线开户 302using System.Windows;
葡京在线开户 303using System.Windows.Controls;
葡京在线开户 304using System.Windows.Documents;
葡京在线开户 305using System.Windows.Ink;
葡京在线开户 306using System.Windows.Input;
葡京在线开户 307using System.Windows.Media;
葡京在线开户 308using System.Windows.Media.Animation;
葡京在线开户 309using System.Windows.Shapes;
葡京在线开户 310
葡京在线开户 311using System.ComponentModel.DataAnnotations;
葡京在线开户 312
葡京在线开户 313namespace Silverlight30.Model
葡京在线开户 314葡京在线开户 315葡京在线开户 316{
葡京在线开户 317    public class EmployeeModel
葡京在线开户 318葡京在线开户 319    葡京在线开户 320{
葡京在线开户 321        private string _name;
葡京在线开户 322        [Display(Name = “名字”, Description = “必填字段”)]
葡京在线开户 323        [Required(ErrorMessage=”名字必填”)]
葡京在线开户 324        public string Name
葡京在线开户 325葡京在线开户 326        葡京在线开户 327{
葡京在线开户 328葡京在线开户 329            get 葡京在线开户 330{ return _name; }
葡京在线开户 331            set
葡京在线开户 332葡京在线开户 333            葡京在线开户 334{
葡京在线开户 335葡京在线开户 336                /**//*
葡京在线开户 337                 * Validator.ValidateProperty() – 用于决定钦定的习性是或不是由此了评释(遵照属性的 DataAnnotations 的 Attribute 做判别)。以及当其并未有通过认证时,抛出10分
葡京在线开户 338                 */
葡京在线开户 339葡京在线开户 340                Validator.ValidateProperty(value, new ValidationContext(this, null, null) 葡京在线开户 341{ MemberName = “Name” });
葡京在线开户 342                _name = value;
葡京在线开户 343            }
葡京在线开户 344        }
葡京在线开户 345
葡京在线开户 346        private double _salary;
葡京在线开户 347        [Display(Name=”薪金”, Description=”薪酬介于 0 – 一千0 之间”)]
葡京在线开户 348        [Range(0,10000)]
葡京在线开户 349        public double Salary
葡京在线开户 350葡京在线开户 351        葡京在线开户 352{
葡京在线开户 353葡京在线开户 354            get 葡京在线开户 355{ return _salary; }
葡京在线开户 356            set
葡京在线开户 357葡京在线开户 358            葡京在线开户 359{
葡京在线开户 360葡京在线开户 361                Validator.ValidateProperty(value, new ValidationContext(this, null, null) 葡京在线开户 362{ MemberName = “Salary” });
葡京在线开户 363                _salary = value;
葡京在线开户 364            }
葡京在线开户 365        }
葡京在线开户 366
葡京在线开户 367葡京在线开户 368        public DateTime DateOfBirty 葡京在线开户 369{ get; set; }
葡京在线开户 370    }
葡京在线开户 371}
葡京在线开户 372

ValidationSummary.xaml

葡京在线开户 373<navigation:Page xmlns:dataInput=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input”  x:Class=”Silverlight30.Control.ValidationSummary” 
葡京在线开户 374           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
葡京在线开户 375           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
葡京在线开户 376           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
葡京在线开户 377           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
葡京在线开户 378           mc:Ignorable=”d”
葡京在线开户 379           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
葡京在线开户 380           d:DesignWidth=”640″ d:DesignHeight=”480″
葡京在线开户 381           Title=”ValidationSummary Page”>
葡京在线开户 382    <Grid x:Name=”LayoutRoot”>
葡京在线开户 383        <StackPanel>
葡京在线开户 384
葡京在线开户 385            <StackPanel x:Name=”employee”>
葡京在线开户 386                <StackPanel Orientation=”Horizontal”>
葡京在线开户 387
葡京在线开户 388                    <!–
葡京在线开户 389                        Label – 能够用来对错误的表明音讯做提醒。暗中认可为将文件变为日光黄
葡京在线开户 390                        DescriptionViewer – 其 Description 属性能够自动绑定到钦点属性的 Display 天性上
葡京在线开户 391                        Target – 关联的对象,以对相应的元数据(metadata)做提示
葡京在线开户 392                        PropertyPath – 所涉嫌的靶子的钦命的字段
葡京在线开户 393                    –>
葡京在线开户 394
葡京在线开户 395                    <dataInput:Label Target=”{Binding ElementName=name}” />
葡京在线开户 396                    <TextBox x:Name=”name” Text=”{Binding Name, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}” />
葡京在线开户 397                    <dataInput:DescriptionViewer Target=”{Binding ElementName=employee}” PropertyPath=”Name” />
葡京在线开户 398                    
葡京在线开户 399                </StackPanel>
葡京在线开户 400                <StackPanel Orientation=”Horizontal”>
葡京在线开户 401                
葡京在线开户 402                    <dataInput:Label Target=”{Binding ElementName=salary}” />
葡京在线开户 403                    <TextBox x:Name=”salary” Text=”{Binding Salary, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}” />
葡京在线开户 404                    <dataInput:DescriptionViewer Target=”{Binding ElementName=employee}” PropertyPath=”Salary” />
葡京在线开户 405                    
葡京在线开户 406                </StackPanel>
葡京在线开户 407            </StackPanel>
葡京在线开户 408
葡京在线开户 409            <!–
葡京在线开户 410                ValidationSummary – 汇总显示验证错误的消息
葡京在线开户 411                SummaryListBoxStyle – 呈现汇总错误音讯的 ListBox 控件的体裁
葡京在线开户 412            –>
葡京在线开户 413            <dataInput:ValidationSummary />
葡京在线开户 414
葡京在线开户 415        </StackPanel>
葡京在线开户 416    </Grid>
葡京在线开户 417</navigation:Page>
葡京在线开户 418

ValidationSummary.xaml.cs

葡京在线开户 419using System;
葡京在线开户 420using System.Collections.Generic;
葡京在线开户 421using System.Linq;
葡京在线开户 422using System.Net;
葡京在线开户 423using System.Windows;
葡京在线开户 424using System.Windows.Controls;
葡京在线开户 425using System.Windows.Documents;
葡京在线开户 426using System.Windows.Input;
葡京在线开户 427using System.Windows.Media;
葡京在线开户 428using System.Windows.Media.Animation;
葡京在线开户 429using System.Windows.Shapes;
葡京在线开户 430using System.Windows.Navigation;
葡京在线开户 431
葡京在线开户 432using Silverlight30.Model;
葡京在线开户 433
葡京在线开户 434namespace Silverlight30.Control
葡京在线开户 435葡京在线开户 436葡京在线开户 437{
葡京在线开户 438    public partial class ValidationSummary : Page
葡京在线开户 439葡京在线开户 440    葡京在线开户 441{
葡京在线开户 442        public ValidationSummary()
葡京在线开户 443葡京在线开户 444        葡京在线开户 445{
葡京在线开户 446            InitializeComponent();
葡京在线开户 447
葡京在线开户 448            this.Loaded += new RoutedEventHandler(ValidationSummary_Loaded);
葡京在线开户 449        }
葡京在线开户 450
葡京在线开户 451        void ValidationSummary_Loaded(object sender, RoutedEventArgs e)
葡京在线开户 452葡京在线开户 453        葡京在线开户 454{
葡京在线开户 455葡京在线开户 456            this.DataContext = new EmployeeModel() 葡京在线开户 457{ Name = “webabcd”, Salary = 0 };
葡京在线开户 458        }
葡京在线开户 459    }
葡京在线开户 460}
葡京在线开户 461

OK
[源码下载]