New: Added close button to Explorer Panel (by darklinkpower)

* Add close button to Explorer Panel

* Vertically align button
This commit is contained in:
Brandon 2025-06-02 03:40:58 -06:00 committed by GitHub
parent 02e55e1e30
commit f97b68475c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

View File

@ -20,12 +20,13 @@ namespace Playnite.DesktopApp.Controls.Views
{
[TemplatePart(Name = "PART_SelectFields", Type = typeof(Selector))]
[TemplatePart(Name = "PART_SelectItems", Type = typeof(Selector))]
[TemplatePart(Name = "PART_ButtonClose", Type = typeof(ButtonBase))]
public class ExplorerPanel : Control
{
private readonly DesktopAppViewModel mainModel;
private Selector SelectFields;
private Selector SelectItems;
private ButtonBase ButtonClose;
static ExplorerPanel()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ExplorerPanel), new FrameworkPropertyMetadata(typeof(ExplorerPanel)));
@ -79,6 +80,12 @@ namespace Playnite.DesktopApp.Controls.Views
mainModel.DatabaseExplorer,
nameof(DatabaseExplorer.FieldValues));
}
ButtonClose = Template.FindName("PART_ButtonClose", this) as ButtonBase;
if (ButtonClose != null)
{
ButtonClose.Command = mainModel.ToggleExplorerPanelCommand;
}
}
}
}

View File

@ -25,8 +25,16 @@
</Style>
</Border.Style>
<DockPanel Background="{TemplateBinding Background}">
<ComboBox Name="PART_SelectFields" MaxDropDownHeight="Auto"
DockPanel.Dock="Top" Margin="5,8,5,8" />
<DockPanel DockPanel.Dock="Top" LastChildFill="True"
Margin="5,8,5,8">
<Button Content="r" FontFamily="Marlett"
Style="{StaticResource SimpleButton}"
DockPanel.Dock="Right" Margin="0,0,5,0"
VerticalAlignment="Center"
Name="PART_ButtonClose"/>
<ComboBox Name="PART_SelectFields" MaxDropDownHeight="Auto"
DockPanel.Dock="Left" Margin="0,0,8,0" />
</DockPanel>
<ListBox Name="PART_SelectItems"
DockPanel.Dock="Top" Margin="5,0,5,8"
BorderThickness="0"