diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Helper/SettingsExpanderHelper.cs b/src/Snap.Hutao/Snap.Hutao/Control/Helper/SettingsExpanderHelper.cs new file mode 100644 index 00000000..3d3b9540 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Control/Helper/SettingsExpanderHelper.cs @@ -0,0 +1,23 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +using CommunityToolkit.WinUI.Controls; +using Microsoft.UI.Xaml; + +namespace Snap.Hutao.Control.Helper; + +[SuppressMessage("", "SH001")] +[DependencyProperty("IsItemsEnabled", typeof(bool), true, nameof(OnIsItemsEnabledChanged), IsAttached = true, AttachedType = typeof(SettingsExpander))] +public sealed partial class SettingsExpanderHelper +{ + private static void OnIsItemsEnabledChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e) + { + foreach (object item in ((SettingsExpander)dp).Items) + { + if (item is Microsoft.UI.Xaml.Controls.Control control) + { + control.IsEnabled = (bool)e.NewValue; + } + } + } +} diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml index 80c2ca8c..8566e7f2 100644 --- a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml +++ b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml @@ -12,6 +12,7 @@ xmlns:shc="using:Snap.Hutao.Control" xmlns:shcb="using:Snap.Hutao.Control.Behavior" xmlns:shccs="using:Snap.Hutao.Control.Collection.Selector" + xmlns:shch="using:Snap.Hutao.Control.Helper" xmlns:shcm="using:Snap.Hutao.Control.Markup" xmlns:shvc="using:Snap.Hutao.View.Control" xmlns:shvg="using:Snap.Hutao.ViewModel.Game" @@ -199,28 +200,20 @@ - + - + - + @@ -230,10 +223,7 @@ ItemsSource="{Binding Options.AspectRatios}" SelectedItem="{Binding Options.SelectedAspectRatio, Mode=TwoWay}"/> - + - + - +