当前位置:网站首页>WPF effect Article 191 box selection listbox
WPF effect Article 191 box selection listbox
2022-07-06 03:46:00 【Dotnet cross platform】
The previous effect is based on ListBox Achieved a little different effect ; Today, the box selection is improved again on the original basis ListBox; The final effect , Here's the picture :
1、 Used VisualTreeHelper Of HitTest Method :
Point point2 = e.GetPosition(LedListBox);
Rect rect = new Rect(origContentMouseDownPoint, point2);
RectangleGeometry rectangleGeometry = new RectangleGeometry(rect);
VisualTreeHelper.HitTest(LedListBox, new HitTestFilterCallback(OnHitTestFilterCallback), new HitTestResultCallback(OnHitTestResultCallback), new GeometryHitTestParameters(rectangleGeometry));
2、 About OnHitTestFilterCallback:
private HitTestFilterBehavior OnHitTestFilterCallback(DependencyObject target)
{
UIElement element = target as UIElement;
if(element != null)
{
var img = element as CheckBox;
if(img != null && img.IsVisible == true)
{
img.IsChecked = true;
return HitTestFilterBehavior.Continue;
}
}
return HitTestFilterBehavior.Continue;
}
The final simple effect is this ; If you have time later , You can explore more complex effects
; Programming never stops 、Bug More than 、 nothing Bug、 No life
; Change bug Calm down 、 The passion of coding 、 Joy after completion 、 The excitement of digging a hole 、 The excitement of filling the hole ; Maybe that's the fun of lousy programmers ; Come here today ; I hope I have the motivation to persist step by step ; Life is endless , Code is more than ; You can take time to see the effect of today's sharing , Have good opinions and ideas , You can leave a message on the message board ; I will reply you as soon as I see it , Thank you for your attention and support ! If it feels good , Then reach out your little hand, praise and pay attention to !
边栏推荐
- Pointer for in-depth analysis (problem solution)
- Esbuild & SWC: a new generation of construction tools
- A brief introduction to symbols and link libraries in C language
- 【SLAM】ORB-SLAM3解析——跟踪Track()(3)
- Blue style mall website footer code
- [slam] orb-slam3 parsing - track () (3)
- [matlab] - draw a five-star red flag
- Schnuka: visual positioning system working principle of visual positioning system
- Exchange bottles (graph theory + thinking)
- 自动化测试怎么规范部署?
猜你喜欢
Flask learning and project practice 9: WTF form verification
Mysqldump data backup
Containerization Foundation
Pointer for in-depth analysis (problem solution)
Data analysis Seaborn visualization (for personal use)
C#(三十)之C#comboBox ListView treeView
Blue Bridge Cup - Castle formula
Schnuka: visual positioning system working principle of visual positioning system
遥感图像超分辨率论文推荐
11. Container with the most water
随机推荐
简述C语言中的符号和链接库
2.2 STM32 GPIO操作
[prediction model] difference method model
3.1 rtthread 串口设备(V1)详解
Cf603e pastoral oddities [CDQ divide and conquer, revocable and search set]
C#(二十八)之C#鼠标事件、键盘事件
User perceived monitoring experience
Blue Bridge Cup - day of week
Python implementation of maddpg - (1) openai maddpg environment configuration
【Rust 笔记】18-宏
SAP ALV color code corresponding color (finishing)
阿里测试师用UI自动化测试实现元素定位
2.1 rtthread pin设备详解
Pelosi: Congress will soon have legislation against members' stock speculation
SWC introduction
After five years of testing in byte, I was ruthlessly dismissed in July, hoping to wake up my brother who was paddling
C#(二十七)之C#窗体应用
Blue style mall website footer code
潘多拉 IOT 开发板学习(HAL 库)—— 实验9 PWM输出实验(学习笔记)
Exchange bottles (graph theory + thinking)