ListBox item Sort
将Rss内容读取到Listbox control中, 然后实现按照标题或发布日期进行排序。
private void ListItemSort(string type)
{
if (type == "title")
{
var list = ItemBox.Items.Cast<SyndicationItem>().OrderBy(item => item.Title.Text).ToList();
if (ItemBox.ItemsSource != null)
ItemBox.ItemsSource = null;
ItemBox.Items.Clear();
foreach (SyndicationItem item in list)
{
ItemBox.Items.Add(item);
}
}
else if (type == "date")
{
var list = ItemBox.Items.Cast<SyndicationItem>().OrderBy(item => item.PublishDate.LocalDateTime).ToList();
if (ItemBox.ItemsSource != null)
ItemBox.ItemsSource = null;
ItemBox.Items.Clear();
foreach (SyndicationItem item in list)
{
ItemBox.Items.Add(item);
}
}
}
需要这两个类库:
using System.ServiceModel.Syndication;
using System.Collections;
ListBox item Sort的更多相关文章
- wpf ListBox,item两列不等高。
业务有这样的需求,类似瀑布流.内容两列不等高展示. 只需要继承panel,重写MeasureOverride和ArrangeOverride方法就行了. 很简单,内容都在代码里. using Syst ...
- WP8_访问ListBox中的Item项中的某个元素
How to access a Control placed inside ListBox ItemTemplate in WP7(转) In this post I am going to talk ...
- win32 listbox
real-time refresh: the scrollbar will jump when the listbox refresh change color: how to change the ...
- ListBox和ComboBox绑定数据简单例子
1. 将集合数据绑定到ListBox和ComboBox控件,界面上显示某个属性的内容 //自定义了Person类(有Name,Age,Heigth等属性) List<Person> per ...
- perl的一些小函数——split、join、sort
有时候,我们需要将一个字符串或一行文本通过某种方式转换为单个的元素存储在数组中,或者将许多元素通过某种分割符,将他们组合成一个字符串.perl刚好就提供了这样的功能,通过split或者join分割或组 ...
- sort函数的使用
此篇当作自己的笔记(水平太菜,这都一直没搞明白) sort()函数的用法1)sort函数包含在头文件<algroithm>中,还要结合using namespace std2)sort有三 ...
- Salesforce LWC学习(二十四) Array.sort 浅谈
本篇参考:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/sort sal ...
- WPF SDK研究 之 数据绑定
这一章介绍数据绑定.本章共计27个示例,全都在VS2008下.NET3.5测试通过,点击这里下载:ConnectedData.rar 1.ShowDataWithoutBinding注: <?M ...
- 微软原文翻译:适用于.Net Core的WPF数据绑定概述
原文链接,大部分是机器翻译,仅做了小部分修改.英.中文对照,看不懂的看英文. Data binding overview in WPF 2019/09/19 Data binding in Windo ...
随机推荐
- c++ 匹配A容器中最先出现的b容器中的元素,返回iterator,(find_first_of)
#include <iostream> // std::cout #include <algorithm> // std::find_first_of #include < ...
- 卡内基梅隆大学软件工程研究所先后制定用于评价软件系统成熟度的模型CMM和CMMI
SEI(美国卡内基梅隆大学软件工程研究所(Software Engineering Institute, SEI))开发的CMM模型有: 用于软件的(SW-CMM;SW代表'software即软件') ...
- VC6的VCVARS32.BAT所在位置
1. C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT 2.
- Mask R-CNN论文理解
摘要: Mask RCNN可以看做是一个通用实例分割架构. Mask RCNN以Faster RCNN原型,增加了一个分支用于分割任务. Mask RCNN比Faster RCNN速度慢一些,达到了5 ...
- SPP Net(Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition)论文理解
论文地址:https://arxiv.org/pdf/1406.4729.pdf 论文翻译请移步:http://www.dengfanxin.cn/?p=403 一.背景: 传统的CNN要求输入图像尺 ...
- canvas+js实现荧光字符效果
一个小玩意,代码来源于网络. 效果图如下 代码如下 <html> <head> <style> * { margin: 0; padding: 0; } html, ...
- Unity打包的时候保存默认的输出路径,再次使用该路径的时候读取之
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; us ...
- mount ntfs-3g , fstab里的配置没有效果
把ntfs-3g配置在 fstab 里,mount 时会报 No such device 网上也有在嵌入式系统里发生的类似例子. 没有解决方法,也不准备再研究了. 准备在机器启动之后,手动下面的命令 ...
- dns未设置 PHP Warning: file_get_contents():php_network_getaddresses: getaddrinfo failed:
php通过去访问外部网站时,出现以下提示: PHP Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed ...
- 关于C和C++
最开始学的就是C和C++,但只是学过,根本就不知道怎么使用. 后来接触了Python和Perl才知道怎么将编程应用于实际需求当中,读取文件,存放到数据结构,处理,输出. 但脚本语言有其固有的缺点,不能 ...