PageRenderTime 21ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 3ms app.codeStats 0ms

/Application/GUI/Controls/ViewDetails.xaml

http://yet-another-music-application.googlecode.com/
XAML | 408 lines | 362 code | 10 blank | 36 comment | 0 complexity | 3599fd90953dc17d76b661539a1d532d MD5 | raw file
  1<!--ViewDetails.xaml
  2	
  3	A modified ListView that looks extremely sexy.
  4	
  5	Features:
  6	   Drag-n-Drop
  7	   Column sort
  8	   Column toggle
  9	   Icons
 10	   Strikethrough
 11	   Active items
 12	   Explorer-like look
 13
 14	It also sports a convenient storage structure for use to
 15	import and export the configuration in order to allow for
 16	easy saving of the configuration between different sessions.
 17	
 18	= = = = = = = = = =
 19	
 20	This code is part of the Stoffi Music Player Project.
 21	Visit our website at: stoffiplayer.com
 22	
 23	This program is free software; you can redistribute it and/or
 24	modify it under the terms of the GNU General Public License
 25	as published by the Free Software Foundation; either version
 26	3 of the License, or (at your option) any later version.
 27	
 28	See stoffiplayer.com/license for more information.
 29	-->
 30<ListView x:Class="Stoffi.ViewDetails"
 31          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 32          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 33          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
 34          xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
 35          mc:Ignorable="d" 
 36          d:DesignHeight="300" d:DesignWidth="300"
 37		  Loaded="ListView_Loaded">
 38	<ListView.Resources>
 39
 40		<!-- Aero styles -->
 41		<Style x:Key="AeroRowStyle" TargetType="{x:Type ListViewItem}">
 42			<Setter Property="Background" Value="Transparent"/>
 43			<Setter Property="BorderBrush" Value="Transparent"/>
 44			<Setter Property="BorderThickness" Value="1"/>
 45			<Setter Property="Margin" Value="0,0,0,1"/>
 46			<Setter Property="Padding" Value="5,3,5,3"/>
 47			<Setter Property="VerticalContentAlignment" Value="Center"/>
 48			<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
 49			<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
 50			<Setter Property="Template">
 51				<Setter.Value>
 52					<ControlTemplate TargetType="{x:Type ListViewItem}">
 53						<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="17,0,0,0" Padding="0"
 54                                Background="{TemplateBinding Background}" CornerRadius="2" SnapsToDevicePixels="True" VerticalAlignment="Stretch">
 55							<Border x:Name="InnerBorder" BorderThickness="1" CornerRadius="1" VerticalAlignment="Stretch" Margin="0" Padding="0" SnapsToDevicePixels="True">
 56								<Grid VerticalAlignment="Stretch" Margin="0" SnapsToDevicePixels="True">
 57									<Grid.RowDefinitions>
 58										<RowDefinition MaxHeight="11"/>
 59										<RowDefinition/>
 60									</Grid.RowDefinitions>
 61									
 62									<!-- Presenter -->
 63									<GridViewRowPresenter Grid.RowSpan="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="-17,0,0,0" />
 64									
 65									<!-- Strike -->
 66									<Border Background="Black" VerticalAlignment="Bottom" Height="1" SnapsToDevicePixels="True" x:Name="Strikethrough" Visibility="Collapsed"/>
 67									
 68								</Grid>
 69							</Border>
 70						</Border>
 71						<ControlTemplate.Triggers>
 72							<DataTrigger Binding="{Binding Path=Strike}" Value="True">
 73								<Setter TargetName="Strikethrough" Property="Visibility" Value="Visible"/>
 74							</DataTrigger>
 75							<Trigger Property="IsMouseOver" Value="true">
 76								<Setter Property="Background">
 77									<Setter.Value>
 78										<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
 79											<GradientStop Color="#fffafbfd" Offset="0"/>
 80											<GradientStop Color="#ffebf4fd" Offset="1"/>
 81										</LinearGradientBrush>
 82									</Setter.Value>
 83								</Setter>
 84								<Setter Property="BorderBrush" Value="#ffb8d6fa"/>
 85								<Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
 86							</Trigger>
 87							<Trigger Property="IsSelected" Value="true">
 88								<Setter Property="Background">
 89									<Setter.Value>
 90										<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
 91											<GradientStop Color="#FFdbebfb" Offset="0"/>
 92											<GradientStop Color="#FFc1dcfa" Offset="1"/>
 93										</LinearGradientBrush>
 94									</Setter.Value>
 95								</Setter>
 96								<Setter Property="BorderBrush" Value="#FF7da2ce"/>
 97								<Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
 98							</Trigger>
 99							<MultiTrigger>
100								<MultiTrigger.Conditions>
101									<Condition Property="IsSelected" Value="true"/>
102									<Condition Property="Selector.IsSelectionActive" Value="false"/>
103								</MultiTrigger.Conditions>
104								<Setter Property="Background">
105									<Setter.Value>
106										<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
107											<GradientStop Color="#fff8f8f8" Offset="0"/>
108											<GradientStop Color="#ffe5e5e5" Offset="1"/>
109										</LinearGradientBrush>
110									</Setter.Value>
111								</Setter>
112								<Setter Property="BorderBrush" Value="#FFd9d9d9"/>
113								<Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
114							</MultiTrigger>
115							<MultiTrigger>
116								<MultiTrigger.Conditions>
117									<Condition Property="IsSelected" Value="true"/>
118									<Condition Property="Selector.IsSelectionActive" Value="false"/>
119									<Condition Property="IsMouseOver" Value="true"/>
120								</MultiTrigger.Conditions>
121								<Setter Property="Background">
122									<Setter.Value>
123										<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
124											<GradientStop Color="#FFdbebfb" Offset="0"/>
125											<GradientStop Color="#FFc1dcfa" Offset="1"/>
126										</LinearGradientBrush>
127									</Setter.Value>
128								</Setter>
129								<Setter Property="BorderBrush" Value="#FF7da2ce"/>
130								<Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
131							</MultiTrigger>
132							<MultiDataTrigger>
133								<MultiDataTrigger.Conditions>
134									<Condition Binding="{Binding Path=IsActive}" Value="True"/>
135								</MultiDataTrigger.Conditions>
136								<Setter Property="Background">
137									<Setter.Value>
138										<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
139											<GradientStop Color="#77dbfbeb" Offset="0"/>
140											<GradientStop Color="#77c1fadc" Offset="1"/>
141										</LinearGradientBrush>
142									</Setter.Value>
143								</Setter>
144								<Setter Property="BorderBrush" Value="#777dcea2"/>
145								<Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
146							</MultiDataTrigger>
147							<MultiDataTrigger>
148								<MultiDataTrigger.Conditions>
149									<Condition Binding="{Binding
150										RelativeSource={RelativeSource Mode=Self},
151										Path=IsMouseOver}" Value="True"/>
152									<Condition Binding="{Binding Path=IsActive}" Value="True"/>
153								</MultiDataTrigger.Conditions>
154								<Setter Property="Background">
155									<Setter.Value>
156										<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
157											<GradientStop Color="#AAdbfbeb" Offset="0"/>
158											<GradientStop Color="#AAc1fadc" Offset="1"/>
159										</LinearGradientBrush>
160									</Setter.Value>
161								</Setter>
162								<Setter Property="BorderBrush" Value="#AA7dcea2"/>
163								<Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
164							</MultiDataTrigger>
165							<MultiDataTrigger>
166								<MultiDataTrigger.Conditions>
167									<Condition Binding="{Binding
168										RelativeSource={RelativeSource Mode=Self},
169										Path=IsSelected}" Value="True"/>
170									<Condition Binding="{Binding Path=IsActive}" Value="True"/>
171								</MultiDataTrigger.Conditions>
172								<Setter Property="Background">
173									<Setter.Value>
174										<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
175											<GradientStop Color="#FFdbfbeb" Offset="0"/>
176											<GradientStop Color="#FFc1fadc" Offset="1"/>
177										</LinearGradientBrush>
178									</Setter.Value>
179								</Setter>
180								<Setter Property="BorderBrush" Value="#FF7dcea2"/>
181								<Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
182							</MultiDataTrigger>
183							<Trigger Property="IsEnabled" Value="false">
184								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
185							</Trigger>
186						</ControlTemplate.Triggers>
187					</ControlTemplate>
188				</Setter.Value>
189			</Setter>
190		</Style>
191		<Style x:Key="AeroHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
192			<Setter Property="Background" Value="{x:Null}"/>
193			<Setter Property="Foreground" Value="#FF5A6779"/>
194			<Setter Property="BorderBrush" Value="{x:Null}"/>
195			<Setter Property="Margin" Value="0,0,0,10"/>
196		</Style>
197		<Style x:Key="AeroHeaderThumbStyle" TargetType="{x:Type Thumb}">
198			<Setter Property="Canvas.Right" Value="-8"/>
199			<Setter Property="Canvas.Top" Value="-1"/>
200			<Setter Property="Width" Value="18"/>
201			<Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource TemplatedParent}}"/>
202			<Setter Property="Padding" Value="0"/>
203			<Setter Property="Background" Value="Transparent"/>
204			<Setter Property="Template">
205				<Setter.Value>
206					<ControlTemplate TargetType="{x:Type Thumb}">
207						<Border Background="#00F90000" Padding="0" BorderThickness="1">
208							<Rectangle x:Name="HeaderThumb" HorizontalAlignment="Center" Width="1">
209								<Rectangle.Fill>
210									<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
211										<GradientStop Color="#d6e5f5" Offset="0.0" />
212										<GradientStop Color="White" Offset="1.0" />
213									</LinearGradientBrush>
214								</Rectangle.Fill>
215							</Rectangle>
216						</Border>
217					</ControlTemplate>
218				</Setter.Value>
219			</Setter>
220		</Style>
221		<Style x:Key="AeroHeaderThumbHoverStyle" TargetType="{x:Type Thumb}">
222			<Setter Property="Canvas.Right" Value="-8"/>
223			<Setter Property="Canvas.Top" Value="-1"/>
224			<Setter Property="Width" Value="18"/>
225			<Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource TemplatedParent}}"/>
226			<Setter Property="Padding" Value="0"/>
227			<Setter Property="Background" Value="Transparent"/>
228			<Setter Property="Template">
229				<Setter.Value>
230					<ControlTemplate TargetType="{x:Type Thumb}">
231						<Border Background="#00F90000" Padding="0" BorderThickness="1">
232							<Rectangle x:Name="HeaderThumb" Fill="#FFe2e8f1" HorizontalAlignment="Center" Width="1"/>
233						</Border>
234					</ControlTemplate>
235				</Setter.Value>
236			</Setter>
237		</Style>
238		<LinearGradientBrush x:Key="AeroListItemActiveFill" EndPoint="0,1" StartPoint="0,0">
239			<GradientStop Color="#33dbfbdd" Offset="0"/>
240			<GradientStop Color="#33c1fcc9" Offset="1"/>
241		</LinearGradientBrush>
242		<LinearGradientBrush x:Key="AeroListItemActiveHoverFill" EndPoint="0,1" StartPoint="0,0">
243			<GradientStop Color="#88dbfbdd" Offset="0"/>
244			<GradientStop Color="#88c1fcc9" Offset="1"/>
245		</LinearGradientBrush>
246		<LinearGradientBrush x:Key="AeroListItemActiveSelectedFill" EndPoint="0,1" StartPoint="0,0">
247			<GradientStop Color="#ffdbfbdd" Offset="0"/>
248			<GradientStop Color="#ffc1fcc9" Offset="1"/>
249		</LinearGradientBrush>
250		<LinearGradientBrush x:Key="AeroListItemSelectedFill" EndPoint="0,1" StartPoint="0,0">
251			<GradientStop Color="#FFdbebfb" Offset="0"/>
252			<GradientStop Color="#FFc1dcfa" Offset="1"/>
253		</LinearGradientBrush>
254		<LinearGradientBrush x:Key="AeroListItemSelectedInactiveFill" EndPoint="0,1" StartPoint="0,0">
255			<GradientStop Color="#fff8f8f8" Offset="0"/>
256			<GradientStop Color="#ffe5e5e5" Offset="1"/>
257		</LinearGradientBrush>
258		<LinearGradientBrush x:Key="AeroListItemSelectedHoverFill" EndPoint="0,1" StartPoint="0,0">
259			<GradientStop Color="#77EAF9FF" Offset="0"/>
260			<GradientStop Color="#77C9EDFD" Offset="1"/>
261		</LinearGradientBrush>
262		<ControlTemplate x:Key="AeroHeaderTemplate" TargetType="{x:Type GridViewColumnHeader}">
263			<Grid>
264				<Border BorderBrush="Transparent" Background="Transparent" BorderThickness="1,0,1,1" x:Name="OuterBorder" SnapsToDevicePixels="True">
265					<Border BorderBrush="Transparent" BorderThickness="0,1,0,0" Background="Transparent" x:Name="InnerBorder" 
266						Margin="1,0,1,1" Padding="0" SnapsToDevicePixels="True">
267						<ContentPresenter x:Name="HeaderContent" 
268										  Margin="0"
269										  Content="{TemplateBinding Content}" 
270										  ContentStringFormat="{TemplateBinding ContentStringFormat}" 
271										  ContentTemplate="{TemplateBinding ContentTemplate}"/>
272					</Border>
273				</Border>
274				<Canvas>
275					<Thumb x:Name="PART_HeaderGripper" Style="{StaticResource AeroHeaderThumbStyle}"/>
276				</Canvas>
277			</Grid>
278			<ControlTemplate.Triggers>
279				<Trigger Property="IsMouseOver" Value="True">
280					<Setter TargetName="OuterBorder" Property="BorderBrush" Value="#e2e8f1"/>
281					<Setter TargetName="InnerBorder" Property="Background" Value="#f5f7fa"/>
282					<Setter TargetName="InnerBorder" Property="BorderBrush" Value="#f5f7fa"/>
283					<Setter TargetName="PART_HeaderGripper" Property="Style" Value="{StaticResource AeroHeaderThumbHoverStyle}"/>
284				</Trigger>
285			</ControlTemplate.Triggers>
286		</ControlTemplate>
287		<GroupStyle x:Key="AeroGroupStyle">
288			<GroupStyle.HeaderTemplate>
289				<DataTemplate>
290					<Border BorderBrush="Transparent" BorderThickness="1" Margin="0 13 0 0" Padding="10 5" Background="Transparent" 
291							CornerRadius="2" SnapsToDevicePixels="True" VerticalAlignment="Stretch" x:Name="OuterBorder">
292						<Border x:Name="InnerBorder" BorderThickness="1" CornerRadius="1" VerticalAlignment="Stretch" Margin="0" Padding="0" SnapsToDevicePixels="True">
293							<Grid>
294								<Grid.ColumnDefinitions>
295									<ColumnDefinition Width="Auto"/>
296									<ColumnDefinition Width="*"/>
297								</Grid.ColumnDefinitions>
298								<TextBlock Grid.Column="0" FontSize="14" Text="{Binding Name}" Foreground="#1E3287"/>
299								<Separator Grid.Column="1" Background="#E2E2E2" Height="1" HorizontalAlignment="Stretch" Margin="5 0 5 0" SnapsToDevicePixels="True" />
300							</Grid>
301						</Border>
302					</Border>
303					<DataTemplate.Triggers>
304						<Trigger Property="IsMouseOver" Value="true">
305							<Setter TargetName="OuterBorder" Property="Background">
306								<Setter.Value>
307									<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
308										<GradientStop Color="#fffafbfd" Offset="0"/>
309										<GradientStop Color="#ffebf4fd" Offset="1"/>
310									</LinearGradientBrush>
311								</Setter.Value>
312							</Setter>
313							<Setter TargetName="OuterBorder" Property="BorderBrush" Value="#ffb8d6fa"/>
314							<Setter TargetName="InnerBorder" Property="BorderBrush" Value="#80FFFFFF"/>
315						</Trigger>
316					</DataTemplate.Triggers>
317				</DataTemplate>
318			</GroupStyle.HeaderTemplate>
319		</GroupStyle>
320
321		<!-- Classic styles -->
322		<Style x:Key="ClassicRowStyle" TargetType="{x:Type ListViewItem}">
323			<Setter Property="Background" Value="Transparent"/>
324			<Setter Property="BorderBrush" Value="Transparent"/>
325			<Setter Property="BorderThickness" Value="1"/>
326			<Setter Property="Margin" Value="0,0,0,1"/>
327			<Setter Property="Padding" Value="5,5,5,5"/>
328			<Setter Property="VerticalContentAlignment" Value="Center"/>
329			<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
330			<Setter Property="Template">
331				<Setter.Value>
332					<ControlTemplate TargetType="{x:Type ListViewItem}">
333						<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="17,0,0,0" Padding="0"
334                                Background="{TemplateBinding Background}" CornerRadius="0" SnapsToDevicePixels="True" VerticalAlignment="Stretch">
335							<Border x:Name="InnerBorder" BorderThickness="1" CornerRadius="0" VerticalAlignment="Stretch" Margin="0" Padding="0" SnapsToDevicePixels="True">
336								<Grid VerticalAlignment="Stretch" Margin="0" SnapsToDevicePixels="True">
337									<Grid.RowDefinitions>
338										<RowDefinition MaxHeight="11"/>
339										<RowDefinition/>
340									</Grid.RowDefinitions>
341
342									<!-- Presenter -->
343									<GridViewRowPresenter Grid.RowSpan="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="-17,0,0,0"/>
344
345									<!-- Strike -->
346									<Border Background="Black" VerticalAlignment="Bottom" Height="1" SnapsToDevicePixels="True" x:Name="Strikethrough" Visibility="Collapsed"/>
347
348								</Grid>
349							</Border>
350						</Border>
351						<ControlTemplate.Triggers>
352							<DataTrigger Binding="{Binding Path=Strike}" Value="True">
353								<Setter TargetName="Strikethrough" Property="Visibility" Value="Visible"/>
354							</DataTrigger>
355							<Trigger Property="IsSelected" Value="true">
356								<Setter Property="Background" Value="MidnightBlue" />
357								<Setter TargetName="Strikethrough" Property="Background" Value="White" />
358								<Setter Property="Foreground" Value="White" />
359							</Trigger>
360							<MultiDataTrigger>
361								<MultiDataTrigger.Conditions>
362									<Condition Binding="{Binding Path=IsActive}" Value="True"/>
363								</MultiDataTrigger.Conditions>
364								<Setter Property="Background" Value="DarkSeaGreen" />
365								<Setter TargetName="Strikethrough" Property="Background" Value="White" />
366							</MultiDataTrigger>
367							<MultiDataTrigger>
368								<MultiDataTrigger.Conditions>
369									<Condition Binding="{Binding
370										RelativeSource={RelativeSource Mode=Self},
371										Path=IsSelected}" Value="True"/>
372									<Condition Binding="{Binding Path=IsActive}" Value="True"/>
373								</MultiDataTrigger.Conditions>
374								<Setter Property="Background" Value="SeaGreen" />
375								<Setter TargetName="Strikethrough" Property="Background" Value="White" />
376								<Setter Property="Foreground" Value="White" />
377							</MultiDataTrigger>
378						</ControlTemplate.Triggers>
379					</ControlTemplate>
380				</Setter.Value>
381			</Setter>
382		</Style>
383		<Style x:Key="ClassicHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
384		</Style>
385		<Style x:Key="ClassicStyle" TargetType="{x:Type ListView}">
386			<Setter Property="BorderBrush" Value="{x:Null}"/>
387			<Setter Property="BorderThickness" Value="0"/>
388		</Style>
389
390		<!-- Data templates -->
391		<DataTemplate x:Key="HeaderTemplateArrowUp">
392			<DockPanel>
393				<Image Source="/GUI/Images/Misc/SortArrowUp.png" DockPanel.Dock="Top" Width="7" Height="4"/>
394				<TextBlock Text="{Binding}" DockPanel.Dock="Top" Margin="5,0,3,0" TextTrimming="CharacterEllipsis"/>
395			</DockPanel>
396		</DataTemplate>
397		<DataTemplate x:Key="HeaderTemplateArrowDown">
398			<DockPanel>
399				<Image Source="/GUI/Images/Misc/SortArrowDown.png" DockPanel.Dock="Top" Width="7" Height="4"/>
400				<TextBlock Text="{Binding}" DockPanel.Dock="Top" Margin="5,0,3,0" TextTrimming="CharacterEllipsis"/>
401			</DockPanel>
402		</DataTemplate>
403		<DataTemplate x:Key="HeaderTemplate">
404			<TextBlock Text="{Binding}" Margin="5,4,3,0" TextTrimming="CharacterEllipsis"/>
405		</DataTemplate>
406
407	</ListView.Resources>
408</ListView>