当前位置:网站首页>WPF 数据绑定(四)
WPF 数据绑定(四)
2022-06-12 04:01:00 【flysh05】
筛选的数据源的绑定,使用Linq Filter Data Collection。从数据集合中筛选符合设定条件的数据对象集合。
UI设计:
设计列表控件,后台将数据源绑定到该控件
Grid元素绑定到列表中选择的对象,这样Grid中的其它控件可绑定到选择对象的属性字段
后台代码设计:
定义一个全局的数据集合
private ICollection products;
依据条件筛选数据集,赋值给变量,再将控件数据源绑定到变量
products = App.StoreDb.GetProductsFilteredWithLinq(decimal.Parse(txtMinimumCost.Text));
listProducts.ItemsSource = products;
其中Linq查询函数如下:
传入的参数是产品的最低价格
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());
}
边栏推荐
- Experience the good team collaborative development process brought by Huawei cloud code hosting from 0 [my Huawei cloud experience journey] [play with Huawei cloud]
- R语言plotly可视化:plotly可视化分组(grouped)小提琴图(grouped violin plot in R with plotly)
- [Yugong series] March 2022 asp Net core Middleware - cross domain
- 【FPGA+GPS接收器】基于FPGA的双频GPS接收器详细设计介绍
- Pat class B 1067 trial password (20 points)
- [fpga+gps receiver] detailed design introduction of dual frequency GPS receiver based on FPGA
- [data recovery in North Asia] data recovery in which the logical volume of the server is changed and the file system is damaged due to system reinstallation
- 根據變換矩陣進行圖像拼接
- Object detection model rfbnet -- a very useful model
- Kinematic gauge (14) - Triangle optimal path problem
猜你喜欢
![[fpga+fft] design and implementation of FFT frequency meter based on FPGA](/img/f9/e985bd9aed332982d936b5d4e0d42b.png)
[fpga+fft] design and implementation of FFT frequency meter based on FPGA

mysql/oracle 以唯一时间为分界,小于等于该时间求和,大于该时间求和

根据变换矩阵进行图像拼接

Sequence list and linked list - primary level

Community Conference | the mosn community will release version 1.0 and promote the evolution of the next generation architecture

Detailed explanation of software testing process

智能面板WiFi联动技术,ESP32无线芯片模组,物联网WiFi通信应用

Three ways for ORALCE to process column to row conversion and finally generate table style data

关于 国产麒麟Qt编译报错“xxx.pri has modification time xxxx s in the futrue“ 的解决方法

E-commerce middle office system architecture
随机推荐
The memory four area model of C language program
怎样拥有心灵的平和?获得一颗全新的心灵
【C语言】封装接口(加减乘除)
(idea)the file size(2.85M) exceeds configured limit(2.56M).Code insight features are not available问题
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)
数据库新建表,以前没问题的,今天
Paper recommendation: relicv2, can the new self supervised learning surpass supervised learning on RESNET?
Detailed explanation of software testing process
[C language] analysis of variable essence
What is the difference between FOB, CIF and CFR?
Mongodb essence summary
[Yugong series] March 2022 asp Net core Middleware - cross domain
(idea)the file size(2.85M) exceeds configured limit(2.56M). Code insight features are not available
Enterprise Architect v16
Webpack--- optimization_ cache
【clickhouse专栏】新建库角色用户初始化
[C language] encapsulation interface (addition, subtraction, multiplication and division)
postgresql基本介绍以及部署使用
Create a new table in the database. There was no problem before. Today
【mysql】mysql安装