これについては、単純な2レベルのItemsControl(ListBox)ソリューションしか考えられません。また、内部の視覚的要素は、 'O'や 'X'のように見えるStyled CheckBoxでもかまいません。もちろん、チェックボックスに合わせて上部にDateHeaderコレクションが必要です。
alt text http://img339.imageshack.us/img339/8695/grid.jpg
XAML
<UserControl.Resources>
<DataTemplate x:Key="CellTemplate">
<Grid Width="25" Height="25">
<CheckBox IsChecked="{Binding IsPresent}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
<DataTemplate x:Key="RowTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Margin="4,0,0,0" Text="{Binding Name}" TextWrapping="Wrap"/>
<ItemsControl ItemsSource="{Binding WorkingDays}" HorizontalAlignment="Left" VerticalAlignment="Top" ItemTemplate="{StaticResource CellTemplate}" Grid.Column="1" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Grid>
</DataTemplate>
</UserControl.Resources>
<ItemsControl x:Name="lstWorkingDaysMain" ItemsSource="{Binding}" ItemTemplate="{StaticResource RowTemplate}" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
C#の
public class Student
{
public Student()
{
WorkingDays = new List<WorkingDay>();
}
public string Name { get; set; }
public List<WorkingDay> WorkingDays { get; set; }
}
public class WorkingDay
{
public bool IsPresent{get; set;}
public DateTime Date { get; set; }
}
とSilverlightの面でxaml.csオフトピック
List<Student> students = new List<Student>();
Student student = new Student() { Name = "Aaaaaa" };
student.WorkingDays.Add(new WorkingDay() { Date=new DateTime(2009,5,5), IsPresent=true});
student.WorkingDays.Add(new WorkingDay() { Date=new DateTime(2009,5,6), IsPresent=true});
student.WorkingDays.Add(new WorkingDay() { Date=new DateTime(2009,5,7), IsPresent=true});
student.WorkingDays.Add(new WorkingDay() { Date=new DateTime(2009,5,8), IsPresent=true});
student.WorkingDays.Add(new WorkingDay() { Date=new DateTime(2009,5,9), IsPresent=true});
student.WorkingDays.Add(new WorkingDay() { Date=new DateTime(2009,5,10), IsPresent=true});
student.WorkingDays.Add(new WorkingDay() { Date=new DateTime(2009,5,11), IsPresent=true});
student.WorkingDays.Add(new WorkingDay() { Date=new DateTime(2009,5,12), IsPresent=true});
students.Add(student);
student = new Student() { Name = "Bbbbbb" };
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 5), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 6), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 7), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 8), IsPresent = false });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 9), IsPresent = false });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 10), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 11), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 12), IsPresent = true });
students.Add(student);
student = new Student() { Name = "Cccccc" };
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 5), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 6), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 7), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 8), IsPresent = false });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 9), IsPresent = false });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 10), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 11), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 12), IsPresent = false });
students.Add(student);
student = new Student() { Name = "Dddddd" };
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 5), IsPresent = false });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 6), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 7), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 8), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 9), IsPresent = false });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 10), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 11), IsPresent = true });
student.WorkingDays.Add(new WorkingDay() { Date = new DateTime(2009, 5, 12), IsPresent = true });
students.Add(student);
this.DataContext = students;
の背後にあるコードでのテストデータ母集団、彼らが出席した時の表示のポイントは何ですか?ユーザーとして、私は彼らがいつ出席しなかったかだけ気にします。全体のパーセンテージが役立つかもしれませんが、視覚的にすべての出席者を表示すると、実際に出席者以外の出席者の例外を見ることは非常に困難になります。 定期的に参加しない人はいませんか? – mattmanser
同じセッションですべての生徒を見ているなら、あなたは合っています。しかし、すべてのセッションを同時に見ることができるので、出席パターンを見ることもできます。私はディスプレイの不在を強調する。 – geofftnz