当前位置:网站首页>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 written test questions ~ approaching Dachang
RT-Thread--Lwip之FTP(2)
2.2 fonctionnement stm32 GPIO
Cubemx 移植正点原子LCD显示例程
WPF效果第一百九十一篇之框选ListBox
多项目编程极简用例
2.1 rtthread pin device details
Cubemx transplantation punctual atom LCD display routine
Flask learning and project practice 9: WTF form verification
KS003基于JSP和Servlet实现的商城系统
随机推荐
Pytoch foundation - (2) mathematical operation of tensor
Edcircles: a real time circle detector with a false detection control translation
Oracle ORA error message
cookie,session,Token 这些你都知道吗?
[meisai] meisai thesis reference template
User perceived monitoring experience
Canvas cut blocks game code
MADDPG的pythorch实现——(1)OpenAI MADDPG环境配置
BUAA magpie nesting
UDP reliable transport protocol (quic)
Recommended papers on remote sensing image super-resolution
如何修改表中的字段约束条件(类型,default, null等)
2、GPIO相关操作
BUAA计算器(表达式计算-表达式树实现)
Image super resolution using deep revolutionary networks (srcnn) interpretation and Implementation
SAP ALV单元格级别设置颜色
Basic concepts of LTE user experience
Shell pass parameters
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
[optimization model] Monte Carlo method of optimization calculation