working tab switcher

This commit is contained in:
Royce551 2022-04-10 13:28:45 -05:00
parent e57677901a
commit 11e1b336c7
4 changed files with 19 additions and 7 deletions

View file

@ -29,7 +29,7 @@
<PackageReference Include="Avalonia.Desktop" Version="0.10.13" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.13" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.13" />
<PackageReference Include="Avalonia.Svg.Skia" Version="0.10.12" />
<PackageReference Include="Avalonia.Svg.Skia" Version="0.10.10" />
<PackageReference Include="DiscordRichPresence" Version="1.0.150" />
<PackageReference Include="FRESHMusicPlayer.Core" Version="4.0.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.3" />

View file

@ -341,6 +341,13 @@ namespace FRESHMusicPlayer.ViewModels
}
#endregion
public FontWeight TracksTabWeight => SelectedTab == Tab.Tracks ? FontWeight.Bold : FontWeight.Regular;
public FontWeight ArtistsTabWeight => SelectedTab == Tab.Artists ? FontWeight.Bold : FontWeight.Regular;
public FontWeight AlbumsTabWeight => SelectedTab == Tab.Albums ? FontWeight.Bold : FontWeight.Regular;
public FontWeight PlaylistsTabWeight => SelectedTab == Tab.Playlists ? FontWeight.Bold : FontWeight.Regular;
public FontWeight ImportTabWeight => SelectedTab == Tab.Import ? FontWeight.Bold : FontWeight.Regular;
private Tab selectedTab = Tab.Tracks;
public Tab SelectedTab
{
@ -349,6 +356,11 @@ namespace FRESHMusicPlayer.ViewModels
{
selectedTab = value;
this.RaisePropertyChanged(nameof(MainContent));
this.RaisePropertyChanged(nameof(TracksTabWeight));
this.RaisePropertyChanged(nameof(ArtistsTabWeight));
this.RaisePropertyChanged(nameof(AlbumsTabWeight));
this.RaisePropertyChanged(nameof(PlaylistsTabWeight));
this.RaisePropertyChanged(nameof(ImportTabWeight));
}
}
private Pane selectedPane = Pane.None;

View file

@ -187,11 +187,11 @@
</Grid>
<DockPanel DockPanel.Dock="Top" Height="30" LastChildFill="False">
<TextBlock Text="Tracks" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="10,0,10,0" PointerPressed="OnTracksPressed"/>
<TextBlock Text="Artists" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0" PointerPressed="OnArtistsPressed"/>
<TextBlock Text="Albums" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0" PointerPressed="OnAlbumsPressed"/>
<TextBlock Text="Playlists" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0" PointerPressed="OnPlaylistsPressed"/>
<TextBlock Text="Import" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0" PointerPressed="OnImportPressed"/>
<TextBlock x:Name="TracksHeader" Text="Tracks" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="10,0,10,0" Cursor="Hand" PointerPressed="OnTracksPressed" FontWeight="{Binding TracksTabWeight}"/>
<TextBlock x:Name="ArtistsHeader" Text="Artists" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0" Cursor="Hand" PointerPressed="OnArtistsPressed" FontWeight="{Binding ArtistsTabWeight}"/>
<TextBlock x:Name="AlbumsHeader" Text="Albums" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0" Cursor="Hand" PointerPressed="OnAlbumsPressed" FontWeight="{Binding AlbumsTabWeight}"/>
<TextBlock x:Name="PlaylistsHeader" Text="Playlists" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0" Cursor="Hand" PointerPressed="OnPlaylistsPressed" FontWeight="{Binding PlaylistsTabWeight}"/>
<TextBlock x:Name="ImportHeader" Text="Import" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0" Cursor="Hand" PointerPressed="OnImportPressed" FontWeight="{Binding ImportTabWeight}"/>
<Button Command="{Binding OpenSettingsCommand}" Margin="0,2,5,2" DockPanel.Dock="Right" ToolTip.Tip="{x:Static resx:Resources.Settings}">
<Image Source="{DynamicResource Settings}"/>

View file

@ -92,7 +92,7 @@ namespace FRESHMusicPlayer.Views
private void OnTracksPressed(object sender, PointerPressedEventArgs e) => ViewModel.SelectedTab = Tab.Tracks;
private void OnArtistsPressed(object sender, PointerPressedEventArgs e) => ViewModel.SelectedTab = Tab.Artists;
private void OnAlbumssPressed(object sender, PointerPressedEventArgs e) => ViewModel.SelectedTab = Tab.Albums;
private void OnAlbumsPressed(object sender, PointerPressedEventArgs e) => ViewModel.SelectedTab = Tab.Albums;
private void OnPlaylistsPressed(object sender, PointerPressedEventArgs e) => ViewModel.SelectedTab = Tab.Playlists;
private void OnImportPressed(object sender, PointerPressedEventArgs e) => ViewModel.SelectedTab = Tab.Import;