Fix crash and high contrast (#773)
This commit is contained in:
@@ -21,33 +21,11 @@ using namespace Windows::UI::Xaml::Navigation;
|
||||
using namespace Windows::UI::Xaml::Shapes;
|
||||
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(EquationStylePanelControl, SelectedColor);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(EquationStylePanelControl, AvailableColors);
|
||||
|
||||
EquationStylePanelControl::EquationStylePanelControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeAvailableColors();
|
||||
}
|
||||
|
||||
void EquationStylePanelControl::InitializeAvailableColors()
|
||||
{
|
||||
// TODO: Handle dynamically switching these to high contrast equivalents
|
||||
m_AvailableColors = ref new Vector<SolidColorBrush ^>();
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush1")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush2")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush3")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush4")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush5")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush6")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush7")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush8")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush9")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush10")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush11")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush12")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush13")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush14")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush15")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush16")));
|
||||
}
|
||||
|
||||
void EquationStylePanelControl::SelectionChanged(Object ^ /*sender */, SelectionChangedEventArgs ^ e)
|
||||
@@ -70,6 +48,11 @@ void EquationStylePanelControl::ColorChooserLoaded(Object ^ sender, RoutedEventA
|
||||
|
||||
void EquationStylePanelControl::SelectColor(SolidColorBrush ^ selectedColor)
|
||||
{
|
||||
if (selectedColor == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto item : ColorChooser->Items->GetView())
|
||||
{
|
||||
auto brush = static_cast<SolidColorBrush ^>(item);
|
||||
@@ -83,6 +66,7 @@ void EquationStylePanelControl::SelectColor(SolidColorBrush ^ selectedColor)
|
||||
if (brush->Color == selectedColor->Color)
|
||||
{
|
||||
gridViewItem->IsSelected = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user