当前位置: 首页 > news >正文

运营网站团队建设/app营销十大成功案例

运营网站团队建设,app营销十大成功案例,滴滴注册网站,做游戏网站的背景图片1.x:Type Type类可作为所有数据类型在编程层面上的抽象。在XAML中,如果想表达某个数据类型时就需要使用x:Type标记拓展。例子: 创建一个Button的派生类: using System; using System.Collections.Generic; using System.Linq; using System.T…

 1.x:Type

 Type类可作为所有数据类型在编程层面上的抽象。在XAML中,如果想表达某个数据类型时就需要使用x:Type标记拓展。例子:

创建一个Button的派生类:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;namespace WpfApplication3
{class MyButton:Button{public Type UserWindowType { get; set; }protected override void OnClick()//是protected,不是public
        {base.OnClick();//激发Click事件Window win = Activator.CreateInstance(this.UserWindowType) as Window;if (win != null){win.ShowDialog();}}}
}
View Code

 

添加一个MyWindow:

<Window x:Class="WpfApplication3.MyWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"WindowStartupLocation="CenterScreen"Title="MyWindow" Height="170" Width="200"><Grid><StackPanel Background="LightBlue"><TextBox Margin="5"></TextBox><TextBox Margin="5"></TextBox><TextBox Margin="5"></TextBox><Button Content="OK" Margin="5"></Button></StackPanel></Grid>
</Window>
View Code

 

再编写MainWindow:

<Window x:Class="WpfApplication3.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local="clr-namespace:WpfApplication3"WindowStartupLocation="CenterScreen"Title="MainWindow" Height="300" Width="300"><!--xmlns:local="clr-namespace:WpfApplication3"引入命名空间WpfApplication3,并映射为local--><Grid><StackPanel><local:MyButton Content="Show" UserWindowType="{x:Type TypeName=local:MyWindow}" Margin="5"></local:MyButton></StackPanel></Grid>
</Window>
View Code

 

2.x:Null

显示地对一个属性赋一个空值

例子:

MainWindow:

<Window x:Class="xNull.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="x:Null Sample" Height="300" Width="300"><Window.Resources><Style x:Key="{x:Type Button}" TargetType="{x:Type Button}"><Setter Property="Width" Value="60"></Setter><Setter Property="Height" Value="36"></Setter><Setter Property="Margin" Value="5"></Setter></Style><!--设置Button控件的默认Style--></Window.Resources><Grid><StackPanel><Button Content="0K"></Button><Button Content="0K"></Button><Button Content="0K"></Button><Button Content="OK" Style="{x:Null}"></Button><!--显示地把Style设置为x:Null了--></StackPanel></Grid>
</Window>
View Code

 

效果:

 

 

3.标记扩展实例的两种声明语法

 上面的例子,可以写成:

<Button Content="OK"><Button.Style><x:Null /></Button.Style>
</Button>

 

这样写,代码显得有些啰嗦,所以为了保持简洁,很少使用这样的写法 

 

4.x:Array

 x:Array的作用就是通过它的Items属性向使用者暴露一个类型已知的ArrayList实例,ArrayList内成员的类型由x:Array的Type指明

例子:

<Window x:Class="xArray.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:sys="clr-namespace:System;assembly=mscorlib"Title="MainWindow" Height="120" Width="160"><!--需要使用String,引入xmlns:sys="clr-namespace:System;assembly=mscorlib"--><Grid><Grid Background="LightBlue"><ListBox Margin="5" ItemsSource=“{x:Array Type=sys:String}”><!--类型为String--></ListBox></Grid></Grid>
</Window>
View Code

 

但如果这样写,是没有数据可以提供的,则改为标签声明语法:

<Window x:Class="xArray.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:sys="clr-namespace:System;assembly=mscorlib"Title="MainWindow" Height="120" Width="160"><!--需要使用String,引入xmlns:sys="clr-namespace:System;assembly=mscorlib"--><Grid><Grid Background="LightBlue"><ListBox Margin="5"><ListBox.ItemsSource><x:Array Type="sys:String"><!--类型为String--><sys:String>Tim</sys:String><sys:String>Tom</sys:String><sys:String>Victor</sys:String></x:Array></ListBox.ItemsSource></ListBox></Grid></Grid>
</Window>
View Code

结果为:

 

 5.x:Static

 在XAML文档中使用数据类型的Static成员

例子:

MainWindow.xaml.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;namespace xStatic
{/// <summary>/// MainWindow.xaml 的交互逻辑/// </summary>public partial class MainWindow : Window{public static string WindowTitle = "高山流水";public static string ShowText { get { return "水落石出"; } }public MainWindow(){InitializeComponent();}}
}
View Code

 

 

MainWindow.xaml

<Window x:Class="xStatic.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local="clr-namespace:xStatic"Title="{x:Static local:MainWindow.WindowTitle}" Height="120" Width="300"><!--把命名空间xStatic映射为local--><!--使用x:Static访问静态成员数据--><Grid><StackPanel><TextBox FontSize="32" Text="{x:Static local:MainWindow.ShowText}"></TextBox><!--使用x:Static访问静态成员数据--></StackPanel></Grid>
</Window>
View Code

 

 结果:

 

6.XAML指令元素

 XAML指令元素有两个:

x:Code

x:XData

1)x:Code的作用是,放置一些本应该放在后置代码中的C#代码。一般不会这样做,这样做,会是代码难以维护、不易于调试

2)x:XData是一个专用标签。如果想在XAML中声明一个带有数据的XmlDataProvider实例,那么XmlDataProvider实例的数据就应该放在x:Data标签的内容里,比如:

<Window.Resources><XmlDataProvider x:Key="InventoryData" XPath="Inventory/Books"><x:XData><Supermarket xmlns=""><Fruits><Fruit Name="Peach"/><Fruit Name="Banana"/><Fruit Name="Orange"/></Fruits><Drinks><Drink Name="Coca Cola"/><Drink Name="PEPSI Cola"/></Drinks></Supermarket>    </x:XData></XmlDataProvider>
</Window.Resources>

 

 

 

 

 

 

 

 

http://www.lbrq.cn/news/1467631.html

相关文章:

  • 企业网站建设注意/营销策略ppt
  • 梅林网站建设/保定网站seo
  • 自己做网站想更换网址/整合营销沟通
  • 阿里企业邮箱客服人工电话/使用 ahrefs 进行 seo 分析
  • 现在哪些做进口商品的电商网站/如何做百度免费推广
  • 网上商城建设方案/哈尔滨优化网站方法
  • 电商网站的支付接入该怎么做呢/seo建站还有市场吗
  • 微商怎么做自己的网站/seo排名工具提升流量
  • 投稿网站源码/推广形式
  • 网站获取访问者qq号码/网站建设报价方案
  • 网站的客服一般怎么做的/网络优化工程师证书
  • 邯郸公司网站建设/淘数据官网
  • 帮忙注册公司要多少钱/seo学校
  • 网站开发到上线需要多久/seo好学吗入门怎么学
  • 网站服务器如何做热备价/云搜索系统
  • 佛山外贸网站建设/键词优化排名
  • 网站推广公司成功的经典案例/seo快速排名优化
  • 网页设计学校网站/seo优化一般包括哪些
  • 关于网站开发的个人小结/人力资源培训与开发
  • 开个捕鱼网站怎么做/免费注册网站有哪些
  • 网站开发实习/三亚百度推广公司电话
  • 学做招投标的网站有哪些/上海小红书seo
  • 深圳网站建设流程/如何建立一个自己的网站啊
  • 蕲春做网站/网络营销理论基础有哪些
  • 建设网站是普通办公吗/windows优化大师是电脑自带的吗
  • j2ee 建设简单网站/推广普通话作文
  • 山东恒昆建设工程有限公司网站/免费有效的推广平台
  • 网站页面设计最宽可做多宽/互联网平台公司有哪些
  • 企业网站怎么优化/定制化网站建设
  • wordpress div属性/快速优化seo软件推广方法
  • 跨语言AI服务指标收集实战
  • MC0364魔法链路
  • 【Django】-4- 数据库存储和管理
  • 前端与后端部署大冒险:Java、Go、C++三剑客
  • U-Net vs. 传统CNN:为什么医学图像分割需要跳过连接?
  • 噪声对比估计(NCE):原理、演进与跨领域应用