From 337bba495b68c2938088229d0662a590e076d396 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 23 Aug 2022 20:13:47 -0400 Subject: [PATCH] Fix some template parts and template part names --- src/Avalonia.Controls/ToggleSwitch.cs | 10 ++++++---- src/Avalonia.Dialogs/ManagedFileChooser.cs | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Avalonia.Controls/ToggleSwitch.cs b/src/Avalonia.Controls/ToggleSwitch.cs index 7f9130c63a..a28e9791f6 100644 --- a/src/Avalonia.Controls/ToggleSwitch.cs +++ b/src/Avalonia.Controls/ToggleSwitch.cs @@ -9,8 +9,10 @@ namespace Avalonia.Controls /// /// A Toggle Switch control. /// - [TemplatePart("PART_MovingKnobs", typeof(Panel))] - [TemplatePart("PART_SwitchKnob", typeof(Panel))] + [TemplatePart("PART_MovingKnobs", typeof(Panel))] + [TemplatePart("PART_OffContentPresenter", typeof(ContentPresenter))] + [TemplatePart("PART_OnContentPresenter", typeof(ContentPresenter))] + [TemplatePart("PART_SwitchKnob", typeof(Panel))] [PseudoClasses(":dragging")] public class ToggleSwitch : ToggleButton { @@ -163,8 +165,8 @@ namespace Avalonia.Controls { base.OnApplyTemplate(e); - _switchKnob = e.NameScope.Find("SwitchKnob"); - _knobsPanel = e.NameScope.Get("MovingKnobs"); + _switchKnob = e.NameScope.Find("PART_SwitchKnob"); + _knobsPanel = e.NameScope.Get("PART_MovingKnobs"); _knobsPanel.PointerPressed += KnobsPanel_PointerPressed; _knobsPanel.PointerReleased += KnobsPanel_PointerReleased; diff --git a/src/Avalonia.Dialogs/ManagedFileChooser.cs b/src/Avalonia.Dialogs/ManagedFileChooser.cs index 83a84eed33..12436680b3 100644 --- a/src/Avalonia.Dialogs/ManagedFileChooser.cs +++ b/src/Avalonia.Dialogs/ManagedFileChooser.cs @@ -90,8 +90,8 @@ namespace Avalonia.Dialogs protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { - _quickLinksRoot = e.NameScope.Get("QuickLinks"); - _filesView = e.NameScope.Get("Files"); + _quickLinksRoot = e.NameScope.Get("PART_QuickLinks"); + _filesView = e.NameScope.Get("PART_Files"); } } }