Skip to content

Commit

Permalink
add debug tooltips for blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
zznty committed Nov 9, 2024
1 parent 137c232 commit 3c9159e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions MusicX/Controls/BlockControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Windows;
using System.Windows.Controls;
using Microsoft.Extensions.DependencyInjection;
using MusicX.Core.Models;
using MusicX.Services;
using NavigationService = MusicX.Services.NavigationService;
using MusicX.ViewModels;

namespace MusicX.Controls
{
Expand All @@ -12,19 +10,22 @@ namespace MusicX.Controls
/// </summary>
public partial class BlockControl : UserControl
{
private readonly NavigationService navigationService;
public BlockControl()
{
InitializeComponent();

navigationService = StaticService.Container.GetRequiredService<NavigationService>();
this.Unloaded += BlockControl_Unloaded;
}

private void BlockControl_Unloaded(object sender, RoutedEventArgs e)
#if DEBUG
protected override void OnContentChanged(object oldContent, object newContent)
{
/*BlocksPanel.Children.Clear();*/
base.OnContentChanged(oldContent, newContent);

if (newContent is BlockViewModel viewModel)
ToolTip = $"{viewModel.DataType} {viewModel.Layout?.Name ?? ""}";
else
ToolTip = null;
}
#endif

public static readonly DependencyProperty ArtistProperty = DependencyProperty.Register(
nameof(Artist), typeof(Artist), typeof(BlockControl));
Expand Down

0 comments on commit 3c9159e

Please sign in to comment.