WPF Demo10 嵌套Winform、RadGridView、
<Window x:Class="控件Demo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="控件学习" Height="350" Width="525"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<Grid ShowGridLines="True">
<Menu HorizontalAlignment="Left" Name="menu1" VerticalAlignment="Top" IsMainMenu="True" ItemsSource="{Binding}" Background="#00000000">
<MenuItem Header="文件">
<MenuItem Header="Copy" Click="MenuItem_Click"/>
<MenuItem Header="Cut" />
<MenuItem Header="Paste" />
</MenuItem>
<MenuItem Header="帮助" StaysOpenOnClick="True">
<MenuItem Header="About" />
</MenuItem>
</Menu>
<Expander Header="expander1" Height="100" HorizontalAlignment="Left" Margin="48,76,0,0" Name="expander1" VerticalAlignment="Top">
<Expander.ContextMenu>
<ContextMenu>
<MenuItem Header="删除" />
<MenuItem Header="添加" />
</ContextMenu>
</Expander.ContextMenu>
<Grid ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
</Grid>
</Expander>
<StatusBar HorizontalAlignment="Left" Name="statusBar1" VerticalAlignment="Bottom" Background="#00000000">
<StatusBarItem HorizontalAlignment="Left" Content="公有N个测试项,当前正在测试N-2项" />
</StatusBar>
<ToolBar HorizontalAlignment="Left" Margin="0,27,0,0" Name="toolBar1" VerticalAlignment="Top" >
<Button Content="btnTest"/>
<Label Content="lblTest"/>
<ComboBox SelectedIndex="0">
<ComboBoxItem>100%</ComboBoxItem>
<ComboBoxItem>150%</ComboBoxItem>
<ComboBoxItem>200%</ComboBoxItem>
</ComboBox>
</ToolBar> <WindowsFormsHost HorizontalAlignment="Left" Width="75" Height="30" Margin="205,27,0,0" Name="windowsFormsHost1" VerticalAlignment="Top" >
<wf:Button Text="test" Click="Button_Click" />
</WindowsFormsHost> <telerik:RadTreeListView
telerik:StyleManager.Theme="Office_Silver"
AutoGenerateColumns="False"
IsFilteringAllowed="False"
HierarchyColumnIndex="0"
RowIndicatorVisibility="Collapsed"
Name="tlvList"
IsReadOnly="True" Margin="12,182,12,28">
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding Child}" />
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="名称" Width="150" >
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn DataMemberBinding="{Binding CreateDate}" Header="创建时间" Width="150" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Version}" Header="版本" Width="150" />
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="361,62,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
</Grid>
</Window> <Window x:Class="控件Demo.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Title="Window1" Height="300" Width="500">
<Grid>
<telerik:RadTreeListView
telerik:StyleManager.Theme="Office_Silver"
AutoGenerateColumns="False"
IsFilteringAllowed="False"
HierarchyColumnIndex="0"
RowIndicatorVisibility="Collapsed"
Name="tv"
IsReadOnly="True" >
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding Child}" />
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="名称" Width="150" >
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn DataMemberBinding="{Binding CreateDate}" Header="创建时间" Width="150" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Version}" Header="版本" Width="150" />
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace 控件Demo
{
public class Helper
{
private static Helper instance;
public static Helper Instance
{
get
{
if (instance == null) instance = new Helper();
return Helper.instance;
}
}
/// <summary>
/// 工程列表信息
/// </summary>
/// <returns></returns>
public List<ProjectConfigModel> GetProjectList()
{
List<ProjectConfigModel> list = new List<ProjectConfigModel>(); ProjectConfigModel devRoot = new ProjectConfigModel
{
Name = "开发组A",
CreateDate = string.Empty,
Version = string.Empty,
Child = new List<ProjectConfigModel>(),
};
devRoot.Child.Add(new ProjectConfigModel
{
Name = "孙001",
CreateDate = "2014.05.15 11:11:11",
Version = "V2.0.0.1"
});
devRoot.Child.Add(new ProjectConfigModel
{
Name = "张111",
CreateDate = "2014.05.15 12:11:11",
Version = "V2.0.0.2"
});
devRoot.Child.Add(new ProjectConfigModel
{
Name = "周001",
CreateDate = "2014.05.15 13:11:11",
Version = "V2.0.0.3"
});
devRoot.Child.Add(new ProjectConfigModel
{
Name = "张01",
CreateDate = "2014.05.15 14:11:11",
Version = "V2.0.0.4"
});
devRoot.Child.Add(new ProjectConfigModel
{
Name = "曹001",
CreateDate = "2014.05.15 15:11:11",
Version = "V2.0.0.5"
});
list.Add(devRoot); ProjectConfigModel testRoot = new ProjectConfigModel
{
Name = "测试组A",
CreateDate = string.Empty,
Version = string.Empty,
Child = new List<ProjectConfigModel>(),
};
testRoot.Child.Add(new ProjectConfigModel
{
Name = "慕001",
CreateDate = "2014.05.15 11:11:11",
Version = "V2.0.0.1"
});
testRoot.Child.Add(new ProjectConfigModel
{
Name = "陈001",
CreateDate = "2014.05.15 12:11:11",
Version = "V2.0.0.2"
});
testRoot.Child.Add(new ProjectConfigModel
{
Name = "张xx",
CreateDate = "2014.05.15 13:11:11",
Version = "V2.0.0.3"
});
testRoot.Child.Add(new ProjectConfigModel
{
Name = "李xx",
CreateDate = "2014.05.15 14:11:11",
Version = "V2.0.0.4"
});
testRoot.Child.Add(new ProjectConfigModel
{
Name = "zhoumm",
CreateDate = "2014.05.15 15:11:11",
Version = "V2.0.0.5"
});
list.Add(testRoot); return list;
}
}
} using System;
using System.Windows; namespace 控件Demo
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent(); this.tlvList.ItemsSource = Helper.Instance.GetProjectList();
} private void MenuItem_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Copy");
} private void Button_Click(object sender, EventArgs e)
{
Form1 f = new Form1();
f.Show();
} private void button1_Click(object sender, RoutedEventArgs e)
{
Window1 w = new Window1();
w.Show();
}
}
} using System.Windows; namespace 控件Demo
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent(); this.tv.ItemsSource = Helper.Instance.GetProjectList();
}
}
}
运行效果:

WPF Demo10 嵌套Winform、RadGridView、的更多相关文章
- 在WPF中使用WinForm控件方法
1. 首先添加对如下两个dll文件的引用:WindowsFormsIntegration.dll,System.Windows.Forms.dll. 2. 在要使用WinForm控 ...
- 在WPF中调用Winform控件
最近在项目中用到了人脸识别和指纹识别,需要调用外部设备和接口,这里就用到了在WPF中调用Winform控件. 第一步,添加程序集引用.System.Windows.Forms和WindowsForms ...
- [转]在WPF中使用WinForm控件方法
本文转自:http://blog.csdn.net/lianchangshuai/article/details/6415241 下面以在Wpf中添加ZedGraph(用于创建任意数据的二维线型.条型 ...
- WPF加载Winform窗体时 报错:子控件不能为顶级窗体
一.wpf项目中引用WindowsFormsIntegration和System.Windows.Forms 二.Form1.Designer.cs 的 partial class Form1 设置为 ...
- WPF中嵌入WinForm中的webbrowser控件
原文:WPF中嵌入WinForm中的webbrowser控件 使用VS2008创建WPF应用程序,需使用webbrowser.从工具箱中添加WPF组件中的webbrowser发现其中有很多属性事件不能 ...
- WPF保存包含Winform控件的XAML页面问题
原文:WPF保存包含Winform控件的XAML页面问题 最近的工作中,用到了WPF调用Winform控件 但是在保存XAML页面的时候发现了问题,就是Winform页面黑黑的,没有任何渲染的波形曲线 ...
- WPF中添加Winform用户自定义控件
过程:创建WPF工程->创建Winform用户自定义控件工程->WPF中引用控件->添加到Xaml页面 1.首先在WPF工程的解决方案上右击选择添加新建项目: 选择Windows窗体 ...
- Wpf使用Winform控件后Wpf元素被Winform控件遮盖问题的解决
有人会说不建议Wpf中使用Winform控件,有人会说建议使用Winform控件在Wpf下的替代方案,然而在实际工作中由于项目的特殊需求,考虑到时间.成本等因素,往往难免会碰到在WPF中使用Winfr ...
- WPF 精修篇 Winform 嵌入WPF控件
原文:WPF 精修篇 Winform 嵌入WPF控件 首先 创建WPF控件库 这样就有了一个WPF界面 在wpf中增加界面等 在winform中增加WPFDLL 重新生成解决方案 在左侧工具栏 出现W ...
随机推荐
- windows server2008服务器下XAMPP集成环境配置apache的SSL证书:
1.在腾讯与申请的免费SSL证书.按其要求配置,并提交申请,进行审核,审核通过,获得一年使用的SSL免费证书. 2.按下面的要求,进行SSL证书安装配置.本人在配置XAMPP下的apache时,无需复 ...
- POJ 1754 线段树
e,应该是线段树里的水题.线段树单点更新.查询区间最值. 代码套用模板 PS :模板有些地方不太懂. #include<stdio.h>#include<iostream>#i ...
- String对象中的正则表达式
(1)身份证号码验证身份证号码是18位数字,根据GB11643-1999<公民身份证>定义制作:由17位本体码和一位校验码组成.身份证号码前6位是地址码,按(GB/T2260)规定执行.接 ...
- docker(三)反正我不喜欢敲命令,daocloud.io管理你的docker,安装远程下载工具aria2 迅雷远程下载 xware
1.登录daocloud.io 2.寻找合适的镜像 3.查看镜像信息并部署,它给出了一个运行命令,其中有用的只是-V,目录映射,映射了物理服务器的/tddownload到容器的/xware/tddow ...
- “开始菜单”按钮今年8月将重回Windows 8
本月早些时候微软明确表示,“开始菜单”将重新回归Windows 8操作系统.尽管微软当时并没有公布具体的时间表,但据熟悉微软内部运作的消息灵通人士透露称,“开始菜单”极有可能将出现在预计于今年8月发布 ...
- 网络端口(port)
在同一个网络地址上,为了区分使用相同协议的不同应用程序,可以为不同的应用程序分配一个数字编号,称为端口号(port). 取值范围:0-65535 IANA(Internet Assigned Numb ...
- Locust 测试结果通过Matplotlib生成趋势图
目的: 相信大家对于使用Loadrunner测试后的结果分析详细程度还是有比较深刻的感受的,每个请求,每个事务点等都会有各自的趋势指标,在同一张图标中展示.如下图: 而Locust自身提供的chart ...
- 【error】scripts/basic/fixdep: Syntax error: "(" unexpected
前言 第一次安装PCIE驱动的时候容易出现各种问题,总结一下下.. 原因分析 一般情况下,直接make的时候会出现问题. scripts/basic/fixdep: : scripts/basic/f ...
- 0-1背包 codeforces 55 D
题目链接: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=29608#problem/D 我把它化成了0-1背包,应该可以直接用多重背包做 ...
- 【java规则引擎】《Drools7.0.0.Final规则引擎教程》第4章 4.2 no-loop
转载至:https://blog.csdn.net/wo541075754/article/details/75201934 no-loop 定义当前的规则是否不允许多次循环执行,默认是 false, ...