随笔分类 - WPF编程
摘要:一、回车事件 写法1: 绑定: TextPassWord.KeyDown += TextPassWord_KeyDown; private void TextPassWord_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Ente
阅读全文
摘要:一、添加十字光标 实现鼠标放到曲线上能显示X、Y值,可以选择隐藏某条光标线。 <dxc:ChartControl DataSource="{Binding Data}"> <dxc:ChartControl.CrosshairOptions> <dxc:CrosshairOptions ShowAr
阅读全文
摘要:参考: 1、Grid+TreeViewItem实现 https://dlaa.me/blog/post/9898803 2、【论坛】是否有内建的TreeGrid / TreeListView https://www.saoniuhuo.com/question/detail-2315256.html
阅读全文
摘要:一、通过双击或者快捷键触发Command事件 <Button Content="Button"> <Button.InputBindings> <MouseBinding MouseAction="LeftDoubleClick" Command="{Binding Btn1Command}" Co
阅读全文
摘要:一、动态绑定ItemSource的MenuItem如何绑定事件并传入参数 <Menu DockPanel.Dock="Top"> <MenuItem Header="A"> <MenuItem Header="B1"/> <MenuItem Header="B2"/> <MenuItem Heade
阅读全文
摘要:小于号(<) < 大于号(>) > &符号(&) & 引号(") " 例如: <Button ...> <Click Me> </Button>
阅读全文
摘要:一、控件样式 https://www.cnblogs.com/xiaomingg/p/8736305.html 二、DataGrid中单击编辑 https://cloud.tencent.com/developer/ask/107530
阅读全文
摘要:1、字体文件加入到项目资源下载字体文件(.ttf),添加到项目中,并设置生成操作为"Resource"。(很重要!!) 2、定义样式使用TextBlock作为图标显示的容器,因此定义一个TextBlock的样式即可,如下所示。其中“SK2015” 为字体名称。 <Style x:Key="FIcon
阅读全文
摘要:测试过程中,随着测试过程的进行,上位机会自动地切换TabControl页面。但用户手动切换到某一页面时,不想让页面继续跟随测试进程切换。 通过PreviewMouseLeftButtonUp事件是否触发来判断切换是用户触发的还是软件运行到的。 private void tabControl1_Pre
阅读全文
摘要:这个功能可以用来实现Grid的分层效果。即在Grid里嵌套多个Border。 四个数分别对应左、上、右、下。 <!--显示左侧的线--> <Border Grid.Row="0" Grid.ColumnSpan="3" BorderBrush="LightBlue" BorderThickness=
阅读全文
摘要:<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys
阅读全文
摘要:一、静态绑定 <Image Source="/Demo;Component/Images/Test.jpg"/> 2、动态绑定 <Grid Grid.Row="1"> <Image Source="{Binding Path=LTEModel.ImgSource,Converter={StaticR
阅读全文
摘要:<ListBox Name="lstFileManager" Background ="Transparent" ItemsSource="{Binding}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.Ve
阅读全文
摘要:一、ComboBox样式 https://blog.csdn.net/lvguoshan/article/details/49178619 PS:使用过程中发现重写ComboBox样式以后,如果允许手动输入(即不从下拉框中选择),通过Text属性是没办法获取到输入的字符信息的。 二、实现下拉框带图文
阅读全文
摘要:一、隐藏边框 <TextBox Text="Hello" Width="480" TextWrapping="Wrap" IsReadOnly="True" BorderBrush="{x:Null}" BorderThickness="0"></TextBox> 关键语句 BorderBrush=
阅读全文
摘要:1、TextBox https://www.cnblogs.com/Lulus/p/12715348.html 2、通过GridSplitter https://blog.csdn.net/adream307/article/details/50719203/
阅读全文
摘要:https://blog.csdn.net/shikong_/article/details/77047235 App.xaml.cs 文件: namespace ElectronicNeedleTherapySystem { /// <summary> /// App.xaml 的交互逻辑 ///
阅读全文
摘要:1、渐变色 https://www.cnblogs.com/kuangxiangnice/p/5820631.html 2、各类画刷 https://www.cnblogs.com/huangxincheng/archive/2012/07/14/2591941.html
阅读全文
摘要:1、自定义控件样式+数据源绑定+动态添加父子节点 https://blog.csdn.net/dnazhd/article/details/105857707 2、用一个案例来学习TreeView的多层数据绑定 https://blog.csdn.net/u012366767/article/det
阅读全文
摘要:(1)使用的目的: 实现源数据和目标数据之间进行特定的转化。 比如一个User类里有int userLevel字段,1代表管理员,0代表普通用户那么就需要转换器进行转换来显示文字。 (2) IValueConverter接口:进行单值转换 IMutilValueConverter接口:进行多值转换
阅读全文