mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 18:43:54 -06:00
[bugged] add support for string when theme color is null
This commit is contained in:
parent
82c49c8913
commit
41190214b0
@ -4,6 +4,7 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "NullableColorPicker.h"
|
#include "NullableColorPicker.h"
|
||||||
#include "NullableColorPicker.g.cpp"
|
#include "NullableColorPicker.g.cpp"
|
||||||
|
#include "NullableColorTemplateSelector.g.cpp"
|
||||||
|
|
||||||
#include <LibraryResources.h>
|
#include <LibraryResources.h>
|
||||||
|
|
||||||
@ -88,9 +89,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
_NullColorPreviewProperty =
|
_NullColorPreviewProperty =
|
||||||
DependencyProperty::Register(
|
DependencyProperty::Register(
|
||||||
L"NullColorPreview",
|
L"NullColorPreview",
|
||||||
xaml_typename<Windows::UI::Color>(),
|
xaml_typename<IReference<Windows::UI::Color>>(),
|
||||||
xaml_typename<Editor::NullableColorPicker>(),
|
xaml_typename<Editor::NullableColorPicker>(),
|
||||||
PropertyMetadata{ box_value(Windows::UI::Colors::Transparent()) });
|
PropertyMetadata{ nullptr });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +155,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
return color == nullptr;
|
return color == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Visibility NullableColorPicker::IsNullToVisibility(Windows::Foundation::IReference<Windows::UI::Color> color)
|
||||||
|
{
|
||||||
|
return color == nullptr ? Visibility::Collapsed : Visibility::Visible;
|
||||||
|
}
|
||||||
|
|
||||||
void NullableColorPicker::NullColorButton_Clicked(const IInspectable& /*sender*/, const RoutedEventArgs& /*args*/)
|
void NullableColorPicker::NullColorButton_Clicked(const IInspectable& /*sender*/, const RoutedEventArgs& /*args*/)
|
||||||
{
|
{
|
||||||
CurrentColor(nullptr);
|
CurrentColor(nullptr);
|
||||||
@ -178,10 +184,15 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
};
|
};
|
||||||
ColorPickerControl().Color(winuiColor);
|
ColorPickerControl().Color(winuiColor);
|
||||||
}
|
}
|
||||||
else
|
else if (const auto nullColor = NullColorPreview())
|
||||||
{
|
{
|
||||||
// No current color (null), use the deduced value for null
|
// No current color (null), use the deduced value for null
|
||||||
ColorPickerControl().Color(NullColorPreview());
|
ColorPickerControl().Color(nullColor.Value());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// NullColorPreview is undefined, use a fallback value
|
||||||
|
ColorPickerControl().Color(Colors::Transparent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,4 +234,18 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Windows::UI::Xaml::DataTemplate NullableColorTemplateSelector::SelectTemplateCore(const winrt::Windows::Foundation::IInspectable& item, const winrt::Windows::UI::Xaml::DependencyObject& /*container*/)
|
||||||
|
{
|
||||||
|
return SelectTemplateCore(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
Windows::UI::Xaml::DataTemplate NullableColorTemplateSelector::SelectTemplateCore(const winrt::Windows::Foundation::IInspectable& item)
|
||||||
|
{
|
||||||
|
if (const auto nullableColor = item.try_as<IReference<Windows::UI::Color>>())
|
||||||
|
{
|
||||||
|
return ColorTemplate();
|
||||||
|
}
|
||||||
|
return NullColorTemplate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "NullableColorPicker.g.h"
|
#include "NullableColorPicker.g.h"
|
||||||
|
#include "NullableColorTemplateSelector.g.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||||
@ -15,6 +16,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
|
|
||||||
static winrt::Windows::UI::Xaml::Media::SolidColorBrush CalculateBorderBrush(const Windows::UI::Color& color);
|
static winrt::Windows::UI::Xaml::Media::SolidColorBrush CalculateBorderBrush(const Windows::UI::Color& color);
|
||||||
static bool IsNull(Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> color);
|
static bool IsNull(Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> color);
|
||||||
|
static Windows::UI::Xaml::Visibility IsNullToVisibility(Windows::Foundation::IReference<Windows::UI::Color> color);
|
||||||
|
|
||||||
void ColorChip_Loaded(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& args);
|
void ColorChip_Loaded(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& args);
|
||||||
void ColorChip_Unloaded(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& args);
|
void ColorChip_Unloaded(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& args);
|
||||||
@ -31,7 +33,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
DEPENDENCY_PROPERTY(Windows::Foundation::IReference<Microsoft::Terminal::Core::Color>, CurrentColor);
|
DEPENDENCY_PROPERTY(Windows::Foundation::IReference<Microsoft::Terminal::Core::Color>, CurrentColor);
|
||||||
DEPENDENCY_PROPERTY(bool, ShowNullColorButton);
|
DEPENDENCY_PROPERTY(bool, ShowNullColorButton);
|
||||||
DEPENDENCY_PROPERTY(hstring, NullColorButtonLabel);
|
DEPENDENCY_PROPERTY(hstring, NullColorButtonLabel);
|
||||||
DEPENDENCY_PROPERTY(Windows::UI::Color, NullColorPreview);
|
DEPENDENCY_PROPERTY(Windows::Foundation::IReference<Windows::UI::Color>, NullColorPreview);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void _InitializeProperties();
|
static void _InitializeProperties();
|
||||||
@ -41,9 +43,21 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
|
|
||||||
std::vector<Windows::UI::Xaml::Controls::Primitives::ToggleButton> _colorChips;
|
std::vector<Windows::UI::Xaml::Controls::Primitives::ToggleButton> _colorChips;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct NullableColorTemplateSelector : NullableColorTemplateSelectorT<NullableColorTemplateSelector>
|
||||||
|
{
|
||||||
|
NullableColorTemplateSelector() = default;
|
||||||
|
|
||||||
|
Windows::UI::Xaml::DataTemplate SelectTemplateCore(const winrt::Windows::Foundation::IInspectable&, const winrt::Windows::UI::Xaml::DependencyObject&);
|
||||||
|
Windows::UI::Xaml::DataTemplate SelectTemplateCore(const winrt::Windows::Foundation::IInspectable&);
|
||||||
|
|
||||||
|
WINRT_PROPERTY(winrt::Windows::UI::Xaml::DataTemplate, ColorTemplate);
|
||||||
|
WINRT_PROPERTY(winrt::Windows::UI::Xaml::DataTemplate, NullColorTemplate);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
|
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
|
||||||
{
|
{
|
||||||
BASIC_FACTORY(NullableColorPicker);
|
BASIC_FACTORY(NullableColorPicker);
|
||||||
|
BASIC_FACTORY(NullableColorTemplateSelector);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,10 +21,19 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||||||
String NullColorButtonLabel;
|
String NullColorButtonLabel;
|
||||||
static Windows.UI.Xaml.DependencyProperty NullColorButtonLabelProperty { get; };
|
static Windows.UI.Xaml.DependencyProperty NullColorButtonLabelProperty { get; };
|
||||||
|
|
||||||
Windows.UI.Color NullColorPreview;
|
Windows.Foundation.IReference<Windows.UI.Color> NullColorPreview;
|
||||||
static Windows.UI.Xaml.DependencyProperty NullColorPreviewProperty { get; };
|
static Windows.UI.Xaml.DependencyProperty NullColorPreviewProperty { get; };
|
||||||
|
|
||||||
static Windows.UI.Xaml.Media.SolidColorBrush CalculateBorderBrush(Windows.UI.Color color);
|
static Windows.UI.Xaml.Media.SolidColorBrush CalculateBorderBrush(Windows.UI.Color color);
|
||||||
static Boolean IsNull(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> color);
|
static Boolean IsNull(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> color);
|
||||||
|
static Windows.UI.Xaml.Visibility IsNullToVisibility(Windows.Foundation.IReference<Windows.UI.Color> color);
|
||||||
|
}
|
||||||
|
|
||||||
|
[default_interface] runtimeclass NullableColorTemplateSelector : Windows.UI.Xaml.Controls.DataTemplateSelector
|
||||||
|
{
|
||||||
|
NullableColorTemplateSelector();
|
||||||
|
|
||||||
|
Windows.UI.Xaml.DataTemplate ColorTemplate;
|
||||||
|
Windows.UI.Xaml.DataTemplate NullColorTemplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,9 +136,10 @@
|
|||||||
<Border Grid.Column="0"
|
<Border Grid.Column="0"
|
||||||
Width="20"
|
Width="20"
|
||||||
Height="20"
|
Height="20"
|
||||||
Background="{x:Bind mtu:Converters.ColorToBrush(NullColorPreview), Mode=OneWay}"
|
Background="{x:Bind mtu:Converters.ColorToBrush(NullColorPreview.Value), Mode=OneWay}"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CornerRadius="{StaticResource ControlCornerRadius}" />
|
CornerRadius="{StaticResource ControlCornerRadius}"
|
||||||
|
Visibility="{x:Bind IsNullToVisibility(NullColorPreview), Mode=OneWay}" />
|
||||||
|
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
Text="{x:Bind NullColorButtonLabel}" />
|
Text="{x:Bind NullColorButtonLabel}" />
|
||||||
|
|||||||
@ -151,6 +151,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
{
|
{
|
||||||
_NotifyChanges(L"AnswerbackMessagePreview");
|
_NotifyChanges(L"AnswerbackMessagePreview");
|
||||||
}
|
}
|
||||||
|
else if (viewModelProperty == L"TabColor")
|
||||||
|
{
|
||||||
|
_NotifyChanges(L"TabColorPreview");
|
||||||
|
}
|
||||||
else if (viewModelProperty == L"TabThemeColorPreview")
|
else if (viewModelProperty == L"TabThemeColorPreview")
|
||||||
{
|
{
|
||||||
_NotifyChanges(L"TabColorPreview");
|
_NotifyChanges(L"TabColorPreview");
|
||||||
@ -449,7 +453,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
return RS_(L"Profile_AnswerbackMessageNone");
|
return RS_(L"Profile_AnswerbackMessageNone");
|
||||||
}
|
}
|
||||||
|
|
||||||
Windows::UI::Color ProfileViewModel::TabColorPreview() const
|
Windows::Foundation::IReference<Windows::UI::Color> ProfileViewModel::TabColorPreview() const
|
||||||
{
|
{
|
||||||
if (const auto modelVal = _profile.TabColor())
|
if (const auto modelVal = _profile.TabColor())
|
||||||
{
|
{
|
||||||
@ -465,7 +469,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
return TabThemeColorPreview();
|
return TabThemeColorPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
Windows::UI::Color ProfileViewModel::TabThemeColorPreview() const
|
Windows::Foundation::IReference<Windows::UI::Color> ProfileViewModel::TabThemeColorPreview() const
|
||||||
{
|
{
|
||||||
if (const auto currentTheme = _appSettings.GlobalSettings().CurrentTheme())
|
if (const auto currentTheme = _appSettings.GlobalSettings().CurrentTheme())
|
||||||
{
|
{
|
||||||
@ -489,34 +493,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XAML default color for tab
|
// XAML default color for tab
|
||||||
// TODO CARLOS: I keep getting #FFFFFFFF
|
return nullptr;
|
||||||
// - TabViewItemHeaderBackground: gives value above, is incorrect
|
|
||||||
// - LayerOnMicaBaseAltFillColorTransparentBrush: resolved value for TabViewItemHeaderBackground (from XAML GH); same issue
|
|
||||||
//
|
|
||||||
// I think the problem is that TabViewItemHeaderBackground is set on the TabViewItem, but I don't have access to that
|
|
||||||
|
|
||||||
// NEXT STEPS: allow NullableColorPicker to show color preview OR just text
|
|
||||||
// - add template selector
|
|
||||||
// - 2 templates:
|
|
||||||
// - color? --> ColorPreviewTemplate (in CommonResources.xaml)
|
|
||||||
// - else --> String/TextBlock
|
|
||||||
// - pass in string for when template selector fails?
|
|
||||||
|
|
||||||
|
|
||||||
if (const auto tabHeaderBackground = Application::Current().Resources().Lookup(box_value(L"TabViewItemHeaderBackground")))
|
|
||||||
{
|
|
||||||
if (const auto brush = tabHeaderBackground.try_as<Windows::UI::Xaml::Media::SolidColorBrush>())
|
|
||||||
{
|
|
||||||
// Fill the alpha so that the color can actually be displayed in the preview
|
|
||||||
auto brushColor = brush.Color();
|
|
||||||
brushColor.A = static_cast<uint8_t>(255);
|
|
||||||
return brushColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This should never happen, but if it does, return Transparent so it's obvious
|
|
||||||
assert(false);
|
|
||||||
return Windows::UI::Colors::Transparent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor::AppearanceViewModel ProfileViewModel::DefaultAppearance() const
|
Editor::AppearanceViewModel ProfileViewModel::DefaultAppearance() const
|
||||||
|
|||||||
@ -124,8 +124,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
bool Orphaned() const;
|
bool Orphaned() const;
|
||||||
hstring TabTitlePreview() const;
|
hstring TabTitlePreview() const;
|
||||||
hstring AnswerbackMessagePreview() const;
|
hstring AnswerbackMessagePreview() const;
|
||||||
Windows::UI::Color TabColorPreview() const;
|
Windows::Foundation::IReference<Windows::UI::Color> TabColorPreview() const;
|
||||||
Windows::UI::Color TabThemeColorPreview() const;
|
Windows::Foundation::IReference<Windows::UI::Color> TabThemeColorPreview() const;
|
||||||
|
|
||||||
til::typed_event<Editor::ProfileViewModel, Editor::DeleteProfileEventArgs> DeleteProfileRequested;
|
til::typed_event<Editor::ProfileViewModel, Editor::DeleteProfileEventArgs> DeleteProfileRequested;
|
||||||
|
|
||||||
|
|||||||
@ -123,8 +123,8 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||||||
|
|
||||||
String TabTitlePreview { get; };
|
String TabTitlePreview { get; };
|
||||||
String AnswerbackMessagePreview { get; };
|
String AnswerbackMessagePreview { get; };
|
||||||
Windows.UI.Color TabColorPreview { get; };
|
Windows.Foundation.IReference<Windows.UI.Color> TabColorPreview { get; };
|
||||||
Windows.UI.Color TabThemeColorPreview { get; };
|
Windows.Foundation.IReference<Windows.UI.Color> TabThemeColorPreview { get; };
|
||||||
|
|
||||||
void CreateUnfocusedAppearance();
|
void CreateUnfocusedAppearance();
|
||||||
void DeleteUnfocusedAppearance();
|
void DeleteUnfocusedAppearance();
|
||||||
|
|||||||
@ -34,6 +34,18 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
_Profile = args.Profile();
|
_Profile = args.Profile();
|
||||||
_windowRoot = args.WindowRoot();
|
_windowRoot = args.WindowRoot();
|
||||||
|
|
||||||
|
_Profile.PropertyChanged([this](auto&&, const PropertyChangedEventArgs& args) {
|
||||||
|
const auto viewModelProperty{ args.PropertyName() };
|
||||||
|
if (viewModelProperty == L"TabColorPreview")
|
||||||
|
{
|
||||||
|
// TODO CARLOS: When the CurrentValue changes to null (aka "use theme color" resolves to default XAML colors),
|
||||||
|
// the CurrentValueTemplateSelector should switch from using the ColorTemplate to the NullColorTemplate.
|
||||||
|
// Breakpoints in SelectTemplateCore() are not hit in this scenario (they are hit when set to not-null).
|
||||||
|
// Reloading the app with CurrentValue being null works fine. The issue is purely when swapping from a color to null.
|
||||||
|
TabColor().UpdateLayout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Check the use parent directory box if the starting directory is empty
|
// Check the use parent directory box if the starting directory is empty
|
||||||
if (_Profile.StartingDirectory().empty())
|
if (_Profile.StartingDirectory().empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -209,19 +209,33 @@
|
|||||||
</local:SettingContainer>
|
</local:SettingContainer>
|
||||||
|
|
||||||
<!-- Tab Color -->
|
<!-- Tab Color -->
|
||||||
|
<!-- CurrentValueAccessibleName="{x:Bind Profile.TabColorPreview, Converter={StaticResource ColorToStringConverter}, Mode=OneWay}" -->
|
||||||
<local:SettingContainer x:Name="TabColor"
|
<local:SettingContainer x:Name="TabColor"
|
||||||
x:Uid="Profile_TabColor"
|
x:Uid="Profile_TabColor"
|
||||||
ClearSettingValue="{x:Bind Profile.ClearTabColor}"
|
ClearSettingValue="{x:Bind Profile.ClearTabColor}"
|
||||||
CurrentValue="{x:Bind Profile.TabColorPreview, Mode=OneWay}"
|
CurrentValue="{x:Bind Profile.TabColorPreview, Mode=OneWay}"
|
||||||
CurrentValueAccessibleName="{x:Bind Profile.TabColorPreview, Converter={StaticResource ColorToStringConverter}, Mode=OneWay}"
|
|
||||||
CurrentValueTemplate="{StaticResource ColorPreviewTemplate}"
|
|
||||||
HasSettingValue="{x:Bind Profile.HasTabColor, Mode=OneWay}"
|
HasSettingValue="{x:Bind Profile.HasTabColor, Mode=OneWay}"
|
||||||
SettingOverrideSource="{x:Bind Profile.TabColorOverrideSource, Mode=OneWay}"
|
SettingOverrideSource="{x:Bind Profile.TabColorOverrideSource, Mode=OneWay}"
|
||||||
Style="{StaticResource ExpanderSettingContainerStyleWithComplexPreview}">
|
Style="{StaticResource ExpanderSettingContainerStyleWithComplexPreview}">
|
||||||
<local:NullableColorPicker x:Uid="Profile_TabColor_NullableColorPicker"
|
<local:SettingContainer.CurrentValueTemplateSelector>
|
||||||
ColorSchemeVM="{x:Bind Profile.DefaultAppearance.CurrentColorScheme, Mode=OneWay}"
|
<local:NullableColorTemplateSelector ColorTemplate="{StaticResource ColorPreviewTemplate}">
|
||||||
CurrentColor="{x:Bind Profile.TabColor, Mode=TwoWay}"
|
<local:NullableColorTemplateSelector.NullColorTemplate>
|
||||||
NullColorPreview="{x:Bind Profile.TabThemeColorPreview, Mode=OneWay}" />
|
<DataTemplate>
|
||||||
|
<!-- TODO CARLOS: ResourceString should let me get the label! It's not working though. Usiung a temporary string in the meantime -->
|
||||||
|
<TextBlock Margin="0"
|
||||||
|
Style="{StaticResource SettingContainerCurrentValueTextBlockStyle}"
|
||||||
|
Text="Use theme color" />
|
||||||
|
<!-- Text="{mtu:ResourceString Tree=TerminalSettingsEditor, Name=Profile_TabColor_NullableColorPicker.NullColorButtonLabel}" /> -->
|
||||||
|
</DataTemplate>
|
||||||
|
</local:NullableColorTemplateSelector.NullColorTemplate>
|
||||||
|
</local:NullableColorTemplateSelector>
|
||||||
|
</local:SettingContainer.CurrentValueTemplateSelector>
|
||||||
|
<local:SettingContainer.Content>
|
||||||
|
<local:NullableColorPicker x:Uid="Profile_TabColor_NullableColorPicker"
|
||||||
|
ColorSchemeVM="{x:Bind Profile.DefaultAppearance.CurrentColorScheme, Mode=OneWay}"
|
||||||
|
CurrentColor="{x:Bind Profile.TabColor, Mode=TwoWay}"
|
||||||
|
NullColorPreview="{x:Bind Profile.TabThemeColorPreview, Mode=OneWay}" />
|
||||||
|
</local:SettingContainer.Content>
|
||||||
</local:SettingContainer>
|
</local:SettingContainer>
|
||||||
|
|
||||||
<!-- Elevate -->
|
<!-- Elevate -->
|
||||||
|
|||||||
@ -15,6 +15,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
DependencyProperty SettingContainer::_FontIconGlyphProperty{ nullptr };
|
DependencyProperty SettingContainer::_FontIconGlyphProperty{ nullptr };
|
||||||
DependencyProperty SettingContainer::_CurrentValueProperty{ nullptr };
|
DependencyProperty SettingContainer::_CurrentValueProperty{ nullptr };
|
||||||
DependencyProperty SettingContainer::_CurrentValueTemplateProperty{ nullptr };
|
DependencyProperty SettingContainer::_CurrentValueTemplateProperty{ nullptr };
|
||||||
|
DependencyProperty SettingContainer::_CurrentValueTemplateSelectorProperty{ nullptr };
|
||||||
DependencyProperty SettingContainer::_CurrentValueAccessibleNameProperty{ nullptr };
|
DependencyProperty SettingContainer::_CurrentValueAccessibleNameProperty{ nullptr };
|
||||||
DependencyProperty SettingContainer::_HasSettingValueProperty{ nullptr };
|
DependencyProperty SettingContainer::_HasSettingValueProperty{ nullptr };
|
||||||
DependencyProperty SettingContainer::_SettingOverrideSourceProperty{ nullptr };
|
DependencyProperty SettingContainer::_SettingOverrideSourceProperty{ nullptr };
|
||||||
@ -75,6 +76,15 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
xaml_typename<Editor::SettingContainer>(),
|
xaml_typename<Editor::SettingContainer>(),
|
||||||
PropertyMetadata{ nullptr });
|
PropertyMetadata{ nullptr });
|
||||||
}
|
}
|
||||||
|
if (!_CurrentValueTemplateSelectorProperty)
|
||||||
|
{
|
||||||
|
_CurrentValueTemplateSelectorProperty =
|
||||||
|
DependencyProperty::Register(
|
||||||
|
L"CurrentValueTemplateSelector",
|
||||||
|
xaml_typename<Windows::UI::Xaml::Controls::DataTemplateSelector>(),
|
||||||
|
xaml_typename<Editor::SettingContainer>(),
|
||||||
|
PropertyMetadata{ nullptr });
|
||||||
|
}
|
||||||
if (!_CurrentValueAccessibleNameProperty)
|
if (!_CurrentValueAccessibleNameProperty)
|
||||||
{
|
{
|
||||||
_CurrentValueAccessibleNameProperty =
|
_CurrentValueAccessibleNameProperty =
|
||||||
|
|||||||
@ -38,6 +38,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
DEPENDENCY_PROPERTY(hstring, FontIconGlyph);
|
DEPENDENCY_PROPERTY(hstring, FontIconGlyph);
|
||||||
DEPENDENCY_PROPERTY(Windows::Foundation::IInspectable, CurrentValue);
|
DEPENDENCY_PROPERTY(Windows::Foundation::IInspectable, CurrentValue);
|
||||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::DataTemplate, CurrentValueTemplate);
|
DEPENDENCY_PROPERTY(Windows::UI::Xaml::DataTemplate, CurrentValueTemplate);
|
||||||
|
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Controls::DataTemplateSelector, CurrentValueTemplateSelector);
|
||||||
DEPENDENCY_PROPERTY(hstring, CurrentValueAccessibleName);
|
DEPENDENCY_PROPERTY(hstring, CurrentValueAccessibleName);
|
||||||
DEPENDENCY_PROPERTY(bool, HasSettingValue);
|
DEPENDENCY_PROPERTY(bool, HasSettingValue);
|
||||||
DEPENDENCY_PROPERTY(bool, StartExpanded);
|
DEPENDENCY_PROPERTY(bool, StartExpanded);
|
||||||
|
|||||||
@ -24,6 +24,9 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||||||
Windows.UI.Xaml.DataTemplate CurrentValueTemplate;
|
Windows.UI.Xaml.DataTemplate CurrentValueTemplate;
|
||||||
static Windows.UI.Xaml.DependencyProperty CurrentValueTemplateProperty { get; };
|
static Windows.UI.Xaml.DependencyProperty CurrentValueTemplateProperty { get; };
|
||||||
|
|
||||||
|
Windows.UI.Xaml.Controls.DataTemplateSelector CurrentValueTemplateSelector;
|
||||||
|
static Windows.UI.Xaml.DependencyProperty CurrentValueTemplateSelectorProperty { get; };
|
||||||
|
|
||||||
String CurrentValueAccessibleName;
|
String CurrentValueAccessibleName;
|
||||||
static Windows.UI.Xaml.DependencyProperty CurrentValueAccessibleNameProperty { get; };
|
static Windows.UI.Xaml.DependencyProperty CurrentValueAccessibleNameProperty { get; };
|
||||||
|
|
||||||
|
|||||||
@ -461,7 +461,8 @@
|
|||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Content="{TemplateBinding CurrentValue}"
|
Content="{TemplateBinding CurrentValue}"
|
||||||
ContentTemplate="{TemplateBinding CurrentValueTemplate}" />
|
ContentTemplate="{TemplateBinding CurrentValueTemplate}"
|
||||||
|
ContentTemplateSelector="{TemplateBinding CurrentValueTemplateSelector}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</muxc:Expander.Header>
|
</muxc:Expander.Header>
|
||||||
</muxc:Expander>
|
</muxc:Expander>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user