随笔分类 -  WPF

WPF技术积累
摘要:提问 WPF项目如何使用日志 回答 引入nuget log4net 加入配置特性 [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are locat 阅读全文
posted @ 2024-04-19 13:21 东百牧码人 阅读(116) 评论(0) 推荐(0)
摘要:提问 WPF 如何添加系统托盘 回答 1.引入nuget handycontrol cs xmlns:hc="https://handyorg.github.io/handycontrol" 2.窗体添加控件 cs <hc:NotifyIcon x:Name="NotifyIconContextCo 阅读全文
posted @ 2024-03-21 09:00 东百牧码人 阅读(368) 评论(0) 推荐(0)
摘要:提问 如何实现Handy Control DataGrid 全选 回答 private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { if (((sender as CheckBox)!).IsChecked!.Value) 阅读全文
posted @ 2023-02-28 09:52 东百牧码人 阅读(179) 评论(0) 推荐(0)
摘要:StackPanel增加滚动条 StackPanel本身是没有滚动条的但是外边包裹ScrollViewer就能滚动了,示例如下 <ScrollViewer Grid.Row="1" Margin="10" Background="{DynamicResource SecundaryBackgroun 阅读全文
posted @ 2022-05-31 16:35 东百牧码人 阅读(927) 评论(0) 推荐(0)
摘要:使用MouseUp 触发选中行事件后续操作; 阅读全文
posted @ 2021-09-18 14:21 东百牧码人 阅读(1304) 评论(0) 推荐(0)
摘要:var cts = new CancellationTokenSource(); cancellationTokenSources.Add(cts); var t = Task.Run(() => { if (!cts.IsCancellationRequested) { //do somethin 阅读全文
posted @ 2021-09-18 13:58 东百牧码人 阅读(178) 评论(0) 推荐(0)
摘要:1.当ListBox内容很多时 可使用异步动态加载友好显示 private ObservableCollection<ImageInfo> detailImages = new ObservableCollection<ImageInfo>(); public ObservableCollectio 阅读全文
posted @ 2021-09-16 12:00 东百牧码人 阅读(452) 评论(0) 推荐(0)
摘要:1 public static void PrintwithoutDialog(this DocumentViewer viewer, FixedDocument fixedDoc) 2 { 3 PrintDialog pDialog = new PrintDialog(); 4 pDialog.P 阅读全文
posted @ 2021-09-13 10:45 东百牧码人 阅读(89) 评论(0) 推荐(0)
摘要:1 System.Timers.Timer timer = new System.Timers.Timer(); 2 timer.Interval = 360; 3 timer.Elapsed += delegate 4 { 5 Application.Current.Dispatcher.Begi 阅读全文
posted @ 2021-08-31 10:11 东百牧码人 阅读(418) 评论(0) 推荐(0)
摘要:<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:the 阅读全文
posted @ 2021-08-13 09:58 东百牧码人 阅读(192) 评论(0) 推荐(0)
摘要:<TextBox x:Name="cszd" HorizontalContentAlignment="Left" //水平居左 VerticalContentAlignment="Top" //垂直居上 TextWrapping="Wrap" //换行 AcceptsReturn="True" // 阅读全文
posted @ 2021-08-10 09:54 东百牧码人 阅读(1708) 评论(0) 推荐(0)
摘要:private void ContentControl_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton==MouseButtonState.Pressed) { this.DragMove(); } } <Win 阅读全文
posted @ 2021-07-26 13:21 东百牧码人 阅读(144) 评论(0) 推荐(0)
摘要:添加 AllowsTransparency="True" 属性消除 阅读全文
posted @ 2021-07-24 10:35 东百牧码人 阅读(843) 评论(0) 推荐(0)
摘要:<TextBox Name="xx" > <TextBox.InputBindings> <KeyBinding Command="{Binding MyCommand}" Key="Enter" CommandParameter="{Binding ElementName=xx}"/> </Tex 阅读全文
posted @ 2021-07-21 14:52 东百牧码人 阅读(348) 评论(0) 推荐(1)
摘要:新建类型位wpf类库,不是 普通的类库,要有wpf引用 同时引用时注意样式依赖先后 被依赖的放在前面 阅读全文
posted @ 2021-07-13 08:48 东百牧码人 阅读(163) 评论(0) 推荐(0)
摘要:PasswordBox 文本垂直居中 VerticalContentAlignment="Center" 阅读全文
posted @ 2021-07-09 19:16 东百牧码人 阅读(43) 评论(0) 推荐(0)
摘要:删除标题栏 WindowStyle="None" 设置背景图片 <DockPanel Grid.Column="0" LastChildFill="False"> <DockPanel.Background> <ImageBrush ImageSource="/Resources/bgpic.png 阅读全文
posted @ 2021-07-09 16:16 东百牧码人 阅读(31) 评论(0) 推荐(0)