source: extensions/PiwigoLib/PiwigoWpf/MainWindow.xaml @ 11904

Last change on this file since 11904 was 11904, checked in by bayral, 13 years ago

PiwigoWPF

File size: 10.5 KB
Line 
1<Window x:Class="Com.Piwigo.Wpf.MainWindow"
2        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4        xmlns:pwg="clr-namespace:Com.Piwigo.Wpf"
5        xmlns:pwgdto="clr-namespace:Com.Piwigo.Wpf.DTO"
6        xmlns:pwgcmd="clr-namespace:Com.Piwigo.Wpf.Command"
7        xmlns:pwgsrv="clr-namespace:Com.Piwigo.Wpf.Service"
8        Title="PiwigoWpf"
9        WindowState="Maximized"
10        MinHeight="600" MinWidth="800">
11    <Window.Resources>
12        <ObjectDataProvider x:Key="listCat" IsAsynchronous="True" />
13        <ObjectDataProvider x:Key="listImg" IsAsynchronous="True" />
14
15              <!-- DATA TEMPLATES -->
16
17        <DataTemplate DataType="{x:Type pwgdto:PwgImageWPF}">
18            <Border VerticalAlignment="Center" HorizontalAlignment="Center" Padding="4" Margin="2" Background="Blue"
19                    DataContext="{Binding}"><!--Source="{Binding UrlElement}"-->
20                <Image ToolTip="{Binding File}" >
21                    <Image.Source>
22                        <PriorityBinding FallbackValue="pack://application:,,,/Pictures/Globe.png">
23                            <Binding IsAsync="True" Converter="{x:Static pwgsrv:ImageCacheManager.ImageUrlCachedConverter}"/>
24                           
25                    </PriorityBinding>
26                    </Image.Source>
27                </Image>
28            </Border>
29        </DataTemplate>
30
31        <DataTemplate DataType="{x:Type pwgdto:PwgCategoryWPF}"  >
32            <Border VerticalAlignment="Center" HorizontalAlignment="Center"
33                    Padding="4" Margin="1"
34                    Background="LightBlue"
35                    DataContext="{Binding}">
36                <StackPanel Orientation="Vertical" DataContext="{Binding}" VerticalAlignment="Center" >
37                    <Image Source="pack://application:,,,/Pictures/folder_images.png"
38                           Stretch="Uniform"
39                           MaxHeight="128"
40                           MaxWidth="128">
41                        <Image.ToolTip>
42                            <StackPanel Orientation="Vertical">
43                            <StackPanel Orientation="Horizontal">
44                                <TextBlock Text="{Binding Path=ImagesCount}"/>
45                                <TextBlock Text=" images inside"/>
46                            </StackPanel>
47                                <StackPanel Orientation="Horizontal">
48                                    <TextBlock Text="{Binding Path=SubCategoriesCount}"/>
49                                    <TextBlock Text=" categories inside"/>
50                                </StackPanel>
51                            </StackPanel>
52                        </Image.ToolTip>
53                    </Image>
54                    <TextBlock Text="{Binding Name}" />
55                </StackPanel>
56            </Border>
57        </DataTemplate>
58
59        <Style x:Key="CategoryListStyle" TargetType="{x:Type ListBox}">
60            <Setter Property="Template">
61                <Setter.Value>
62                    <ControlTemplate TargetType="{x:Type ListBox}" >
63                        <Border
64                                                        BorderBrush="Gray"
65                                                        BorderThickness="1"
66                                                        CornerRadius="6"
67                            Background="LightBlue"                           
68                                                         >
69                            <!--Background="{DynamicResource ListBoxGradient}"-->
70                            <ScrollViewer
71                                                                VerticalScrollBarVisibility="Auto"
72                                                                HorizontalScrollBarVisibility="Disabled">
73                                <StackPanel 
74                                                                        IsItemsHost="True"
75                                                                        Orientation="Vertical"
76                                                                        HorizontalAlignment="Center"
77                                    VerticalAlignment="Top"/>
78                            </ScrollViewer>
79                        </Border>
80                    </ControlTemplate>
81                </Setter.Value>
82            </Setter>
83        </Style>
84
85        <Style x:Key="CategoryListItem" TargetType="{x:Type ListBoxItem}">
86            <Setter Property="MaxHeight" Value="128" />
87            <Setter Property="MinHeight" Value="128" />
88            <Setter Property="Opacity" Value=".75" />
89            <Style.Triggers>
90                <EventTrigger RoutedEvent="Mouse.MouseEnter">
91                    <EventTrigger.Actions>
92                        <BeginStoryboard>
93                            <Storyboard>
94                                <DoubleAnimation
95                                                                        Duration="0:0:0.2"
96                                                                        Storyboard.TargetProperty="MaxHeight"
97                                                                        To="220" />
98                                <DoubleAnimation
99                                                                        Duration="0:0:0.2"
100                                                                        Storyboard.TargetProperty="Opacity"
101                                                                        To="1.0" />
102                            </Storyboard>
103                        </BeginStoryboard>
104                    </EventTrigger.Actions>
105                </EventTrigger>
106
107                <EventTrigger RoutedEvent="Mouse.MouseLeave">
108                    <EventTrigger.Actions>
109                        <BeginStoryboard>
110                            <Storyboard>
111                                <DoubleAnimation
112                                                                        Duration="0:0:1"
113                                                                        Storyboard.TargetProperty="MaxHeight" />
114                                <DoubleAnimation
115                                                                        Duration="0:0:0.2"
116                                                                        Storyboard.TargetProperty="Opacity" />
117                            </Storyboard>
118                        </BeginStoryboard>
119                    </EventTrigger.Actions>
120                </EventTrigger>
121            </Style.Triggers>
122        </Style>
123        <!-- PHOTOLIST TEMPLATE -->
124       
125        <Style x:Key="PhotoListStyle" TargetType="{x:Type ListBox}">
126            <Setter Property="Template">
127                <Setter.Value>
128                    <ControlTemplate TargetType="{x:Type ListBox}" >
129                        <Border
130                                                        BorderBrush="Gray"
131                                                        BorderThickness="1"
132                                                        CornerRadius="6"
133                            Background="LightBlue"                           
134                                                         >
135                            <!--Background="{DynamicResource ListBoxGradient}"-->
136                            <ScrollViewer
137                                                                VerticalScrollBarVisibility="Disabled"
138                                                                HorizontalScrollBarVisibility="Auto">
139                                <StackPanel 
140                                                                        IsItemsHost="True"
141                                                                        Orientation="Horizontal"
142                                                                        HorizontalAlignment="Left" />
143                            </ScrollViewer>
144                        </Border>
145                    </ControlTemplate>
146                </Setter.Value>
147            </Setter>
148        </Style>
149
150        <!-- PHOTOLIST STORYBOARDS -->
151
152        <Style x:Key="PhotoListItem" TargetType="{x:Type ListBoxItem}">
153            <Setter Property="MaxHeight" Value="75" />
154            <Setter Property="MinHeight" Value="75" />
155            <Setter Property="Opacity" Value=".75" />
156            <Style.Triggers>
157                <EventTrigger RoutedEvent="Mouse.MouseEnter">
158                    <EventTrigger.Actions>
159                        <BeginStoryboard>
160                            <Storyboard>
161                                <DoubleAnimation
162                                                                        Duration="0:0:0.2"
163                                                                        Storyboard.TargetProperty="MaxHeight"
164                                                                        To="85" />
165                                <DoubleAnimation
166                                                                        Duration="0:0:0.2"
167                                                                        Storyboard.TargetProperty="Opacity"
168                                                                        To="1.0" />
169                            </Storyboard>
170                        </BeginStoryboard>
171                    </EventTrigger.Actions>
172                </EventTrigger>
173
174                <EventTrigger RoutedEvent="Mouse.MouseLeave">
175                    <EventTrigger.Actions>
176                        <BeginStoryboard>
177                            <Storyboard>
178                                <DoubleAnimation
179                                                                        Duration="0:0:1"
180                                                                        Storyboard.TargetProperty="MaxHeight" />
181                                <DoubleAnimation
182                                                                        Duration="0:0:0.2"
183                                                                        Storyboard.TargetProperty="Opacity" />
184                            </Storyboard>
185                        </BeginStoryboard>
186                    </EventTrigger.Actions>
187                </EventTrigger>
188            </Style.Triggers>
189        </Style>
190
191        <!--<Style TargetType="{x:Type pwg:MainWindow}">
192            <Setter Property="Background" Value="{DynamicResource WindowGradient}" />
193        </Style>-->
194
195    </Window.Resources>
196    <DockPanel Name="mainDockPanel"  Margin="5">
197        <StackPanel Name="headerStackPanel" DockPanel.Dock="Top" Orientation="Vertical">
198            <Image Name="ImgPiwigoLogo" MinHeight="50" MinWidth="50"
199                   Source="pack://application:,,,/Pictures/PiwigoLogo.png"
200                   ToolTip="www.piwigo.org" Stretch="None" HorizontalAlignment="Left" />
201            <StackPanel Name="connectStackPanel" Orientation="Horizontal" VerticalAlignment="Center"  Margin="5"
202                        DataContext="{Binding Source={StaticResource Session}}">
203                <Label Content="User" Name="LblUsr" />
204                <TextBox Height="23" Name="BbUsr" Width="120" Text="{Binding Path=UserName, Mode=TwoWay}" />
205                <Label Content="Password" Name="LblPwd" />
206                <TextBox Height="23" Name="TbPwd" Width="120" Text="{Binding Path=Password, Mode=TwoWay}"/>
207                <Label Content="Url" Name="LblUrl" />
208                <TextBox Height="23" Name="TbUrl" Width="300" Text="{Binding Path=ServeurName, Mode=TwoWay}"/>
209                <CheckBox  VerticalAlignment="Center" IsChecked="{Binding Path=SaveSetting, Mode=TwoWay}">Save settings</CheckBox>
210                <Button Margin="2" Command="{x:Static pwgcmd:PwgCmdProvider.PwgCmdConnect}">Go</Button>
211            </StackPanel>
212           <ProgressBar IsIndeterminate="True" />         
213        </StackPanel>
214
215        <ListView Name="listViewCategory"  DockPanel.Dock="Left" MinWidth="100"
216                  Style="{DynamicResource CategoryListStyle}"
217                  ItemContainerStyle="{DynamicResource CategoryListItem}"
218                  DataContext="{Binding Source={StaticResource Categories}}"
219                  ItemsSource="{Binding }" MouseDoubleClick="listViewCategory_MouseDoubleClick" />
220        <ListView Name="listViewImage"  DockPanel.Dock="Right"  MinWidth="500"
221                  Style="{DynamicResource PhotoListStyle}"
222                  ItemContainerStyle="{DynamicResource PhotoListItem}"
223                  DataContext="{Binding Source={StaticResource Images}}"
224                  ItemsSource="{Binding }" />
225    </DockPanel>
226   
227</Window>
Note: See TracBrowser for help on using the repository browser.