-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
200 lines (190 loc) · 10.9 KB
/
MainWindow.xaml
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<Window x:Class="Reproductor.MainWindow"
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:local="clr-namespace:Reproductor"
mc:Ignorable="d"
Title="Reproductor" Height="200" Width="600" ResizeMode="CanResizeWithGrip" Icon="Recursos/icono.ico">
<Window.Resources>
<!-- Estilo slider -->
<Style x:Key="SliderRepeatButtonStyle" TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Rectangle Fill="Transparent"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="HorizontalSliderThumbStyle" TargetType="{x:Type Thumb}">
<Setter Property="Focusable" Value="false"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Height" Value="10"/>
<Setter Property="Width" Value="10"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Ellipse Fill="White" Stroke="Black" StrokeThickness="0.8" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Slider}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Slider}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Top" Grid.Row="0" Visibility="Collapsed"/>
<TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Bottom" Grid.Row="2" Visibility="Collapsed"/>
<Border x:Name="TrackBackground" CornerRadius="1" Height="5.0" Margin="5,0" Grid.Row="1" VerticalAlignment="center">
<Grid>
<Border Background="Black" CornerRadius="5" Opacity="0.215"/>
<Border Background="White" CornerRadius="5" Margin="0,0,0.3,0.3" Opacity="0.715"/>
</Grid>
</Border>
<Track x:Name="PART_Track" Grid.Row="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource SliderRepeatButtonStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource SliderRepeatButtonStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Style="{StaticResource HorizontalSliderThumbStyle}"/>
</Track.Thumb>
</Track>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Estilo botones -->
<Style x:Key="btnStyle" TargetType="{x:Type Button}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="bg" Background="{TemplateBinding Background}" BorderThickness="0" CornerRadius="10">
<ContentPresenter Width="auto"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightGray" TargetName="bg" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="Gray" TargetName="bg" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<!-- En grande la lista de canciones. En pequeño los controles -->
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<!-- Row 0: Lista de canciones -->
<ScrollViewer Grid.Row="0" x:Name="scv_scrollLista" PreviewMouseWheel="scv_scrollLista_PreviewMouseWheel">
<ListView x:Name="lst_listaCanciones" SelectionMode="Single"
AllowDrop="True"
DragLeave="lst_listaCanciones_DragLeave"
DragEnter="lst_listaCanciones_DragEnter"
Drop="lst_listaCanciones_Drop" BorderBrush="White"
MouseDoubleClick="lst_listaCanciones_MouseDoubleClick"
>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Height" Value="20" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
</ScrollViewer>
<!-- Row 1: Controles -->
<Grid Grid.Row="1">
<Grid>
<!-- 5 Controles: tiempo, anteior, play, siguiente,loop, volumen -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<!-- Tiempo -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="1.5*"/>
</Grid.RowDefinitions>
<Slider x:Name="sld_tiempo" Grid.Column="0" Margin="5,5,5,0">
</Slider>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" HorizontalAlignment="Left" Margin="5,0,0,0">00:00:00</TextBlock>
<TextBlock x:Name="tb_duracionCancion" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,5,0">99:99:99</TextBlock>
</Grid>
</Grid>
<!-- Anterior -->
<Button x:Name="btn_prev" Grid.Column="1" PreviewMouseUp="btn_prev_MouseDown" Margin="6" Style="{StaticResource btnStyle}">
<Image Source="Recursos/prev.png"></Image>
</Button>
<!-- Play -->
<Button x:Name="btn_play" Grid.Column="2" PreviewMouseUp="btn_play_MouseUp" Margin="2" Style="{StaticResource btnStyle}">
<Image x:Name="img_play" Source="Recursos/play.png"></Image>
</Button>
<!-- Siguiente -->
<Button x:Name="btn_next" Grid.Column="3" PreviewMouseUp="btn_next_MouseDown" Margin="6" Style="{StaticResource btnStyle}">
<Image Source="Recursos/next.png"></Image>
</Button>
<!-- Loop -->
<Button x:Name="btn_loop" Grid.Column="4" PreviewMouseUp="btn_loop_MouseDown" Margin="8" Style="{StaticResource btnStyle}">
<Image x:Name="img_loop" Source="Recursos/no_loop.png"></Image>
</Button>
<!-- Volumen -->
<Grid Grid.Column="5">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="1.5*"/>
</Grid.RowDefinitions>
<Slider x:Name="sld_volume" Grid.Row="0" ValueChanged="sld_volume_ValueChanged" Margin="5,5,5,0" Value="100" Maximum="100" Minimum="0"></Slider>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" HorizontalAlignment="Left" Margin="5,0,0,0">0</TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,5,0">100</TextBlock>
</Grid>
</Grid>
</Grid>
</Grid>
</Grid>
</Window>