Skip to content

Code Quality: Fixed crash in BladeItem control #16842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/Files.App.Controls/BladeView/BladeItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public BladeItem()
protected override void OnApplyTemplate()
{
_loaded = true;
base.OnApplyTemplate();

_closeButton = GetTemplateChild("CloseButton") as Button;
_enlargeButton = GetTemplateChild("EnlargeButton") as Button;
Expand Down Expand Up @@ -66,10 +65,9 @@ private void OnExpanding(Expander sender, ExpanderExpandingEventArgs args)
{
Width = _normalModeWidth;
VisualStateManager.GoToState(this, "Expanded", true);
var name = "WCT_BladeView_ExpandButton_Collapsed".GetLocalized("CommunityToolkit.WinUI.UI.Controls.Layout/Resources");
if (_enlargeButton != null)
{
AutomationProperties.SetName(_enlargeButton, name);
AutomationProperties.SetName(_enlargeButton, "Expand Blade Item");
}
}
}
Expand All @@ -80,11 +78,9 @@ private void OnCollapsed(Expander sender, ExpanderCollapsedEventArgs args)
if (_loaded)
{
Width = double.NaN;
VisualStateManager.GoToState(this, "Collapsed", true);
var name = "WCT_BladeView_ExpandButton_Expanded".GetLocalized("CommunityToolkit.WinUI.UI.Controls.Layout/Resources");
if (_enlargeButton != null)
{
AutomationProperties.SetName(_enlargeButton, name);
AutomationProperties.SetName(_enlargeButton, "Collapse Blade Item");
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Files.App.Controls/GridSplitter/GridSplitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ public GridSplitter()
{
DefaultStyleKey = typeof(GridSplitter);
Loaded += GridSplitter_Loaded;
string automationName = CommunityToolkit.WinUI.StringExtensions.GetLocalized("WCT_GridSplitter_AutomationName", "CommunityToolkit.WinUI.UI.Controls.Layout/Resources");
AutomationProperties.SetName(this, automationName);
AutomationProperties.SetName(this, "Grid Splitter");
}

/// <inheritdoc />
Expand Down
Loading