Optimize BitFlipPanel to suppress flicker when users switch between bit lengths (#640)

* Optimize BitFlipPanel

* remove namespace in cpp file

* improve localization + add tests

* add helper to compare ivector

* Modify how the control manages AutomationProperties::Name
This commit is contained in:
Rudy Huyn
2019-08-26 09:31:13 -07:00
committed by Eric Wong
parent eb24c085bc
commit 41e2e97591
26 changed files with 793 additions and 621 deletions

View File

@@ -240,7 +240,6 @@
<ClInclude Include="Controls\OverflowTextBlock.h" />
<ClInclude Include="Controls\RadixButton.h" />
<ClInclude Include="Controls\SupplementaryItemsControl.h" />
<ClInclude Include="Converters\BitFlipAutomationNameConverter.h" />
<ClInclude Include="Converters\BooleanNegationConverter.h" />
<ClInclude Include="Converters\BooleanToVisibilityConverter.h" />
<ClInclude Include="Converters\ExpressionItemTemplateSelector.h" />
@@ -370,7 +369,6 @@
<ClCompile Include="Controls\OverflowTextBlock.cpp" />
<ClCompile Include="Controls\RadixButton.cpp" />
<ClCompile Include="Controls\SupplementaryItemsControl.cpp" />
<ClCompile Include="Converters\BitFlipAutomationNameConverter.cpp" />
<ClCompile Include="Converters\BooleanNegationConverter.cpp" />
<ClCompile Include="Converters\BooleanToVisibilityConverter.cpp" />
<ClCompile Include="Converters\ExpressionItemTemplateSelector.cpp" />

View File

@@ -318,9 +318,6 @@
<ClInclude Include="Controls\OverflowTextBlock.h">
<Filter>Controls</Filter>
</ClInclude>
<ClCompile Include="Converters\BitFlipAutomationNameConverter.cpp">
<Filter>Converters</Filter>
</ClCompile>
<ClInclude Include="Converters\BooleanNegationConverter.h">
<Filter>Converters</Filter>
</ClInclude>
@@ -362,9 +359,6 @@
</ClInclude>
<ClInclude Include="WindowFrameService.h" />
<ClInclude Include="Views\DateCalculator.xaml.h" />
<ClInclude Include="Converters\BitFlipAutomationNameConverter.h">
<Filter>Converters</Filter>
</ClInclude>
<ClInclude Include="Controls\CalculationResultAutomationPeer.h">
<Filter>Controls</Filter>
</ClInclude>

View File

@@ -1,80 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
#include "CalcViewModel/Common/AppResourceProvider.h"
#include "CalcViewModel/Common/LocalizationSettings.h"
#include "BitFlipAutomationNameConverter.h"
using namespace CalculatorApp::Common;
using namespace CalculatorApp::Converters;
using namespace Platform;
using namespace std;
using namespace Windows::ApplicationModel::Resources;
using namespace Windows::Foundation;
using namespace Windows::UI::Xaml::Interop;
// returns automationName in form "Nth bit Value zero/one" depending if bit is set/unset at corresponding index of binary display
Object ^ BitFlipAutomationNameConverter::Convert(_In_ Object ^ value, TypeName targetType, _In_ Object ^ parameter, _In_ String ^ language)
{
auto resourceLoader = AppResourceProvider::GetInstance();
// initialising the updated display with 64 bits of zeros
wstring updatedBinaryDisplay(64, L'0');
const auto& localizationSettings = LocalizationSettings::GetInstance();
wchar_t ch0 = localizationSettings.GetDigitSymbolFromEnUsDigit('0');
wchar_t ch1 = localizationSettings.GetDigitSymbolFromEnUsDigit('1');
String ^ indexName = resourceLoader.GetResourceString(static_cast<String ^>(parameter));
String ^ bitName = resourceLoader.GetResourceString(L"BitAutomationName");
String ^ valueName = resourceLoader.GetResourceString(L"ValueAutomationName");
String ^ zero = resourceLoader.GetResourceString(L"BinaryZeroValueAutomationName");
String ^ one = resourceLoader.GetResourceString(L"BinaryOneValueAutomationName");
if ((value != nullptr) && (parameter != nullptr))
{
wstring binaryDisplay = (static_cast<String ^>(value))->Data();
wstring indexString = (static_cast<String ^>(parameter))->Data();
wstringstream converter;
converter << indexString;
unsigned int index;
converter >> index;
unsigned int binaryLength = 0;
// remove all the characters except 0 and 1 from the array.
for (wchar_t bit : binaryDisplay)
{
if ((bit == ch1) || (bit == ch0))
{
updatedBinaryDisplay[binaryLength++] = bit;
}
if (binaryLength == 63)
{
break;
}
}
// return if binaryDisplay is empty
if (binaryLength == 0)
{
return (indexName + bitName + valueName + zero);
}
// if index is more than the length of binary display return automation name with zero
if (index >= binaryLength)
{
return (indexName + bitName + valueName + zero);
}
// if bit is set return automation name with one else return zero
if (updatedBinaryDisplay[binaryLength - index - 1] == ch1)
{
return (indexName + bitName + valueName + one);
}
}
return (indexName + bitName + valueName + zero);
}
Object ^ BitFlipAutomationNameConverter::ConvertBack(_In_ Object ^ value, TypeName targetType, _In_ Object ^ parameter, _In_ String ^ language)
{
return value;
}

View File

@@ -1,30 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
namespace CalculatorApp
{
namespace Converters
{
/// <summary>
/// Value converter that translates binary value to automation name for a bit.
/// </summary>
[Windows::Foundation::Metadata::WebHostHidden] public ref class BitFlipAutomationNameConverter sealed : Windows::UI::Xaml::Data::IValueConverter
{
public:
virtual Platform::Object
^ Convert(
_In_ Platform::Object ^ value,
Windows::UI::Xaml::Interop::TypeName targetType,
_In_ Platform::Object ^ parameter,
_In_ Platform::String ^ language);
virtual Platform::Object
^ ConvertBack(
_In_ Platform::Object ^ value,
Windows::UI::Xaml::Interop::TypeName targetType,
_In_ Platform::Object ^ parameter,
_In_ Platform::String ^ language);
};
}
}

View File

@@ -545,276 +545,268 @@
<value>Insert</value>
<comment>{Locked}This is the alternate shortcut for paste, SHIFT+Insert</comment>
</data>
<data name="BitAutomationName" xml:space="preserve">
<value>Bit </value>
<comment>Sub-string used in automation name for each bit in bit flip</comment>
<data name="BitFlipItemAutomationName" xml:space="preserve">
<value>%1, value %2</value>
<comment>{Locked="%1","%2"}. String used in automation name for each bit in bit flip. %1 will be replaced by the position of the bit (1st bit, 3rd bit), %2 by a binary value (1 or 0)</comment>
</data>
<data name="ValueAutomationName" xml:space="preserve">
<value>Value </value>
<comment>Sub-string used in automation name for each bit in bit flip</comment>
<data name="BitPosition" xml:space="preserve">
<value>%1 bit</value>
<comment>{Locked="%1"}. Sub-string used to indicate the position of a bit (e.g. 1st bit, 2nd bit...)</comment>
</data>
<data name="BinaryZeroValueAutomationName" xml:space="preserve">
<value>Zero</value>
<comment>Sub-string used in automation name for each bit in bit flip</comment>
</data>
<data name="BinaryOneValueAutomationName" xml:space="preserve">
<value>One</value>
<comment>Sub-string used in automation name for each bit in bit flip</comment>
</data>
<data name="63" xml:space="preserve">
<value>63rd </value>
<data name="63" xml:space="preserve">
<value>63rd</value>
<comment>Sub-string used in automation name for 63 bit in bit flip</comment>
</data>
<data name="62" xml:space="preserve">
<value>62nd </value>
<value>62nd</value>
<comment>Sub-string used in automation name for 62 bit in bit flip</comment>
</data>
<data name="61" xml:space="preserve">
<value>61st </value>
<value>61st</value>
<comment>Sub-string used in automation name for 61 bit in bit flip</comment>
</data>
<data name="60" xml:space="preserve">
<value>60th </value>
<value>60th</value>
<comment>Sub-string used in automation name for 60 bit in bit flip</comment>
</data>
<data name="59" xml:space="preserve">
<value>59th </value>
<value>59th</value>
<comment>Sub-string used in automation name for 59 bit in bit flip</comment>
</data>
<data name="58" xml:space="preserve">
<value>58th </value>
<value>58th</value>
<comment>Sub-string used in automation name for 58 bit in bit flip</comment>
</data>
<data name="57" xml:space="preserve">
<value>57th </value>
<value>57th</value>
<comment>Sub-string used in automation name for 57 bit in bit flip</comment>
</data>
<data name="56" xml:space="preserve">
<value>56th </value>
<value>56th</value>
<comment>Sub-string used in automation name for 56 bit in bit flip</comment>
</data>
<data name="55" xml:space="preserve">
<value>55th </value>
<value>55th</value>
<comment>Sub-string used in automation name for 55 bit in bit flip</comment>
</data>
<data name="54" xml:space="preserve">
<value>54th </value>
<value>54th</value>
<comment>Sub-string used in automation name for 54 bit in bit flip</comment>
</data>
<data name="53" xml:space="preserve">
<value>53rd </value>
<value>53rd</value>
<comment>Sub-string used in automation name for 53 bit in bit flip</comment>
</data>
<data name="52" xml:space="preserve">
<value>52nd </value>
<value>52nd</value>
<comment>Sub-string used in automation name for 52 bit in bit flip</comment>
</data>
<data name="51" xml:space="preserve">
<value>51st </value>
<value>51st</value>
<comment>Sub-string used in automation name for 51 bit in bit flip</comment>
</data>
<data name="50" xml:space="preserve">
<value>50th </value>
<value>50th</value>
<comment>Sub-string used in automation name for 50 bit in bit flip</comment>
</data>
<data name="49" xml:space="preserve">
<value>49th </value>
<value>49th</value>
<comment>Sub-string used in automation name for 49 bit in bit flip</comment>
</data>
<data name="48" xml:space="preserve">
<value>48th </value>
<value>48th</value>
<comment>Sub-string used in automation name for 48 bit in bit flip</comment>
</data>
<data name="47" xml:space="preserve">
<value>47th </value>
<value>47th</value>
<comment>Sub-string used in automation name for 47 bit in bit flip</comment>
</data>
<data name="46" xml:space="preserve">
<value>46th </value>
<value>46th</value>
<comment>Sub-string used in automation name for 46 bit in bit flip</comment>
</data>
<data name="45" xml:space="preserve">
<value>45th </value>
<value>45th</value>
<comment>Sub-string used in automation name for 45 bit in bit flip</comment>
</data>
<data name="44" xml:space="preserve">
<value>44th </value>
<value>44th</value>
<comment>Sub-string used in automation name for 44 bit in bit flip</comment>
</data>
<data name="43" xml:space="preserve">
<value>43rd </value>
<value>43rd</value>
<comment>Sub-string used in automation name for 43 bit in bit flip</comment>
</data>
<data name="42" xml:space="preserve">
<value>42nd </value>
<value>42nd</value>
<comment>Sub-string used in automation name for 42 bit in bit flip</comment>
</data>
<data name="41" xml:space="preserve">
<value>41st </value>
<value>41st</value>
<comment>Sub-string used in automation name for 41 bit in bit flip</comment>
</data>
<data name="40" xml:space="preserve">
<value>40th </value>
<value>40th</value>
<comment>Sub-string used in automation name for 40 bit in bit flip</comment>
</data>
<data name="39" xml:space="preserve">
<value>39th </value>
<value>39th</value>
<comment>Sub-string used in automation name for 39 bit in bit flip</comment>
</data>
<data name="38" xml:space="preserve">
<value>38th </value>
<value>38th</value>
<comment>Sub-string used in automation name for 38 bit in bit flip</comment>
</data>
<data name="37" xml:space="preserve">
<value>37th </value>
<value>37th</value>
<comment>Sub-string used in automation name for 37 bit in bit flip</comment>
</data>
<data name="36" xml:space="preserve">
<value>36th </value>
<value>36th</value>
<comment>Sub-string used in automation name for 36 bit in bit flip</comment>
</data>
<data name="35" xml:space="preserve">
<value>35th </value>
<value>35th</value>
<comment>Sub-string used in automation name for 35 bit in bit flip</comment>
</data>
<data name="34" xml:space="preserve">
<value>34th </value>
<value>34th</value>
<comment>Sub-string used in automation name for 34 bit in bit flip</comment>
</data>
<data name="33" xml:space="preserve">
<value>33rd </value>
<value>33rd</value>
<comment>Sub-string used in automation name for 33 bit in bit flip</comment>
</data>
<data name="32" xml:space="preserve">
<value>32nd </value>
<value>32nd</value>
<comment>Sub-string used in automation name for 32 bit in bit flip</comment>
</data>
<data name="31" xml:space="preserve">
<value>31st </value>
<value>31st</value>
<comment>Sub-string used in automation name for 31 bit in bit flip</comment>
</data>
<data name="30" xml:space="preserve">
<value>30th </value>
<value>30th</value>
<comment>Sub-string used in automation name for 30 bit in bit flip</comment>
</data>
<data name="29" xml:space="preserve">
<value>29th </value>
<value>29th</value>
<comment>Sub-string used in automation name for 29 bit in bit flip</comment>
</data>
<data name="28" xml:space="preserve">
<value>28th </value>
<value>28th</value>
<comment>Sub-string used in automation name for 28 bit in bit flip</comment>
</data>
<data name="27" xml:space="preserve">
<value>27th </value>
<value>27th</value>
<comment>Sub-string used in automation name for 27 bit in bit flip</comment>
</data>
<data name="26" xml:space="preserve">
<value>26th </value>
<value>26th</value>
<comment>Sub-string used in automation name for 26 bit in bit flip</comment>
</data>
<data name="25" xml:space="preserve">
<value>25th </value>
<value>25th</value>
<comment>Sub-string used in automation name for 25 bit in bit flip</comment>
</data>
<data name="24" xml:space="preserve">
<value>24th </value>
<value>24th</value>
<comment>Sub-string used in automation name for 24 bit in bit flip</comment>
</data>
<data name="23" xml:space="preserve">
<value>23rd </value>
<value>23rd</value>
<comment>Sub-string used in automation name for 23 bit in bit flip</comment>
</data>
<data name="22" xml:space="preserve">
<value>22nd </value>
<value>22nd</value>
<comment>Sub-string used in automation name for 22 bit in bit flip</comment>
</data>
<data name="21" xml:space="preserve">
<value>21st </value>
<value>21st</value>
<comment>Sub-string used in automation name for 21 bit in bit flip</comment>
</data>
<data name="20" xml:space="preserve">
<value>20th </value>
<value>20th</value>
<comment>Sub-string used in automation name for 20 bit in bit flip</comment>
</data>
<data name="19" xml:space="preserve">
<value>19th </value>
<value>19th</value>
<comment>Sub-string used in automation name for 19 bit in bit flip</comment>
</data>
<data name="18" xml:space="preserve">
<value>18th </value>
<value>18th</value>
<comment>Sub-string used in automation name for 18 bit in bit flip</comment>
</data>
<data name="17" xml:space="preserve">
<value>17th </value>
<value>17th</value>
<comment>Sub-string used in automation name for 17 bit in bit flip</comment>
</data>
<data name="16" xml:space="preserve">
<value>16th </value>
<value>16th</value>
<comment>Sub-string used in automation name for 16 bit in bit flip</comment>
</data>
<data name="15" xml:space="preserve">
<value>15th </value>
<value>15th</value>
<comment>Sub-string used in automation name for 15 bit in bit flip</comment>
</data>
<data name="14" xml:space="preserve">
<value>14th </value>
<value>14th</value>
<comment>Sub-string used in automation name for 14 bit in bit flip</comment>
</data>
<data name="13" xml:space="preserve">
<value>13th </value>
<value>13th</value>
<comment>Sub-string used in automation name for 13 bit in bit flip</comment>
</data>
<data name="12" xml:space="preserve">
<value>12th </value>
<value>12th</value>
<comment>Sub-string used in automation name for 12 bit in bit flip</comment>
</data>
<data name="11" xml:space="preserve">
<value>11th </value>
<value>11th</value>
<comment>Sub-string used in automation name for 11 bit in bit flip</comment>
</data>
<data name="10" xml:space="preserve">
<value>10th </value>
<value>10th</value>
<comment>Sub-string used in automation name for 10 bit in bit flip</comment>
</data>
<data name="9" xml:space="preserve">
<value>9th </value>
<value>9th</value>
<comment>Sub-string used in automation name for 9 bit in bit flip</comment>
</data>
<data name="8" xml:space="preserve">
<value>8th </value>
<value>8th</value>
<comment>Sub-string used in automation name for 8 bit in bit flip</comment>
</data>
<data name="7" xml:space="preserve">
<value>7th </value>
<value>7th</value>
<comment>Sub-string used in automation name for 7 bit in bit flip</comment>
</data>
<data name="6" xml:space="preserve">
<value>6th </value>
<value>6th</value>
<comment>Sub-string used in automation name for 6 bit in bit flip</comment>
</data>
<data name="5" xml:space="preserve">
<value>5th </value>
<value>5th</value>
<comment>Sub-string used in automation name for 5 bit in bit flip</comment>
</data>
<data name="4" xml:space="preserve">
<value>4th </value>
<value>4th</value>
<comment>Sub-string used in automation name for 4 bit in bit flip</comment>
</data>
<data name="3" xml:space="preserve">
<value>3rd </value>
<value>3rd</value>
<comment>Sub-string used in automation name for 3 bit in bit flip</comment>
</data>
<data name="2" xml:space="preserve">
<value>2nd </value>
<value>2nd</value>
<comment>Sub-string used in automation name for 2 bit in bit flip</comment>
</data>
<data name="1" xml:space="preserve">
<value>1st </value>
<value>1st</value>
<comment>Sub-string used in automation name for 1 bit in bit flip</comment>
</data>
<data name="0" xml:space="preserve">
<value>0th </value>
<value>0th</value>
<comment>Sub-string used in automation name for 0 bit in bit flip</comment>
</data>
<data name="MemoryButton_Open" xml:space="preserve">

View File

@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:CalculatorApp.Common"
xmlns:controls="using:CalculatorApp.Controls"
xmlns:converters="using:CalculatorApp.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:CalculatorApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -14,11 +13,6 @@
Unloaded="OnUnloaded"
mc:Ignorable="d">
<UserControl.Resources>
<converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
<converters:BooleanToVisibilityNegationConverter x:Key="BooleanToVisibilityNegationConverter"/>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<converters:BitFlipAutomationNameConverter x:Key="BitFlipAutomationNameConverter"/>
<Style x:Key="FlippingToggleButtonStyle" TargetType="ToggleButton">
<Setter Property="FontSize" Value="20"/>
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
@@ -141,7 +135,6 @@
<Setter Property="Foreground" Value="{ThemeResource AppControlPageTextBaseMediumHighBrush}"/>
<Setter Property="AutomationProperties.AccessibilityView" Value="Raw"/>
</Style>
</UserControl.Resources>
<Grid x:Name="BitFlipPanel"
x:Uid="BitFlipPanel"
@@ -304,569 +297,761 @@
<controls:FlipButtons x:Name="Bit63"
Grid.Column="1"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='63', Mode=OneWay}"
ButtonId="BINPOS63"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 63), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>63</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit62"
Grid.Column="2"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='62', Mode=OneWay}"
ButtonId="BINPOS62"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 62), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>62</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit61"
Grid.Column="3"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='61', Mode=OneWay}"
ButtonId="BINPOS61"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 61), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>61</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit60"
Grid.Column="4"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='60', Mode=OneWay}"
ButtonId="BINPOS60"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 60), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>60</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit59"
Grid.Column="6"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='59', Mode=OneWay}"
ButtonId="BINPOS59"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 59), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>59</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit58"
Grid.Column="7"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='58', Mode=OneWay}"
ButtonId="BINPOS58"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 58), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>58</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit57"
Grid.Column="8"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='57', Mode=OneWay}"
ButtonId="BINPOS57"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 57), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>57</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit56"
Grid.Column="9"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='56', Mode=OneWay}"
ButtonId="BINPOS56"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 56), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>56</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit55"
Grid.Column="11"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='55', Mode=OneWay}"
ButtonId="BINPOS55"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 55), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>55</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit54"
Grid.Column="12"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='54', Mode=OneWay}"
ButtonId="BINPOS54"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 54), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>54</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit53"
Grid.Column="13"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='53', Mode=OneWay}"
ButtonId="BINPOS53"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 53), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>53</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit52"
Grid.Column="14"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='52', Mode=OneWay}"
ButtonId="BINPOS52"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 52), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>52</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit51"
Grid.Column="16"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='51', Mode=OneWay}"
ButtonId="BINPOS51"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 51), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>51</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit50"
Grid.Column="17"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='50', Mode=OneWay}"
ButtonId="BINPOS50"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 50), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>50</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit49"
Grid.Column="18"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='49', Mode=OneWay}"
ButtonId="BINPOS49"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 49), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>49</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit48"
Grid.Column="19"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='48', Mode=OneWay}"
ButtonId="BINPOS48"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 48), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>48</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit47"
Grid.Row="2"
Grid.Column="1"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='47', Mode=OneWay}"
ButtonId="BINPOS47"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 47), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>47</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit46"
Grid.Row="2"
Grid.Column="2"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='46', Mode=OneWay}"
ButtonId="BINPOS46"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 46), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>46</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit45"
Grid.Row="2"
Grid.Column="3"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='45', Mode=OneWay}"
ButtonId="BINPOS45"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 45), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>45</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit44"
Grid.Row="2"
Grid.Column="4"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='44', Mode=OneWay}"
ButtonId="BINPOS44"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 44), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>44</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit43"
Grid.Row="2"
Grid.Column="6"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='43', Mode=OneWay}"
ButtonId="BINPOS43"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 43), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>43</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit42"
Grid.Row="2"
Grid.Column="7"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='42', Mode=OneWay}"
ButtonId="BINPOS42"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 42), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>42</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit41"
Grid.Row="2"
Grid.Column="8"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='41', Mode=OneWay}"
ButtonId="BINPOS41"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 41), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>41</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit40"
Grid.Row="2"
Grid.Column="9"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='40', Mode=OneWay}"
ButtonId="BINPOS40"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 40), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>40</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit39"
Grid.Row="2"
Grid.Column="11"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='39', Mode=OneWay}"
ButtonId="BINPOS39"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 39), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>39</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit38"
Grid.Row="2"
Grid.Column="12"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='38', Mode=OneWay}"
ButtonId="BINPOS38"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 38), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>38</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit37"
Grid.Row="2"
Grid.Column="13"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='37', Mode=OneWay}"
ButtonId="BINPOS37"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 37), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>37</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit36"
Grid.Row="2"
Grid.Column="14"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='36', Mode=OneWay}"
ButtonId="BINPOS36"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 36), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>36</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit35"
Grid.Row="2"
Grid.Column="16"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='35', Mode=OneWay}"
ButtonId="BINPOS35"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 35), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>35</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit34"
Grid.Row="2"
Grid.Column="17"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='34', Mode=OneWay}"
ButtonId="BINPOS34"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 34), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>34</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit33"
Grid.Row="2"
Grid.Column="18"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='33', Mode=OneWay}"
ButtonId="BINPOS33"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 33), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>33</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit32"
Grid.Row="2"
Grid.Column="19"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='32', Mode=OneWay}"
ButtonId="BINPOS32"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsQwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 32), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>32</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit31"
Grid.Row="4"
Grid.Column="1"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='31', Mode=OneWay}"
ButtonId="BINPOS31"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 31), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>31</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit30"
Grid.Row="4"
Grid.Column="2"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='30', Mode=OneWay}"
ButtonId="BINPOS30"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 30), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>30</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit29"
Grid.Row="4"
Grid.Column="3"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='29', Mode=OneWay}"
ButtonId="BINPOS29"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 29), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>29</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit28"
Grid.Row="4"
Grid.Column="4"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='28', Mode=OneWay}"
ButtonId="BINPOS28"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 28), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>28</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit27"
Grid.Row="4"
Grid.Column="6"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='27', Mode=OneWay}"
ButtonId="BINPOS27"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 27), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>27</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit26"
Grid.Row="4"
Grid.Column="7"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='26', Mode=OneWay}"
ButtonId="BINPOS26"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 26), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>26</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit25"
Grid.Row="4"
Grid.Column="8"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='25', Mode=OneWay}"
ButtonId="BINPOS25"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 25), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>25</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit24"
Grid.Row="4"
Grid.Column="9"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='24', Mode=OneWay}"
ButtonId="BINPOS24"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 24), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>24</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit23"
Grid.Row="4"
Grid.Column="11"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='23', Mode=OneWay}"
ButtonId="BINPOS23"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 23), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>23</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit22"
Grid.Row="4"
Grid.Column="12"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='22', Mode=OneWay}"
ButtonId="BINPOS22"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 22), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>22</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit21"
Grid.Row="4"
Grid.Column="13"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='21', Mode=OneWay}"
ButtonId="BINPOS21"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 21), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>21</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit20"
Grid.Row="4"
Grid.Column="14"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='20', Mode=OneWay}"
ButtonId="BINPOS20"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 20), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>20</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit19"
Grid.Row="4"
Grid.Column="16"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='19', Mode=OneWay}"
ButtonId="BINPOS19"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 19), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>19</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit18"
Grid.Row="4"
Grid.Column="17"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='18', Mode=OneWay}"
ButtonId="BINPOS18"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 18), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>18</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit17"
Grid.Row="4"
Grid.Column="18"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='17', Mode=OneWay}"
ButtonId="BINPOS17"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 17), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>17</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit16"
Grid.Row="4"
Grid.Column="19"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='16', Mode=OneWay}"
ButtonId="BINPOS16"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsDwordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 16), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>16</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit15"
Grid.Row="6"
Grid.Column="1"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='15', Mode=OneWay}"
ButtonId="BINPOS15"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsWordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 15), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>15</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit14"
Grid.Row="6"
Grid.Column="2"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='14', Mode=OneWay}"
ButtonId="BINPOS14"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsWordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 14), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>14</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit13"
Grid.Row="6"
Grid.Column="3"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='13', Mode=OneWay}"
ButtonId="BINPOS13"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsWordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 13), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>13</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit12"
Grid.Row="6"
Grid.Column="4"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='12', Mode=OneWay}"
ButtonId="BINPOS12"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsWordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 12), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>12</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit11"
Grid.Row="6"
Grid.Column="6"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='11', Mode=OneWay}"
ButtonId="BINPOS11"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsWordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 11), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>11</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit10"
Grid.Row="6"
Grid.Column="7"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='10', Mode=OneWay}"
ButtonId="BINPOS10"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsWordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 10), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>10</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit9"
Grid.Row="6"
Grid.Column="8"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='9', Mode=OneWay}"
ButtonId="BINPOS9"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsWordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 9), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>9</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit8"
Grid.Row="6"
Grid.Column="9"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='8', Mode=OneWay}"
ButtonId="BINPOS8"
Checked="OnBitToggled"
IsEnabled="{x:Bind Model.IsWordEnabled, Mode=OneWay}"
Unchecked="OnBitToggled"/>
IsEnabled="{x:Bind ShouldEnableBit(Model.ValueBitLength, 8), Mode=OneWay}"
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>8</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit7"
Grid.Row="6"
Grid.Column="11"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='7', Mode=OneWay}"
ButtonId="BINPOS7"
Checked="OnBitToggled"
Unchecked="OnBitToggled"/>
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>7</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit6"
Grid.Row="6"
Grid.Column="12"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='6', Mode=OneWay}"
ButtonId="BINPOS6"
Checked="OnBitToggled"
Unchecked="OnBitToggled"/>
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>6</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit5"
Grid.Row="6"
Grid.Column="13"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='5', Mode=OneWay}"
ButtonId="BINPOS5"
Checked="OnBitToggled"
Unchecked="OnBitToggled"/>
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>5</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit4"
Grid.Row="6"
Grid.Column="14"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='4', Mode=OneWay}"
ButtonId="BINPOS4"
Checked="OnBitToggled"
Unchecked="OnBitToggled"/>
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>4</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit3"
Grid.Row="6"
Grid.Column="16"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='3', Mode=OneWay}"
ButtonId="BINPOS3"
Checked="OnBitToggled"
Unchecked="OnBitToggled"/>
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>3</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit2"
Grid.Row="6"
Grid.Column="17"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='2', Mode=OneWay}"
ButtonId="BINPOS2"
Checked="OnBitToggled"
Unchecked="OnBitToggled"/>
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>2</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit1"
Grid.Row="6"
Grid.Column="18"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='1', Mode=OneWay}"
ButtonId="BINPOS1"
Checked="OnBitToggled"
Unchecked="OnBitToggled"/>
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>1</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
<controls:FlipButtons x:Name="Bit0"
Grid.Row="6"
Grid.Column="19"
Style="{StaticResource FlippingToggleButtonStyle}"
AutomationProperties.Name="{x:Bind Model.BinaryDisplayValue, Converter={StaticResource BitFlipAutomationNameConverter}, ConverterParameter='0', Mode=OneWay}"
ButtonId="BINPOS0"
Checked="OnBitToggled"
Unchecked="OnBitToggled"/>
Unchecked="OnBitToggled">
<controls:FlipButtons.Tag>
<x:Int32>0</x:Int32>
</controls:FlipButtons.Tag>
</controls:FlipButtons>
</Grid>
</UserControl>

View File

@@ -11,6 +11,8 @@
#include "CalcViewModel/Common/TraceLogger.h"
#include "CalcViewModel/Common/LocalizationSettings.h"
#include "Converters/BooleanToVisibilityConverter.h"
#include <CalcViewModel/Common/AppResourceProvider.h>
#include "CalcViewModel/Common/LocalizationStringUtil.h"
using namespace CalculatorApp;
using namespace CalculatorApp::Common;
@@ -19,6 +21,7 @@ using namespace CalculatorApp::ViewModel;
using namespace Platform;
using namespace std;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Automation;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
@@ -29,15 +32,11 @@ CalculatorProgrammerBitFlipPanel::CalculatorProgrammerBitFlipPanel()
: m_updatingCheckedStates(false)
{
InitializeComponent();
auto booleanToVisibilityConverter = ref new Converters::BooleanToVisibilityConverter;
SetVisibilityBinding(BitFlipPanel, L"IsBinaryBitFlippingEnabled", booleanToVisibilityConverter);
AssignFlipButtons();
}
void CalculatorProgrammerBitFlipPanel::OnLoaded(Object ^ sender, RoutedEventArgs ^ e)
{
UnsubscribePropertyChanged();
SubscribePropertyChanged();
}
@@ -51,8 +50,7 @@ void CalculatorProgrammerBitFlipPanel::SubscribePropertyChanged()
if (Model != nullptr)
{
m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorProgrammerBitFlipPanel::OnPropertyChanged);
UpdateCheckedStates();
UpdateCheckedStates(true);
}
}
@@ -67,9 +65,19 @@ void CalculatorProgrammerBitFlipPanel::UnsubscribePropertyChanged()
void CalculatorProgrammerBitFlipPanel::OnPropertyChanged(Object ^ sender, PropertyChangedEventArgs ^ e)
{
if (e->PropertyName == StandardCalculatorViewModel::BinaryDisplayValuePropertyName)
if (e->PropertyName == StandardCalculatorViewModel::BinaryDigitsPropertyName)
{
UpdateCheckedStates();
UpdateCheckedStates(false);
}
else if (e->PropertyName == StandardCalculatorViewModel::IsBitFlipCheckedPropertyName
|| e->PropertyName == StandardCalculatorViewModel::IsProgrammerPropertyName)
{
if (Model->IsBitFlipChecked && Model->IsProgrammer)
{
// OnBitToggle won't update the automation properties when this control isn't displayed
// We need to update all automation properties names manually when the BitFlipPanel is displayed again
UpdateAutomationPropertiesNames();
}
}
}
@@ -148,14 +156,6 @@ void CalculatorProgrammerBitFlipPanel::AssignFlipButtons()
m_flipButtons[63] = this->Bit63;
}
void CalculatorProgrammerBitFlipPanel::SetVisibilityBinding(_In_ FrameworkElement ^ element, _In_ String ^ path, _In_ IValueConverter ^ converter)
{
Binding ^ commandBinding = ref new Binding();
commandBinding->Path = ref new PropertyPath(path);
commandBinding->Converter = converter;
element->SetBinding(VisibilityProperty, commandBinding);
}
void CalculatorProgrammerBitFlipPanel::OnBitToggled(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
{
if (m_updatingCheckedStates)
@@ -168,14 +168,16 @@ void CalculatorProgrammerBitFlipPanel::OnBitToggled(_In_ Object ^ sender, _In_ R
// Also, if the mode is switched to other Calculator modes when the BitFlip panel is open,
// a race condition exists in which the IsProgrammerMode property is still true and the UpdatePrimaryResult() is called,
// which continuously alters the Display Value and the state of the Bit Flip buttons.
if ((Model->IsBitFlipChecked) && Model->IsProgrammer)
if (Model->IsBitFlipChecked && Model->IsProgrammer)
{
auto flipButton = static_cast<FlipButtons ^>(sender);
int index = static_cast<int>(flipButton->Tag);
flipButton->SetValue(AutomationProperties::NameProperty, GenerateAutomationPropertiesName(index, flipButton->IsChecked->Value));
Model->ButtonPressed->Execute(flipButton->ButtonId);
}
}
void CalculatorProgrammerBitFlipPanel::UpdateCheckedStates()
void CalculatorProgrammerBitFlipPanel::UpdateCheckedStates(bool updateAutomationPropertiesNames)
{
assert(!m_updatingCheckedStates);
assert(m_flipButtons.size() == s_numBits);
@@ -185,35 +187,57 @@ void CalculatorProgrammerBitFlipPanel::UpdateCheckedStates()
return;
}
static const wchar_t ch0 = LocalizationSettings::GetInstance().GetDigitSymbolFromEnUsDigit(L'0');
// Filter any unwanted characters from the displayed string.
static constexpr array<wchar_t, 4> unwantedChars = { L' ', Utils::LRE, Utils::PDF, Utils::LRO };
wstringstream stream;
wstring displayValue = Model->BinaryDisplayValue->Data();
for (const wchar_t& c : displayValue)
{
if (find(begin(unwantedChars), end(unwantedChars), c) == unwantedChars.end())
{
stream << c;
}
}
wstring rawDisplay = stream.str();
size_t paddingCount = s_numBits - rawDisplay.length();
wstring setBits = wstring(paddingCount, ch0) + rawDisplay;
assert(setBits.length() == s_numBits);
m_updatingCheckedStates = true;
for (unsigned int bitIndex = 0; bitIndex < s_numBits; bitIndex++)
auto it = m_flipButtons.begin();
int index = 0;
for (bool val : Model->BinaryDigits)
{
// Highest bit (64) is at index 0 in bit string.
// To get bit 0, grab from opposite end of string.
wchar_t bit = setBits[s_numBits - bitIndex - 1];
m_flipButtons[bitIndex]->IsChecked = (bit != ch0);
FlipButtons ^ flipButton = *it;
if (updateAutomationPropertiesNames)
{
flipButton->SetValue(AutomationProperties::NameProperty, GenerateAutomationPropertiesName(index, flipButton->IsChecked->Value));
}
flipButton->IsChecked = val;
++it;
++index;
}
m_updatingCheckedStates = false;
}
void CalculatorProgrammerBitFlipPanel::UpdateAutomationPropertiesNames()
{
for (FlipButtons ^ flipButton : m_flipButtons)
{
int index = static_cast<int>(flipButton->Tag);
flipButton->SetValue(AutomationProperties::NameProperty, GenerateAutomationPropertiesName(index, flipButton->IsChecked->Value));
}
}
bool CalculatorProgrammerBitFlipPanel::ShouldEnableBit(BitLength length, int index)
{
switch (length)
{
case BitLength::BitLengthQWord:
return index <= 63;
case BitLength::BitLengthDWord:
return index <= 31;
case BitLength::BitLengthWord:
return index <= 15;
case BitLength::BitLengthByte:
return index <= 7;
}
return false;
}
String ^ CalculatorProgrammerBitFlipPanel::GenerateAutomationPropertiesName(int position, bool value) const
{
auto resourceLoader = AppResourceProvider::GetInstance();
String ^ indexName = resourceLoader.GetResourceString(ref new Platform::String(to_wstring(position).c_str()));
String ^ automationNameTemplate = resourceLoader.GetResourceString(L"BitFlipItemAutomationName");
String ^ bitPositionTemplate = resourceLoader.GetResourceString(L"BitPosition");
wstring bitPosition = LocalizationStringUtil::GetLocalizedString(bitPositionTemplate->Data(), indexName->Data());
return ref new String(LocalizationStringUtil::GetLocalizedString(automationNameTemplate->Data(), bitPosition.c_str(), value ? L"1" : L"0").c_str());
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
@@ -10,9 +10,6 @@
#include "Views/CalculatorProgrammerBitFlipPanel.g.h"
#include "Controls/FlipButtons.h"
#include "Converters/BitFlipAutomationNameConverter.h"
#include "Converters/BooleanNegationConverter.h"
#include "Converters/VisibilityNegationConverter.h"
#include "CalcViewModel/StandardCalculatorViewModel.h"
namespace CalculatorApp
@@ -22,6 +19,8 @@ namespace CalculatorApp
public:
CalculatorProgrammerBitFlipPanel();
bool ShouldEnableBit(CalculatorApp::Common::BitLength length, int index);
property CalculatorApp::ViewModel::StandardCalculatorViewModel
^ Model { CalculatorApp::ViewModel::StandardCalculatorViewModel ^ get(); }
@@ -34,15 +33,13 @@ namespace CalculatorApp
void AssignFlipButtons();
void SetVisibilityBinding(
_In_ Windows::UI::Xaml::FrameworkElement ^ element,
_In_ Platform::String ^ path,
_In_ Windows::UI::Xaml::Data::IValueConverter ^ converter);
void OnBitToggled(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
void UpdateCheckedStates();
private:
Windows::Foundation::EventRegistrationToken m_propertyChangedToken;
Platform::String ^ GenerateAutomationPropertiesName(int position, bool value) const;
void UpdateCheckedStates(bool updateAutomationPropertiesNames);
void UpdateAutomationPropertiesNames();
static const unsigned int s_numBits = 64;
std::array<CalculatorApp::Controls::FlipButtons ^, s_numBits> m_flipButtons;

View File

@@ -37,42 +37,29 @@ void CalculatorProgrammerDisplayPanel::OnBitLengthButtonPressed(Object ^ paramet
ByteButton->Visibility = ::Visibility::Collapsed;
if (buttonId == "0")
{
Model->ButtonPressed->Execute(NumbersAndOperatorsEnum::Dword);
Model->ValueBitLength = BitLength::BitLengthDWord;
DwordButton->Visibility = ::Visibility::Visible;
DwordButton->Focus(::FocusState::Programmatic);
Model->IsQwordEnabled = false;
Model->IsDwordEnabled = true;
Model->IsWordEnabled = true;
}
else if (buttonId == "1")
{
Model->ButtonPressed->Execute(NumbersAndOperatorsEnum::Word);
Model->ValueBitLength = BitLength::BitLengthWord;
WordButton->Visibility = ::Visibility::Visible;
WordButton->Focus(::FocusState::Programmatic);
Model->IsQwordEnabled = false;
Model->IsDwordEnabled = false;
Model->IsWordEnabled = true;
}
else if (buttonId == "2")
{
Model->ButtonPressed->Execute(NumbersAndOperatorsEnum::Byte);
Model->ValueBitLength = BitLength::BitLengthByte;
ByteButton->Visibility = ::Visibility::Visible;
ByteButton->Focus(::FocusState::Programmatic);
Model->IsQwordEnabled = false;
Model->IsDwordEnabled = false;
Model->IsWordEnabled = false;
}
else if (buttonId == "3")
{
Model->ButtonPressed->Execute(NumbersAndOperatorsEnum::Qword);
Model->ValueBitLength = BitLength::BitLengthQWord;
QwordButton->Visibility = ::Visibility::Visible;
QwordButton->Focus(::FocusState::Programmatic);
Model->IsQwordEnabled = true;
Model->IsDwordEnabled = true;
Model->IsWordEnabled = true;
}
// update memory list according to bit length
Model->SetMemorizedNumbersString();
}
bool CalculatorProgrammerDisplayPanel::IsErrorVisualState::get()

View File

@@ -27,9 +27,6 @@ CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators()
: m_isErrorVisualState(false)
{
InitializeComponent();
auto booleanToVisibilityNegationConverter = ref new Converters::BooleanToVisibilityNegationConverter;
SetVisibilityBinding(ProgRadixOps, L"IsBinaryBitFlippingEnabled", booleanToVisibilityNegationConverter);
}
void CalculatorProgrammerRadixOperators::OnLoaded(Object ^, RoutedEventArgs ^)
@@ -70,14 +67,6 @@ void CalculatorProgrammerRadixOperators::Shift_Clicked(Platform::Object ^ sender
}
}
void CalculatorProgrammerRadixOperators::SetVisibilityBinding(FrameworkElement ^ element, String ^ path, IValueConverter ^ converter)
{
Binding ^ commandBinding = ref new Binding();
commandBinding->Path = ref new PropertyPath(path);
commandBinding->Converter = converter;
element->SetBinding(VisibilityProperty, commandBinding);
}
void CalculatorProgrammerRadixOperators::ProgModeRadixChange()
{
NumberPad->ProgModeRadixChange();

View File

@@ -32,7 +32,6 @@ namespace CalculatorApp
private:
void Shift_Clicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void SetVisibilityBinding(Windows::UI::Xaml::FrameworkElement ^ element, Platform::String ^ path, Windows::UI::Xaml::Data::IValueConverter ^ converter);
void OnLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void OnUnloaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void ProgModeRadixChange();

View File

@@ -100,7 +100,7 @@
<!-- PLACEHOLDER!!!! This is where the converter goes when it is delay loaded -->
</Border>
</Grid>
<muxc:NavigationView x:Name="NavView"
x:Uid="NavView"
Grid.Row="1"
@@ -108,9 +108,10 @@
DataContext="{x:Bind Model}"
ExpandedModeThresholdWidth="Infinity"
IsBackButtonVisible="Collapsed"
IsPaneToggleButtonVisible="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}"
IsEnabled="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}"
IsPaneToggleButtonVisible="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}"
IsSettingsVisible="False"
ItemInvoked="OnNavItemInvoked"
Loaded="OnNavLoaded"
MenuItemsSource="{x:Bind CreateUIElementsForCategories(Model.Categories), Mode=OneWay}"
OpenPaneLength="{StaticResource SplitViewOpenPaneLength}"
@@ -118,7 +119,6 @@
PaneOpened="OnNavPaneOpened"
PaneOpening="OnNavPaneOpening"
SelectionChanged="OnNavSelectionChanged"
ItemInvoked="OnNavItemInvoked"
TabIndex="1"
UseSystemFocusVisuals="True">
@@ -156,29 +156,29 @@
</muxc:NavigationView.PaneFooter>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="Header"
Grid.Column="0"
Margin="52,6,12,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{x:Bind Model.CategoryName, Mode=OneWay}"
Grid.Column="0"/>
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
<Button x:Name="NormalAlwaysOnTopButton"
x:Uid="EnterAlwaysOnTopButton"
FontFamily="{StaticResource CalculatorFontFamily}"
Style="{StaticResource SquareIconButtonStyle}"
Content="&#xEE49;"
Click="AlwaysOnTopButtonClick"
Grid.Column="1"
VerticalAlignment="Top"
HorizontalContentAlignment="Center"
Style="{StaticResource SquareIconButtonStyle}"
Background="Transparent"
Visibility="{x:Bind Model.DisplayNormalAlwaysOnTopOption, Mode=OneWay}"
FontFamily="{StaticResource CalculatorFontFamily}"
AutomationProperties.AutomationId="NormalAlwaysOnTopButton"
Grid.Column="1"/>
Click="AlwaysOnTopButtonClick"
Content="&#xEE49;"
Visibility="{x:Bind Model.DisplayNormalAlwaysOnTopOption, Mode=OneWay}"/>
</Grid>
</muxc:NavigationView>
</Grid>

View File

@@ -1,15 +1,12 @@
<UserControl x:Class="CalculatorApp.OperatorsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:CalculatorApp.Common"
xmlns:controls="using:CalculatorApp.Controls"
xmlns:converters="using:CalculatorApp.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:CalculatorApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
UseLayoutRounding="False"
d:DesignHeight="315"
d:DesignWidth="235"
UseLayoutRounding="False"
mc:Ignorable="d">
<Grid>
<local:CalculatorStandardOperators x:Name="StandardOperators"
@@ -25,14 +22,12 @@
<local:CalculatorProgrammerBitFlipPanel x:Name="BitFlipPanel"
x:Load="False"
IsEnabled="{x:Bind Model.IsBinaryBitFlippingEnabled, Mode=OneWay}"
Visibility="{x:Bind IsBitFlipChecked, Mode=OneWay}"/>
Visibility="{x:Bind Model.IsBinaryBitFlippingEnabled, Mode=OneWay}"/>
<local:CalculatorProgrammerRadixOperators x:Name="ProgrammerRadixOperators"
x:Load="False"
IsEnabled="{x:Bind Model.AreProgrammerRadixOperatorsEnabled, Mode=OneWay}"
TabIndex="16"
Visibility="{x:Bind Model.IsProgrammer, Mode=OneWay}"/>
Visibility="{x:Bind Model.AreProgrammerRadixOperatorsEnabled, Mode=OneWay}"/>
</Grid>
</UserControl>