WPF学习笔记-数据采集与监控项目03-课程总览(ItemsControl控件)

以下是学习笔记:

https://www.bilibili.com/video/BV1gq4y1D76d?p=57&spm_id_from=pageDriver&vd_source=3f21d2e208ef0bf2c49a9be7560735e5

重点内容:学习课程总览的数据绑定

 

 

1,滚动页面效果:

把页面放入ScrollViewer中

2,课程总览的页面

  

3,Model

1
2
3
4
5
6
7
8
9
/// <summary>
 /// 课程类
 /// </summary>
public class CourseServiceModel
 {
     public string CourseName { get; set; }
     public  SeriesCollection SeriesCollection { get; set; }
     public  ObservableCollection<SeriesModel> SeriesLsit { get; set; }
 }

  

4,ViewModel

  

5,数据的查询

  

单选框效果

 

 1,控件模板

  

2,

  

3,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class CoursePageViewModel
{
    public ObservableCollection<CategoryItemModel> CategoryCourses { get; set; }
    public ObservableCollection<CategoryItemModel> CategoryTechnology { get; set; }
    public ObservableCollection<CategoryItemModel> CategoryTeacher { get; set; }
 
    public CoursePageViewModel()
    {
        this.CategoryCourses = new ObservableCollection<CategoryItemModel>();
        this.CategoryCourses.Add(new CategoryItemModel("全部", true));
        this.CategoryCourses.Add(new CategoryItemModel("公开课"));
        this.CategoryCourses.Add(new CategoryItemModel("VIP课程"));
 
        this.CategoryTechnology = new ObservableCollection<CategoryItemModel>();
        this.CategoryTechnology.Add(new CategoryItemModel("全部", true));
        this.CategoryTechnology.Add(new CategoryItemModel("C#"));
        this.CategoryTechnology.Add(new CategoryItemModel("Python"));
 
        this.CategoryTeacher = new ObservableCollection<CategoryItemModel>();
        this.CategoryTeacher.Add(new CategoryItemModel("全部", true));
        this.CategoryTeacher.Add(new CategoryItemModel("Jason"));
        this.CategoryTeacher.Add(new CategoryItemModel("Mason"));
    }
}

  

 

posted @   包子789654  阅读(232)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示