当前位置:网站首页>WPF data binding (IV)
WPF data binding (IV)
2022-06-12 04:17:00 【flysh05】
Binding of filtered data sources , Use Linq Filter Data Collection. Filter the set of data objects that meet the set conditions from the data set .
UI Design :
Design list control , Bind the data source to the control in the background
Grid Element is bound to the object selected in the list , such Grid Other controls in can be bound to the property field of the selected object
Background code design :
Define a global data set
private ICollection products;
Filter datasets by criteria , Assign a value to a variable , Then bind the control data source to the variable
products = App.StoreDb.GetProductsFilteredWithLinq(decimal.Parse(txtMinimumCost.Text));
listProducts.ItemsSource = products;
among Linq The query function is as follows :
The parameter passed in is the lowest price of the product
public ICollection GetProductsFilteredWithLinq(decimal minimumCost)
{
// Get the full list of products.
ICollection products = GetProducts();
// Create a second collection with matching products.
IEnumerable matches = from product in products
where product.UnitCost >= minimumCost
select product;
return new ObservableCollection(matches.ToList());
}
边栏推荐
- What does kotlin collaboration scope and coroutinescope mainscope globalscope viewmodelscope lifecyclescope represent respectively
- Object detection model rfbnet -- a very useful model
- 关于线程池需要注意的几点
- 疫情数据分析平台工作报告【3】网站部署
- WPF 数据绑定(四)
- Esp32c3 remote serial port
- R language plot visualization: use plot to visualize simple regression model linear regression plots
- 树莓派4B使用Intel Movidius NCS 2来进行推断加速
- WiFi module scheme of the wireless Internet of things, esp32-s3 chip technology, helps the equipment to be intelligent
- MongoDB精华总结
猜你喜欢

Zabbix6.0新功能Geomap 地图标记 你会用吗?

Successfully solved: warning: there was an error checking the latest version of pip

绝对定位使盒子居中显示的三种方式

Construction case of Expressway Precast Beam Yard (with scheme text)

魏武帝 太祖知不可匡正,遂不复献言

Implementation of fitness club management system based on SSH

MongoDB精华总结
![[C language] analysis of variable essence](/img/b4/13a5800f2c960ec590c9f7480b09d0.png)
[C language] analysis of variable essence

Create a new table in the database. There was no problem before. Today

疫情数据分析平台工作报告【2】接口API
随机推荐
Work report of epidemic data analysis platform [4] cross domain correlation
Kotlin 启动协程、launch 与async的区别、按照顺序启动协程
Smart panel WiFi linkage technology, esp32 wireless chip module, Internet of things WiFi communication application
动规(14)-三角形最佳路径问题
FOB,CIF,CFR的区别是什么?
【mysql】mysql安装
PyTorch中的Sequential、ModuleList和ModuleDict用法总结
Network tester operation manual renix rack management
MySQL的check约束数字问题
[Yugong series] March 2022 asp Net core Middleware - cross domain
Sed command
DS18B20 digital thermometer (I) electrical characteristics, power supply and wiring mode
Object detection model rfbnet -- a very useful model
Unity脚本出現missing時的解决方法
PostMessage implements window communication
Naive Bayes classification of scikit learn
SQL Safe Backup显示器和缩放字体的支持
后续版本是否会支持代码块搜索高亮显示
R language write function: use the write function to write data to the rstudio console, and the write function to write data to a new rstudio window (start a new window)
R语言write函数:使用write函数将数据写入RStudio控制台、write函数将数据写入新的Rstudio窗口(启动新的窗口)