示例#1
0
        void EnsureCalculator()
        {
            if (m_calculator == null)
            {
                // delay load calculator.
                m_calculator             = new Calculator();
                m_calculator.Name        = "Calculator";
                m_calculator.DataContext = m_model.CalculatorViewModel;
                Binding isStandardBinding = new Binding();
                isStandardBinding.Path = new PropertyPath("IsStandard");
                m_calculator.SetBinding(CalculatorApp.Calculator.IsStandardProperty, isStandardBinding);
                Binding isScientificBinding = new Binding();
                isScientificBinding.Path = new PropertyPath("IsScientific");
                m_calculator.SetBinding(CalculatorApp.Calculator.IsScientificProperty, isScientificBinding);
                Binding isProgramerBinding = new Binding();
                isProgramerBinding.Path = new PropertyPath("IsProgrammer");
                m_calculator.SetBinding(CalculatorApp.Calculator.IsProgrammerProperty, isProgramerBinding);

#if NETFX_CORE
                // UNO TODO
                m_calculator.Style = CalculatorBaseStyle;
#endif

                CalcHolder.Child = m_calculator;

                // Calculator's "default" state is visible, but if we get delay loaded
                // when in converter, we should not be visible. This is not a problem for converter
                // since it's default state is hidden.
                ShowHideControls(this.Model.Mode);
            }

            if (m_dateCalculator != null)
            {
                // UNO TODO
                // m_dateCalculator.CloseCalendarFlyout();
            }
        }