x:Type
来源:互联网 发布:人体工学椅有用吗 知乎 编辑:程序博客网 时间:2024/06/07 13:23
//MyButton.csusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;namespace WpfApplication1{ class MyButton : Button { public Type UserWindowType { get; set; } protected override void OnClick() { base.OnClick(); Window win = Activator.CreateInstance(this.UserWindowType) as Window; if (null != win) { win.ShowDialog(); } } }}
<!--Window1.xaml--><Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <StackPanel Background="LightBlue"> <TextBox Margin="5"/> <TextBox Margin="5"/> <TextBox Margin="5"/> <Button Content="OK" Margin="5"/> </StackPanel></Window>
<!--MainWindow.xaml--><Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication1" Title="MainWindow" Height="350" Width="525"> <StackPanel> <local:MyButton Content="Show" UserWindowType="{x:Type TypeName=local:Window1}" Margin="5"/> </StackPanel></Window>
阅读全文
1 0
- x:Type
- typecheck(type,x) 作用
- typecheck(type,x) 作用
- X-Content-Type-Options
- AFNetworking -unacceptable content-type: x x x
- Convert from type X to type Y
- WPF(x:Type的使用)
- Convert from type X to type Y in JAVA
- x++ Find Folder and File Type
- Content-Type not allowed ** image/x-png
- Content-Type: application/x-www-form-urlencoded
- an old MIME type Application/x-csv
- QEvent::Type 比照X的事件
- QEvent::Type 比照X的事件
- elasticsearch 5.x删除index/type
- x 命名空间中x:Type 的使用
- MySQL改变数据类型的函数CAST(x AS type)和CONVERT(x,type)
- X名称空间的特性(Attribute)x:key和x:type
- 8.8test
- UVA
- gitlab pipelines job执行时日志较大报错
- angular modalInstance模态框
- JS学习-字符串
- x:Type
- c#简单教程1
- Java图像验证码识别算法
- ORACLE锁分类
- leetcode--Excel Sheet Column Title
- 测试文章
- iOS发送crash崩溃日志报告
- 在代码中,动态修改图片颜色
- 5.bootstrap入门