![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C#
记录学习WPF过程中的知识点
bukajiushang
喜欢
展开
-
CLI out
void foo(Bar^% x);transforms intoVoid foo(ref Bar x);----------------------------------------------------------------------------------------------------------------------------------------------------Void foo(out Bar x);transforms intousi..原创 2020-07-24 19:59:39 · 180 阅读 · 0 评论 -
C# 避免出现数组越界错误
需要对长度进行判断,如果下标越界,会出错:List<string> test = new List<string>();test.Add("beijing");test.Add("shanghai");test.Add(null);test.Add("quzhou");if (test.Count() >= 4){ string a = test[2] == null ? "" : "hello"; string b = test[3] ==原创 2020-05-22 22:41:12 · 2804 阅读 · 0 评论 -
wpf 资源字典作为类库,在程序集间共享资源
背景前提:将不同类库共同使用的资源文件,放在一个类库中。在需要使用时,引用这个类库;工程结构:其中ResourceDictionary为exe程序,引用了Style类库和User类库;同时User类库引用了Style类库,为了使用Style类库中的样式;App.xaml<Application x:Class="ResourceDictionary.App" xmlns="http://schemas.microsoft.com/winfx/2006原创 2020-05-13 21:37:53 · 1748 阅读 · 0 评论 -
WPF TextBlock文本对齐问题
<Grid Background="Gray"> <Grid Height="30" Width="200" Background="Wheat"> <Canvas x:Name="canvas"> <Ellipse Width="20" Height="20" Stroke...原创 2020-04-26 21:54:25 · 2458 阅读 · 0 评论 -
WPF 中双向绑定通知机制之ObservableCollection使用
WPF 中双向绑定通知机制之ObservableCollection使用</div> msdn中 ObservableCollection<T> 类 表示一个动态数据集合,在添加项、移除项或刷新整个列表时,此集合将提供通知。在许多情况下,所使用的数据是对象的集合。 ...转载 2020-03-07 18:57:58 · 911 阅读 · 0 评论 -
WPF中的Binding:单个属性绑定与变化
绑定到非元素对象唯一的要求是希望显示的信息必须存储在公有属性中。WPF数据绑定基础结构不能获取私有信息或公有字段。<Window x:Class="Wpf_ObservableCollection.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ...原创 2020-03-07 12:44:32 · 789 阅读 · 0 评论 -
Polygon:鼠标手动画线+数据绑定
<Window x:Class="Polygon.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="ht...原创 2020-02-21 17:14:24 · 422 阅读 · 0 评论 -
Data Bingding:获取Code-behind数据
<Window x:Class="DataBinding.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d...原创 2020-02-21 16:58:59 · 125 阅读 · 0 评论 -
MVVM Prism WPF - Setting a public property and SetProperty
xaml中的变量与ViewModel中的公用属性绑定,当修改了公用属性时,xaml中绑定的值也会随之变化。注意:不是绑定字段。(this.Name = "hh"; 正确,触发通知) (this.name= "hh"; 错误,不会触发通知)using System.Windows;namespace PropertyChange{ /// <summary...原创 2020-01-14 19:00:49 · 653 阅读 · 0 评论 -
WPF:AvalonDock template ILayoutUpdateStrategy
参考文章:https://stackoverflow.com/questions/35335465/avalondock-ilayoutupdatestrategy-example-needed原创 2020-01-09 20:52:42 · 220 阅读 · 0 评论 -
WPF:Pan & Zoom Image
效果图:完整工程:参考文章:https://stackoverflow.com/questions/741956/pan-zoom-imageWPF编程宝典里说道ViewBox类,待看原创 2020-01-09 20:44:18 · 394 阅读 · 0 评论 -
WPF:Toggle button in
效果图:工程:<Window x:Class="ToggleButton.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"...原创 2020-01-09 20:42:25 · 571 阅读 · 0 评论 -
WPF:Command传递两个元素
//MainWindow.xaml<Window x:Class="Command_MultiElement.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/20...原创 2020-01-09 20:37:30 · 464 阅读 · 0 评论