-
Notifications
You must be signed in to change notification settings - Fork 298
Expand file tree
/
Copy pathVirtualizingWrapPanelExample.xaml
More file actions
119 lines (116 loc) · 5.74 KB
/
Copy pathVirtualizingWrapPanelExample.xaml
File metadata and controls
119 lines (116 loc) · 5.74 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<ws:Window x:Class="WPFDevelopers.Sample.ExampleViews.VirtualizingWrapPanelExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ws="https://github.com/WPFDevelopersOrg/WPFDevelopers"
xmlns:local="clr-namespace:WPFDevelopers.Sample.ExampleViews"
xmlns:model="clr-namespace:WPFDevelopers.Sample.Models"
xmlns:converts="clr-namespace:WPFDevelopers.Sample.Converts"
WindowStyle="ToolWindow"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="System V1.0" Height="450" Width="900">
<Window.Resources>
<model:HospitalList x:Key="myHospitalList"/>
<converts:StateConvert x:Key="stateConvert"></converts:StateConvert>
</Window.Resources>
<Grid Margin="4">
<WrapPanel HorizontalAlignment="Left">
<WrapPanel.Resources>
<Style TargetType="Border">
<Setter Property="Padding" Value="2"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
</Style>
<Style TargetType="Rectangle">
<Setter Property="Width" Value="15"></Setter>
<Setter Property="Height" Value="15"></Setter>
<Setter Property="Opacity" Value=".2"></Setter>
</Style>
</WrapPanel.Resources>
<WrapPanel>
<Border BorderBrush="Green">
<Rectangle Fill="Green"/>
</Border>
<TextBlock Text="Idle" Foreground="Black" Margin="4,0"/>
</WrapPanel>
<WrapPanel>
<Border BorderBrush="Orange">
<Rectangle Fill="Orange"/>
</Border>
<TextBlock Text="Slightly Idle" Foreground="Black" Margin="4,0"/>
</WrapPanel>
<WrapPanel>
<Border BorderBrush="Red">
<Rectangle Fill="Red"/>
</Border>
<TextBlock Text="Busy" Foreground="Black" Margin="4,0"/>
</WrapPanel>
</WrapPanel>
<TextBlock HorizontalAlignment="Right" Foreground="Black"
Margin="4,2" FontSize="16">
<Run Text="Count:"></Run>
<Run Text="{Binding ElementName=DocumentsList,Path=.Items.Count,Mode=OneTime}"></Run>
</TextBlock>
<ListBox x:Name="DocumentsList"
ItemsSource="{Binding Source={StaticResource myHospitalList}}"
Margin="0,24,0,0">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="{Binding State,Converter={StaticResource stateConvert}}"
BorderThickness="1"
Width="196"
Height="94">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Rectangle
Fill="{Binding State,Converter={StaticResource stateConvert}}"
Opacity=".2" Grid.ColumnSpan="2"
Grid.RowSpan="3"/>
<Border Grid.RowSpan="2" Grid.Column="0" Width="60" Height="60"
Margin="0,4,0,0" CornerRadius="10">
<Border.Background>
<ImageBrush ImageSource="{Binding UserImage}" Stretch="Uniform"/>
</Border.Background>
</Border>
<TextBlock Grid.Column="1" Grid.Row="0"
Text="{Binding Path=Id}" Margin="0,4,0,0"/>
<TextBlock Grid.Column="1" Grid.Row="1"
Text="{Binding Path=DoctorName}"/>
<TextBlock Grid.ColumnSpan="2" Grid.Row="2"
Padding="10,0"
Text="{Binding Path=HospitalName}" TextTrimming="CharacterEllipsis"/>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.Template>
<ControlTemplate>
<Border CornerRadius="2"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer x:Name="ScrollViewer"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="Transparent" BorderThickness="0" IsTabStop="False">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<ws:VirtualizingWrapPanel ItemWidth="200"
ItemHeight="100"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</Grid>
</ws:Window>