wpf

What can I do inside CompositionTarget.Rendering?

本秂侑毒 提交于 2021-02-20 17:51:48
问题 The CompositionTarget.Rendering event is the perfect thing to build a game's main loop upon. It basically fires at the rate of vsync (usually 60 Hz). Occurs just before the objects in the composition tree are rendered. The Rendering event is routed to the specified event handler after animation and layout have been applied to the composition tree. The per-frame animation how-to article explains a little bit more. Note that your event handler method is called after layout has been computed.

WPF入门教程系列二——Application介绍

家住魔仙堡 提交于 2021-02-20 16:23:26
一.Application介绍 WPF和WinForm 很相似, WPF与WinForm一样有一个 Application对象来进行一些全局的行为和操作,并且每个 Domain (应用程序域)中仅且只有一个 Application 实例存在。和 WinForm 不同的是WPF Application默认由两部分组成 : App.xaml 和 App.xaml.cs,这有点类似于 Asp.Net WebForm,将定义和行为代码相分离。 微软把WPF中经常使用的功能都封装在 Application 类中了。 Application 类具体有以下功能: 跟踪应用程序的生存期并与之交互。 检索和处理命令行参数。 检测和响应未经处理的异常。 共享应用程序范围的属性和资源。 管理独立应用程序中的窗口。 跟踪和管理导航。 二.WPF应用程序的启动 关于如何在Visual Studio中创建一个“WPF应用程序”,前面的文章中已经说过了。请参见 WPF入门教程系列一——基础 。 1、在Visual Studio 2013中创建一个“WPF应用程序”,使用App.xaml文件定义启动应用程序。XAML从严格意义上说并不是一个纯粹的 XML 格式文件,它更像是一种 DSL(Domain Specific Language,领域特定语言),它的所有定义都会由编译器最后编译成代码。App

Show Button on Label MouseHover in WPF

天涯浪子 提交于 2021-02-20 13:28:11
问题 In my application i have a Startup Window that contains (Tips, Information, etc.). A part of the window contains 3 Labels on the left side and 3 hidden Buttons on the right side. What i want is whenever a user hovers on one of the Labels the button which is located on the other side of the Label shows up. I know how to show the Button if i hover over it using Triggers , but how to show the button when i hover the Label . Is it possible for such thing to be done? 回答1: You can do that easily

DevExpress WPF v20.2 —— 甘特图控件全新升级

别等时光非礼了梦想. 提交于 2021-02-20 10:46:22
DevExpress WPF 拥有120+个控件和库,将帮助您交付满足甚至超出企业需求的高性能业务应用程序。通过DevExpress WPF能创建有着强大互动功能的XAML基础应用程序,这些应用程序专注于当代客户的需求和构建未来新一代支持触摸的解决方案。 无论是Office办公软件的衍伸产品,还是以数据为中心的商业智能产品,都能通过DevExpress WPF控件来实现。 DevExpress WPF v20.2日前全新发布,全新升级了甘特图、图表等控件功能,欢迎下载最新版体验! DevExpress v20.2完整版下载 图表 SVG导出 Diagram控件现在支持矢量(SVG)文件导出。 全新的列表项 Diagram控件包括一个新的容器项 - DiagramList,它将其子项排列在水平或垂直列表中。 度量单位 您可以启用一个新的 ShowMeasureUnit 选项,以在Properties Panel、Page Setup Window和Bottom Panel中显示度量单位。 除了像素,用户还可以指定其他度量单位(英寸和毫米)的值。 您还可以创建一个自定义度量单位并将其分配给 MeasureUnit 属性。 其他增强功能 v20.2为组织结构图的自动布局包含一个新的 OrgChartLayoutIsCompact 选项,将此选项设置为false可以计算所有tip-over

Give a windows handle (Native), how to close the windows using C#?

点点圈 提交于 2021-02-20 09:27:45
问题 Given a handle of a window, how can I close the window by using the window handle? 回答1: The easiest way is to use PInvoke and do a SendMessage with WM_CLOSE . [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); private const UInt32 WM_CLOSE = 0x0010; void CloseWindow(IntPtr hwnd) { SendMessage(hwnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero); } 回答2: Not sure if there is another way but you could PInvoke

WPF学习笔记

余生长醉 提交于 2021-02-20 07:37:12
笔记 布局控件 Canvas——该控件允许以任何合适的方式放置子控件。它不会对子控件的位置施加任何限制,但不会对位置摆放提供任何辅助。 DockPanel——该控件可让其中的子控件贴靠到自己四条边中的任意一边。最后一个子控件则可以充满剩余区域。 Grid——该控件让子控件的定位变得比较灵活。可将该控件的布局分为若干行和若干列,这样就可以在网格布局中对齐控件。 StackPanel——该控件能够按照水平方向或垂直方向依次对子控件进行排列。 WrapPanel——与StackPanel一样,该控件也能按照水平方向或垂直方向依次对子控件进行排列,但它不是按照一行或一列来排序,而是根据可用空间大小以多行多列的方式来排列。 标签 Window ResizeMode="CanResizeWithGrip" ResizeMode属性被设置为CanResizeWithGrip,这可以让窗口的右下角出现一个小手柄标志,让用户知道该窗口的大小是可以调整的。 Button <Button Content="_OK"/> OK文本前加下划线“_”即可为该按钮创建Alt+O快捷键 数据绑定 ObservableCollection 这个类的方法,对数据的操作很少,重点放在了当自己本事变化的时候(不管是属性,还是集合)会调用发出通知的事件。(一般用于更新UI) 来源: oschina 链接: https:/

ListView with horizontal items

只愿长相守 提交于 2021-02-20 06:53:09
问题 I come from WPF and I don't know if it's possible to make a ListView to distribute items horizontally, with all the extras like mouse-wheel scrolling (mouse devices) and swiping (touch devices). I've tried this, but it doesn't behave like the vertical one. Example: I cannot scroll with the mouse-wheel. <ListView ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Auto" ItemsSource="{Binding Collection}" > <ListView.ItemsPanel> <ItemsPanelTemplate>

DataGridColumn with Header '*' already exists in the Columns collection of a DataGrid

余生颓废 提交于 2021-02-20 05:48:28
问题 I have a WPF application with MVVM pattern. In one of my view, I have to bind an ObservableCollection to view. In that view, I have one ListBox and one DataGrid both bind to the same ObservableCollection but doing different things like events, style etc.. I need only one of these controls displayed at a time and what I did is created two user controls, one for DataGrid and other for ListBox . And I switched between them by placing a ContentControl on the main view(something similar to this

Dependency Injection in .NET Core 3.0 for WPF

梦想的初衷 提交于 2021-02-20 05:45:22
问题 I’m quite familiar with ASP.NET Core and the support for dependency injection out of the box. Controllers can require dependencies by adding a parameter in their constructor. How can dependencies be achieved in WPF UserControls? I tried adding a parameter to the constructor, but that didn’t work. I love the IOC concept and would prefer to bring this forward to WPF. 回答1: I have recently come across this requirement to my project and I solved it this way. For Dependency Injection in .NET Core 3

Dependency Injection in .NET Core 3.0 for WPF

怎甘沉沦 提交于 2021-02-20 05:45:10
问题 I’m quite familiar with ASP.NET Core and the support for dependency injection out of the box. Controllers can require dependencies by adding a parameter in their constructor. How can dependencies be achieved in WPF UserControls? I tried adding a parameter to the constructor, but that didn’t work. I love the IOC concept and would prefer to bring this forward to WPF. 回答1: I have recently come across this requirement to my project and I solved it this way. For Dependency Injection in .NET Core 3