XAML aşağıdadır. Nesneden gelen veriler liste görünümünü doldurur. Grupları gösteremiyorum. Listede görüntülenmeyen, workcenter adında bir mülkte gruplamak istiyorum, ancak yine de buna bağlı sınıfın bir parçası.WPF Liste Görünümü Grup Başlıkları Görüntülenmiyor: Herhangi Bir Fikir?
WPF çaylak değilim, bu yüzden cevap doğru önümde ise beni affet ve onu kaçırıyorum. Bunu işe almak için web'den örnekler kullanıyorum ama sadece bu noktaya değil.
Bu
yapmam, çok aptalca formu metin ve ad görmezden gereken bir proje için sahte-up. =)Resim gönderemediğimden, metin becerileri kullanarak nasıl göründüğünü haritalamaya çalışacağım. Ben şu:
**Batch ID Start Time End Time Duration Batch Type**
-------- ---------- -------- -------- ----------
12344555 7/21/11 7/22/11 100 Loaded
54564564 7/21/11 7/23/11 50 Sequential
12433555 7/21/11 7/22/11 100 Loaded
54564564 7/21/11 7/23/11 50 Sequential
12311555 7/21/11 7/22/11 100 Loaded
54456564 7/21/11 7/23/11 50 Sequential
12344555 7/21/11 7/22/11 100 Loaded
57744564 7/21/11 7/23/11 50 Sequential
12994555 7/21/11 7/22/11 100 Loaded
54500564 7/21/11 7/23/11 50 Sequential
İstediğim şey 332, 404 grup.
**Batch ID Start Time End Time Duration Batch Type**
-------- ---------- -------- -------- ----------
**332**
12344555 7/21/11 7/22/11 100 Loaded
12433555 7/21/11 7/22/11 100 Loaded
12311555 7/21/11 7/22/11 100 Loaded
**404**
54564564 7/21/11 7/23/11 50 Sequential
54564564 7/21/11 7/23/11 50 Sequential
54500564 7/21/11 7/23/11 50 Sequential
İşte arkasındaki kod. Yardım edeceğini sanmıyorum. Çoğu sadece modelde gösterilecek verileri test eder. Unreal
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
namespace Son_of_a_Batching_WPF_Mock_up
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
private ObservableCollection<TestData> _testDataCollection = new ObservableCollection<TestData>();
public ObservableCollection<TestData> testDataCollection { get { return _testDataCollection; } }
//public System.ComponentModel.ICollectionView source { get; set; }
public Window1()
{
InitializeComponent();
//this.source.GroupDescriptions.Add(new PropertyGroupDescription("workcenter"));
LoadTestData();
}
private void LoadTestData()
{
//int[] icnt = new int[529];
for (int i = 0; i <= 99; i++)
{
_testDataCollection.Add(new TestData());
}
//for (int i = 0; i < _testDataCollection.Count; i++)
//{
// icnt[int.Parse(_testDataCollection[i].workcenter)] ++;
//}
//this.label1.Content = "332:" + icnt[332].ToString() + "," + "402:" + icnt[402].ToString() + ","+ "404:" + icnt[404].ToString() + ","
// + "522:" + icnt[522].ToString() + ","+ "523:" + icnt[523].ToString() + ","+ "524:" + icnt[524].ToString() + ","
// + "527:" + icnt[527].ToString() + ","+ "528:" + icnt[528].ToString() + ",";
}
}
public class TestData
{
private string[] _WCs = new string[] { "404", "527", "523", "524", "332", "528", "522", "402" };
private string[] _workcenters = new string[1000];
private string _workcenter;
private double _duration = 0;
public string id
{
get { return Guid.NewGuid().ToString(); }
}
public string workcenter
{
get
{
return _workcenter;
}
}
public DateTime start
{
get { return DateTime.Now; }
}
public DateTime end
{
get { return DateTime.Now; }
}
public double duration
{
get
{
return _duration;
}
}
public string batchtype
{
get
{
switch (workcenter)
{
case "332":
case "402":
case "527":
return "Loaded Batch";
case "404":
case "524":
return "Sequential Batch";
case "522":
case "528":
case "523":
return "Supervisor Batch";
default:
return "";
}
}
}
public TestData()
{
RandomizeWCs();
Random rnd = new Random();
_workcenter = _workcenters[rnd.Next(0, 999)];
rnd = new Random();
_duration = rnd.Next(10, 60);
}
private void RandomizeWCs()
{
Random rnd = new Random();
int iIndex, i;
while (_workcenters.Contains(null))
{
iIndex = rnd.Next(1000);
i = rnd.Next(8);
if (_workcenters[iIndex] == null)
{
_workcenters[iIndex] = _WCs[i];
}
}
}
}
}
Ekranda ne var ne yok? – CodingGorilla
Artık her şeyi doğru şekilde gruplandırıyorum, sadece grup metni görüntülenmiyor. Yani, temelde 'İstediğim şudur, 332, 404 gruptur.' sadece ** 332 ** ve ** 404 ** gösterilmeden görüntülenir. Maalesef henüz resim yayınlayamıyorum. – Yatrix
"Son_of_a_Batching" adı için oyumu al, siz fargin sneaky bastage! (NOT: Bu, "Johnny Dangerously" adlı bir film referansıdır) http://www.imdb.com/title/tt0087507/quotes –