1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| <Window x:Class="PivotTableSample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pt="clr-namespace:nsPivotTable;assembly=PivotTable"
xmlns:l="clr-namespace:PivotTableSample"
xmlns:s="clr-namespace:System;assembly=mscorlib"
Title="Window1">
<Window.DataContext>
<l:UserCommandCollection>
<l:UserCommand />
<l:UserCommand />
....
<l:UserCommand />
<l:UserCommand />
</l:UserCommandCollection>
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<pt:PivotTable x:Name="pt"
XAxis="CommandName"
YAxis="Username"
BorderBrush="BlueViolet"
BorderThickness="1"
Background="AliceBlue"
ItemsSource="{Binding}"
Margin="5"
Grid.Row="0">
<pt:PivotTable.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"
IsItemsHost="True" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsAccessible, Mode=TwoWay}"
Margin="5" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</pt:PivotTable.ItemTemplate>
<pt:PivotTable.ColumnHeaderTemplate>
<DataTemplate>
<Button Content="{Binding}"
Click="Button_Click">
<Button.LayoutTransform>
<RotateTransform Angle="-80" />
</Button.LayoutTransform>
</Button>
</DataTemplate>
</pt:PivotTable.ColumnHeaderTemplate>
</pt:PivotTable>
<ListBox ItemsSource="{Binding}"
Margin="5"
Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock>
<TextBlock Text="{Binding Username}" />
<TextBlock Text="{Binding CommandName}" />
<TextBlock Text="{Binding IsAccessible}" />
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Window> |
Partager