Ejemplo n.º 1
0
        private static void OnLabelFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //Get access to the instance of CircularGaugeConrol whose property value changed
            SwitchButton gauge = d as SwitchButton;

            gauge.lbStart.FontSize = (double)e.NewValue;
        }
Ejemplo n.º 2
0
        private static void OnLabelRedContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //Get access to the instance of CircularGaugeConrol whose property value changed
            SwitchButton gauge = d as SwitchButton;

            gauge.m_BtnOnOffContents[1] = e.NewValue.ToString();
        }
Ejemplo n.º 3
0
        private static void OnIsEnableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //Get access to the instance of CircularGaugeConrol whose property value changed
            SwitchButton gauge = d as SwitchButton;

            gauge.btnStart.IsEnabled = (bool)e.NewValue;
            gauge.btnStart.Opacity   = gauge.btnStart.IsEnabled ? 1 : 0.3;
        }
Ejemplo n.º 4
0
        private static void OnIsButtonGreenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SwitchButton gauge = d as SwitchButton;

            //状态与实际颜色相反,表示点击可进行的操作,例如开启状态下是红色,表示点击可关闭
            int index = Convert.ToInt32(!(bool)e.NewValue);

            gauge.lbStart.Content = gauge.m_BtnOnOffContents[index];
            //修改按钮图片
            gauge.btnStart.DataContext = gauge.m_BtnBackgroundImgs[index];
            gauge.lbStart.Foreground   = gauge.m_BtnBackgroundColor[index];
        }