我想濾波器,用於過濾我多列和多過濾器的ListView,但我不得到一個知道如何...篩選多個列的ListView C#WPF
這是我的想法:一個窗口這顯示當前選擇的 列標題,您可以在下拉菜單中選擇=或>並與你的標準,然後過濾,我只找到一列,但多過濾器不知道的解決方案......
數據負載:
var xdoc = XDocument.Load(@"C:\temp\webTsl.xml");
var units = from u in xdoc.Descendants("sl")
select new
{
EQNr = (string)u.Element("id"),
//EQCore = (string)u.Element(""),
ArtNr = (string)u.Element("artNr"),
Bez = (string)u.Element("bez"),
//KundenBez = (string)u.Element(""),
//ProjektNr = (string)u.Element(""),
//LiefDat = (DateTime)u.Element(""),
//EqStart = (DateTime)u.Element(""),
//GewaehrStart = (DateTime)u.Element(""),
//GewaehrEnde = (DateTime)u.Element("")
};
foreach (var unit in units)
{
items.Add(new Anlagen(unit.EQNr, unit.ArtNr, unit.Bez));
}
ListViewAnlagen.ItemsSource = CollectionViewSource.GetDefaultView(items);
類:
public virtual string EQNr { get; set; }
//public virtual string EQCore { get; set; }
public virtual string ArtNr { get; set; }
public virtual string Bez { get; set; }
//public virtual string KundenBez { get; set; }
//public virtual string ProjektNr { get; set; }
//public virtual DateTime? LiefDat { get; set; }
//public virtual DateTime? EqStart { get; set; }
//public virtual DateTime? GewaehrStart { get; set; }
//public virtual DateTime? GewaehrEnde { get; set; }
public Anlagen(string eqNr,string artNr, string bez) /*, DateTime liefdat, DateTime inbetnahme,DateTime garantiestart,DateTime garantieende*/
{
this.EQNr = eqNr;
//this.EQCore = eqCore;
this.ArtNr = artNr;
this.Bez = bez;
//this.KundenBez = kundenBez;
//this.ProjektNr = projektNr;
//this.LiefDat = liefDat;
//this.EqStart = eqStart;
//this.GewaehrStart = gewaehrStart;
//this.GewaehrEnde = gewaehrEnde;
}
public Anlagen()
{
}
我可以問你一個例子嗎? –
先生,我試着理解你的解決方案,但我不明白,你可以舉個例子嗎? –
也許我可以寫一個,不是現在......正如你可以從片段中看到的,一個準備好的例子需要幾行代碼和xaml。 – grek40