Пример #1
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (!(values[0] is FrameworkElement fxElement))
            {
                return(null);
            }

            // Default style is Inactive...
            var fxStyle = fxElement.FindResource("CairoTaskbarButtonInactiveStyle");

            if (values[1] == null)
            {
                // Default - couldn't get window state.
                return(fxStyle);
            }

            EnumUtility.TryCast(values[1], out ApplicationWindow.WindowState winState, ApplicationWindow.WindowState.Inactive);
            switch (winState)
            {
            case ApplicationWindow.WindowState.Active:
                fxStyle = fxElement.FindResource("CairoTaskbarButtonActiveStyle");
                break;

            case ApplicationWindow.WindowState.Flashing:
                fxStyle = fxElement.FindResource("CairoTaskbarButtonFlashingStyle");
                break;

                // case ApplicationWindow.WindowState.Hidden:
                //     fxStyle = fxElement.FindResource("CairoTaskbarButtonHiddenStyle");
                //     break;
            }

            return(fxStyle);
        }
Пример #2
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (!(values[0] is FrameworkElement fxElement))
            {
                return(null);
            }

            // Default style is Inactive...
            var fxStyle = fxElement.FindResource("CairoTaskbarButtonInactiveStyle");

            if (values[1] == DependencyProperty.UnsetValue || values[1] == null)
            {
                // Default - couldn't get window state.
                return(fxStyle);
            }

            EnumUtility.TryCast(values[1], out ApplicationWindow.WindowState winState, ApplicationWindow.WindowState.Inactive);

            if (winState == ApplicationWindow.WindowState.Active)
            {
                fxStyle = fxElement.FindResource("CairoTaskbarButtonActiveStyle");
            }

            return(fxStyle);
        }