Update tooltips for the Equation Button and Style Picker (#1163)

* Update EquationButton automation name and tooltips

* added tooltips to the stylepicker and fixed the issue where the color name did not update for dark mode colors

* Update src/Calculator/Resources/en-US/Resources.resw

Co-Authored-By: ItzLevvie <11600822+ItzLevvie@users.noreply.github.com>

* fixed the issue where the colors are only listed as black in the tooltip and automation name

* Add tooltips for high contrast colors

Co-authored-by: ItzLevvie <11600822+ItzLevvie@users.noreply.github.com>
This commit is contained in:
Stephanie Anderl
2020-05-07 16:36:52 -07:00
committed by GitHub
parent fd48f6ec1d
commit 0105e6b319
5 changed files with 161 additions and 50 deletions

View File

@@ -69,16 +69,6 @@ void EquationTextBox::OnApplyTemplate()
if (m_equationButton != nullptr)
{
m_equationButton->Click += ref new RoutedEventHandler(this, &EquationTextBox::OnEquationButtonClicked);
auto toolTip = ref new ToolTip();
auto equationButtonMessage = LocalizationStringUtil::GetLocalizedString(
IsEquationLineDisabled ? resProvider->GetResourceString(L"showEquationButtonToolTip")
: resProvider->GetResourceString(L"hideEquationButtonToolTip"), EquationButtonContentIndex);
toolTip->Content = equationButtonMessage;
ToolTipService::SetToolTip(m_equationButton, toolTip);
AutomationProperties::SetName(m_equationButton, equationButtonMessage);
}
if (m_richEditContextMenu != nullptr)
@@ -237,16 +227,7 @@ void EquationTextBox::OnEquationButtonClicked(Object ^ sender, RoutedEventArgs ^
{
EquationButtonClicked(this, ref new RoutedEventArgs());
auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
auto equationButtonMessage = LocalizationStringUtil::GetLocalizedString(
IsEquationLineDisabled ? resProvider->GetResourceString(L"showEquationButtonToolTip")
: resProvider->GetResourceString(L"hideEquationButtonToolTip"), EquationButtonContentIndex);
toolTip->Content = equationButtonMessage;
ToolTipService::SetToolTip(m_equationButton, toolTip);
AutomationProperties::SetName(m_equationButton, equationButtonMessage);
SetEquationButtonTooltipAndAutomationName();
}
void EquationTextBox::OnRemoveButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
@@ -485,3 +466,26 @@ void EquationTextBox::OnEquationFormatRequested(Object ^ sender, MathRichEditBox
{
EquationFormatRequested(this, args);
}
void EquationTextBox::SetEquationButtonTooltipAndAutomationName()
{
auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
auto equationButtonMessage = LocalizationStringUtil::GetLocalizedString(
IsEquationLineDisabled ? resProvider->GetResourceString(L"showEquationButtonAutomationName")
: resProvider->GetResourceString(L"hideEquationButtonAutomationName"),
EquationButtonContentIndex);
auto equationButtonTooltip = LocalizationStringUtil::GetLocalizedString(
IsEquationLineDisabled ? resProvider->GetResourceString(L"showEquationButtonToolTip") : resProvider->GetResourceString(L"hideEquationButtonToolTip"));
toolTip->Content = equationButtonTooltip;
ToolTipService::SetToolTip(m_equationButton, toolTip);
AutomationProperties::SetName(m_equationButton, equationButtonMessage);
}
void EquationTextBox::OnEquationButtonContentIndexPropertyChanged(String ^ /*oldValue*/, String ^ newValue)
{
SetEquationButtonTooltipAndAutomationName();
}

View File

@@ -22,7 +22,7 @@ namespace CalculatorApp
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::SolidColorBrush ^, EquationColor);
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::SolidColorBrush ^, EquationButtonForegroundColor);
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Controls::Flyout ^, ColorChooserFlyout);
DEPENDENCY_PROPERTY(Platform::String ^, EquationButtonContentIndex);
DEPENDENCY_PROPERTY_WITH_CALLBACK(Platform::String ^, EquationButtonContentIndex);
DEPENDENCY_PROPERTY(Platform::String ^, MathEquation);
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, HasError);
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsAddEquationMode);
@@ -74,6 +74,9 @@ namespace CalculatorApp
void OnColorFlyoutClosed(Platform::Object ^ sender, Platform::Object ^ e);
void OnHasErrorPropertyChanged(bool oldValue, bool newValue);
void OnEquationButtonContentIndexPropertyChanged(Platform::String ^ /*oldValue*/, Platform::String ^ newValue);
void SetEquationButtonTooltipAndAutomationName();
CalculatorApp::Controls::MathRichEditBox ^ m_richEditBox;
Windows::UI::Xaml::Controls::Primitives::ToggleButton ^ m_equationButton;