Button border thickness declared in XAML and not in code

This commit is contained in:
2021-08-31 02:25:42 +02:00
parent 86a652c170
commit 984d2056de
2 changed files with 14 additions and 16 deletions

View File

@ -17,9 +17,6 @@ namespace unison
DispatcherTimer timer = new DispatcherTimer();
Thickness SelectedThickness;
Thickness BaseThickness;
public MainWindow()
{
InitHwnd();
@ -29,14 +26,9 @@ namespace unison
mpd = (MPDHandler)Application.Current.Properties["mpd"];
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(0.5);
timer.Tick += Timer_Tick;
timer.Start();
SelectedThickness.Left = SelectedThickness.Right = SelectedThickness.Top = 0.0f;
SelectedThickness.Bottom = 2.0f;
BaseThickness.Left = BaseThickness.Right = BaseThickness.Top = BaseThickness.Bottom = 0.0f;
}
private void Timer_Tick(object sender, EventArgs e)
@ -50,10 +42,7 @@ namespace unison
public void UpdateButton(ref Border border, bool b)
{
if (b)
border.BorderThickness = SelectedThickness;
else
border.BorderThickness = BaseThickness;
border.Style = b ? (Style)Resources["SelectedButton"] : (Style)Resources["UnselectedButton"];
}
public string FormatSeconds(int time)