work hard work smart

专注于Java后端开发。 不断总结,举一反三。
随笔 - 1158, 文章 - 0, 评论 - 153, 阅读 - 186万
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

随笔分类 -  B.WPF

摘要:Win 8中WPF listview与listBox的Drag、Drop操作。基本原理是将listview中的项拖动到listBox中。界面:<UserControl x:Class="DragTitleToWebView.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://sch 阅读全文

posted @ 2012-02-29 18:06 work hard work smart 阅读(3241) 评论(1) 推荐(1) 编辑

摘要:WPF 验证控件<Window x:Class="WpfApplication2.ValidationTest" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication2" Title="ValidationTest" He 阅读全文

posted @ 2011-12-26 14:25 work hard work smart 阅读(1441) 评论(0) 推荐(0) 编辑

摘要:1、WPF有两种树,一种是Logical Tree,完全有布局组件和控件组成。一种是Visual Tree,有更细微级别的组件。而路由事件是按Viaual Tree传递的。2、以Windows Form项目窗体上的一个按钮名为myButton为例的事件模型(1)事件的拥有者:myButton(2)事件:myButton.Click(3)事件的响应者:窗体本身。(4)事件处理器:myButton_Click()(5)订阅关系:myButton.Click += new System.EventHandler(myButton_Click) 阅读全文

posted @ 2011-12-26 14:22 work hard work smart 阅读(258) 评论(0) 推荐(0) 编辑

摘要:1、怎样在WPF中使用Windows窗体控件(如水晶报表)我们可以使用WindowsFormsHost元素在WPF中载入一个Windows Forms控件,下面的这个例子展示了如何载入一个CrystalReportViewer元素:<Window x:Class="ForumProjects.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/200 阅读全文

posted @ 2011-11-14 15:46 work hard work smart 阅读(536) 评论(0) 推荐(0) 编辑

摘要:【原文:http://www.cnblogs.com/chenxizhang/】大家是否还记得在Windows Forms程序中如何实现splashScreen吗?我们一般都会使用Microsoft.VisualBasic.dll中提供的那个WindowsFormsApplicationBase类型,它有一个所谓的splashscreen属性,可以指定为一个窗体的。那么,同样的需求在WPF中如何实现呢?这要从两头来说,从简单来说,它实在是简单了。事实上,这是.NET Framework 3.5sp1的一个特性http://blogs.msdn.com/jgoldb/archive/2008/0 阅读全文

posted @ 2011-10-31 10:18 work hard work smart 阅读(4403) 评论(2) 推荐(0) 编辑

摘要:1、附加属性:一个属性原来不属于某个对象,但由于某种需求而被后来附加上去。附加属性的本质是依赖属性。2、附加属性作用:将属性与数据类型解耦,让数据类型的设计的更加灵活。3、VS 2008中,依赖属性的snippet是propdp,附加属性的snippet是propa,属性的snippet是prop。4、举个例子,Human,School。Human中的一个人,他如果在学校里,就会有成绩等;如果在公司里,他就有部门等。此时的成绩和部门就是附加属性。代码如下:School类 class School:DependencyObject { public static int... 阅读全文

posted @ 2011-10-29 11:48 work hard work smart 阅读(7556) 评论(1) 推荐(4) 编辑

摘要:LINQ查询的结果是一个IEnumberable<T>类型对象,而IEnumberable<T>类型对象有派生自IEnumberable,所以它可以作为列表控件的ItemsSource来使用.我创建了一个Sutdent类: public class Student { public int ID{ get; set;} public string Name { get; set; } public string Age { get; set; } }UI的设计如下: <ListView Background="LightCoral... 阅读全文

posted @ 2011-09-17 16:19 work hard work smart 阅读(1691) 评论(0) 推荐(0) 编辑

摘要:使用WPF做的一个模板页示例下面是项目文件图:关键代码如下:<Page x:Class="WpfMasterPageTes.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" ShowsNavigationUI="False"> <Grid& 阅读全文

posted @ 2011-09-14 16:18 work hard work smart 阅读(3273) 评论(0) 推荐(2) 编辑

摘要:Binding是Wpf的核心内容之一1、下面是Binding基础的一个例子。XAML: <Grid> <TextBox x:Name="myTextBox" Height="80" HorizontalAlignment="Left" VerticalAlignment="Top" Width="200"/> <Button Height="23" HorizontalAlignment="Left" Margin=" 阅读全文

posted @ 2011-09-13 23:18 work hard work smart 阅读(1580) 评论(0) 推荐(0) 编辑

摘要:如下图是系统的结构图:这个示例是模仿计算器的MVVM模式的精简版,非常简单。这篇文章就开门见山了,有关MVVM的理论部分,请参考MVVM设计模式1、App中的代码: public App() { CalculatorView view = new CalculatorView(); view.DataContext = new CalculatorViewModel(); view.Show(); }2、Model层中CauculatorModel的代码 class Caucul... 阅读全文

posted @ 2011-09-11 23:24 work hard work smart 阅读(23494) 评论(14) 推荐(3) 编辑

摘要:1、WPF 获得DataTemplate中的控件, 下面这个示例是从ListBox中获得ListBoxItem模板的控件信息。前台代码: <!--获得模板中的控件--> <ListBox Margin="12,32,0,0" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" Name="listBox1" SelectedIndex="0" Height="186" VerticalAl 阅读全文

posted @ 2011-09-09 12:16 work hard work smart 阅读(11813) 评论(1) 推荐(0) 编辑

摘要:为WPF添加Windows窗体控件1、通过XAML实现1)添加WindowsFormIntegration.dll引用 引用命名空间 xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"2)通过XAML来实现 <Grid x:Name="myGrid"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinition 阅读全文

posted @ 2011-09-08 23:13 work hard work smart 阅读(1268) 评论(0) 推荐(0) 编辑

摘要:1、把Win32的按钮添加到WPF窗口中1)添加如下的using指令using System.Windows.Interop;using System.Runtime.InteropServices;2)创建Win32ButtonHost类 public class Win32ButtonHost : HwndHost { IntPtr hwndHost = IntPtr.Zero; IntPtr hwndButton = IntPtr.Zero; public int ButtonWidth = 0; ... 阅读全文

posted @ 2011-09-08 22:10 work hard work smart 阅读(1670) 评论(0) 推荐(0) 编辑

摘要:代码注意事项:1、代码实现的样式赋值 XXX.Style = TryFindResource("StyleName") as Style;2.WPF中FindName方法的使用 (1)简单的使用 前台代码: <Button x:Name="btnName" Click="btnName_Click">Test Method FindName</Button> 后台代码:private void btnName_Click(object sender, RoutedEventArgs e){ Button b = 阅读全文

posted @ 2011-09-07 21:26 work hard work smart 阅读(2197) 评论(0) 推荐(1) 编辑

摘要:一、ListBox系列索引1、WPF ListBox基础(包括ListBox多列展示,ListBox实现分页效果,ListBox绑定XML数据源)2、ListBox 单击变大动画效果(使用模板、样式、绑定数据源等)二、ListBox 单击变大动画效果(使用模板、样式、绑定数据源等) <Grid> <ListBox x:Name="_listBox" ItemsSource="{StaticResource DataSource}" ItemContainerStyle="{StaticResource ListBoxItemS 阅读全文

posted @ 2011-09-06 22:13 work hard work smart 阅读(3543) 评论(0) 推荐(2) 编辑

摘要:WPF 多个数据源的实现DEMO,ListView中有个Combox籍贯,ListView的数据来自XML数据源,Combox籍贯来自另一个数据源。 <ListView Height="262" Margin="345,12,12,0" ItemsSource="{Binding Source={StaticResource myPerson4},XPath=/PersonF/person}" VerticalAlignment="Top" Name="listView3"> < 阅读全文

posted @ 2011-09-06 16:00 work hard work smart 阅读(1736) 评论(3) 推荐(0) 编辑

摘要:一、WPF绑定各种数据源索引WPF 绑定各种数据源之DatatableWPF绑定各种数据源之object数据源WPF绑定各种数据源之xml数据源WPF绑定各种数据源之元素控件属性Binding的基础可参考WPF 绑定基础二、WPF绑定各种数据源之xml数据源,此时的XML源写在界面了,当然也可以独立成文件。 <Window.Resources> <Con:BackgroundConverter x:Key="BackgroundConverter"/> <XmlDataProvider x:Key="myPerson3"&g 阅读全文

posted @ 2011-09-06 14:38 work hard work smart 阅读(7233) 评论(0) 推荐(2) 编辑

摘要:一、WPF绑定各种数据源索引WPF 绑定各种数据源之DatatableWPF绑定各种数据源之object数据源WPF绑定各种数据源之xml数据源WPF绑定各种数据源之元素控件属性WPF 绑定基础二、WPF绑定各种数据源之元素控件属性1.绑定Value路径 <TextBlock Margin="327,378,331,363" Name="textBlock1" Text="{Binding ElementName=slider1, Path=Value}" /> <Slider Height="22&quo 阅读全文

posted @ 2011-09-06 14:11 work hard work smart 阅读(12277) 评论(0) 推荐(1) 编辑

摘要:一、WPF绑定各种数据源索引WPF 绑定各种数据源之DatatableWPF绑定各种数据源之object数据源WPF绑定各种数据源之xml数据源WPF绑定各种数据源之元素控件属性Binding的基础可参考WPF 绑定基础二、WPF绑定各种数据源之object数据源前台代码: <Window.Resources> <Con:BackgroundConverter x:Key="BackgroundConverter"/> </Window.Resources> 用ListView绑定object数据源 <ListView Height 阅读全文

posted @ 2011-09-06 13:28 work hard work smart 阅读(5740) 评论(0) 推荐(0) 编辑

摘要:一、Binding是WPF的核心,WPF的数据源有以下几种: 1、ADO.NET中的DataTable 2、xml数据源 3、object数据源 4、元素控件属性二、WPF绑定各种数据源索引WPF 绑定各种数据源之DatatableWPF绑定各种数据源之object数据源WPF绑定各种数据源之xml数据源WPF绑定各种数据源之元素控件属性WPF 绑定基础三、这里做一些简单的实例。1.ListBox绑定Datatable数据源前台代码 <ListBox Margin="12,32,12,329" ItemsSource="{Binding}" Nam 阅读全文

posted @ 2011-09-06 12:26 work hard work smart 阅读(25126) 评论(2) 推荐(2) 编辑

点击右上角即可分享
微信分享提示