Fix focus for EquationTextBox (#787)
This commit is contained in:
parent
442ed6a861
commit
afc1b2146c
@ -142,7 +142,7 @@ void EquationTextBox::OnRichEditBoxTextChanged(Object ^ sender, RoutedEventArgs
|
||||
|
||||
void EquationTextBox::OnRichEditBoxGotFocus(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
m_isFocused = true;
|
||||
m_HasFocus = true;
|
||||
UpdateCommonVisualState();
|
||||
UpdateDeleteButtonVisualState();
|
||||
}
|
||||
@ -151,7 +151,7 @@ void EquationTextBox::OnRichEditBoxLostFocus(Object ^ sender, RoutedEventArgs ^
|
||||
{
|
||||
if (!m_richEditBox->ContextFlyout->IsOpen)
|
||||
{
|
||||
m_isFocused = false;
|
||||
m_HasFocus = false;
|
||||
}
|
||||
UpdateCommonVisualState();
|
||||
UpdateDeleteButtonVisualState();
|
||||
@ -222,7 +222,7 @@ void EquationTextBox::UpdateCommonVisualState()
|
||||
{
|
||||
String ^ state = "Normal";
|
||||
|
||||
if (m_isFocused)
|
||||
if (m_HasFocus)
|
||||
{
|
||||
state = "Focused";
|
||||
}
|
||||
@ -271,5 +271,5 @@ bool EquationTextBox::ShouldDeleteButtonBeVisible()
|
||||
{
|
||||
text = m_richEditBox->MathText;
|
||||
}
|
||||
return (!text->IsEmpty() && m_isFocused);
|
||||
return (!text->IsEmpty() && m_HasFocus);
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ namespace CalculatorApp
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::SolidColorBrush^, EquationColor);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Controls::Flyout^, ColorChooserFlyout);
|
||||
|
||||
PROPERTY_R(bool, HasFocus);
|
||||
|
||||
event Windows::UI::Xaml::RoutedEventHandler ^ RemoveButtonClicked;
|
||||
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesButtonClicked;
|
||||
event Windows::UI::Xaml::RoutedEventHandler ^ EquationSubmitted;
|
||||
@ -64,7 +66,6 @@ namespace CalculatorApp
|
||||
Windows::UI::Xaml::Controls::Button^ m_functionButton;
|
||||
Windows::UI::Xaml::Controls::Primitives::ToggleButton^ m_colorChooserButton;
|
||||
|
||||
bool m_isFocused;
|
||||
bool m_isPointerOver;
|
||||
bool m_isColorChooserFlyoutOpen;
|
||||
};
|
||||
|
@ -87,7 +87,11 @@ void EquationInputArea::InputTextBox_Submitted(Object ^ sender, RoutedEventArgs
|
||||
auto tb = static_cast<EquationTextBox ^>(sender);
|
||||
auto eq = static_cast<EquationViewModel ^>(tb->DataContext);
|
||||
eq->Expression = tb->GetEquationText();
|
||||
FocusManager::TryMoveFocus(::FocusNavigationDirection::Left);
|
||||
|
||||
if (tb->HasFocus)
|
||||
{
|
||||
FocusManager::TryMoveFocus(::FocusNavigationDirection::Left);
|
||||
}
|
||||
}
|
||||
|
||||
void EquationInputArea::EquationTextBox_RemoveButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
||||
|
Loading…
Reference in New Issue
Block a user