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

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

WPF inprovement

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