Beispiel #1
0
        void AssociatedObject_Click(object sender, RoutedEventArgs e)
        {
            TileViewControl tileControl = (TileViewControl)VisualUtils.FindAncestor(sender as System.Windows.Media.Visual, typeof(TileViewControl));
            TileViewItem    tileitem    = tileControl.ItemContainerGenerator.ContainerFromIndex(tileControl.SelectedIndex) as TileViewItem;

            tileitem.TileViewItemState = TileViewItemState.Normal;
        }
Beispiel #2
0
 public TileViewItem GetTileItem()
 {
     if (tileItems == null)
     {
         tileItems = VisualUtils.FindAncestor(this.Target, typeof(TileViewItem)) as TileViewItem;
     }
     return(tileItems);
 }
Beispiel #3
0
        private void ComboBoxAdv_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItemAdv item;
            MainWindow      samplewindow = VisualUtils.FindAncestor((Visual)this, typeof(MainWindow)) as MainWindow;
            ComboBoxAdv     combo        = sender as ComboBoxAdv;

            if (combo != null && samplewindow != null)
            {
                if (combo.SelectedItem != null)
                {
                    item = combo.SelectedItem as ComboBoxItemAdv;
                    SkinStorage.SetVisualStyle(samplewindow, item.Content.ToString());
                }
            }
        }
Beispiel #4
0
        protected override void OnAttached()
        {
            AssociatedObject.Loaded += (sender, e) =>
            {
                TimeConsumingView control = sender as TimeConsumingView;

                TabControlExt tabcontrol = VisualUtils.FindAncestor(control as Visual, typeof(TabControlExt)) as TabControlExt;

                if (tabcontrol != null)
                {
                    int index = tabcontrol.Items.IndexOf(control);

                    if (index > -1 && index < tabcontrol.Items.Count && index == 0)
                    {
                        for (int i = 0; i < tabcontrol.Items.Count; i++)
                        {
                            TabItemExt item = tabcontrol.ItemContainerGenerator.ContainerFromIndex(i) as TabItemExt;
                            if (item != null)
                            {
                                switch (i)
                                {
                                case 0:
                                    item.Header = "2006-2007";
                                    break;

                                case 1:
                                    item.Header = "2007-2008";
                                    break;

                                case 2:
                                    item.Header = "2008-2009";
                                    break;

                                case 3:
                                    item.Header = "2009-2010";
                                    break;

                                case 4:
                                    item.Header = "2010-2011";
                                    break;

                                case 5:
                                    item.Header = "2011-2012";
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                    }
                }

                if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
                {
                    DemoBrowserViewModel samplecontrol = null;
                    if ((System.Windows.Application.Current.MainWindow.DataContext is DemoBrowserViewModel))
                    {
                        samplecontrol = (System.Windows.Application.Current.MainWindow.DataContext as DemoBrowserViewModel);
                    }
                    if (control.reload.IsChecked.Value)
                    {
                        samplecontrol.IsProductDemoBusy = true;

                        Dispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(() =>
                        {
                            control.Chart1.DataContext      = new TestingViewModel();
                            control.Chart2.DataContext      = new ChartViewModel();
                            samplecontrol.IsProductDemoBusy = false;
                            isloaded = true;
                        }));
                    }
                    else
                    {
                        if (!isloaded)
                        {
                            samplecontrol.IsProductDemoBusy = true;

                            Dispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(() =>
                            {
                                control.Chart1.DataContext      = new TestingViewModel();
                                control.Chart2.DataContext      = new ChartViewModel();
                                samplecontrol.IsProductDemoBusy = false;
                                isloaded = true;
                            }));
                        }
                    }
                }
            };
        }
        /// <summary>
        /// Invokes the specified parameter.
        /// </summary>
        /// <param name="parameter">Specifies the object of invoke method.</param>
        protected override void Invoke(object parameter)
        {
            var    comboBox = this.AssociatedObject as RibbonComboBox;
            Window window   = VisualUtils.FindAncestor(comboBox, typeof(Window)) as Window;

            // Apply Visual Style based on the selected theme
            if (window != null && comboBox != null)
            {
                switch ((comboBox.SelectedItem as Model).Skins)
                {
                case "Metro":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Metro);
                    break;

                case "Blend":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Blend);
                    break;

                case "Lime":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Lime);
                    break;

                case "Saffron":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Saffron);
                    break;

                case "Office365":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office365);
                    break;

                case "Office2016Colorful":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2016Colorful);
                    break;

                case "Office2016DarkGray":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2016DarkGray);
                    break;

                case "Office2016White":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2016White);
                    break;

                case "VisualStudio2013":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.VisualStudio2013);
                    break;

                case "Office2013DarkGray":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2013DarkGray);
                    break;

                case "Office2013LightGray":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2013LightGray);
                    break;

                case "Office2013White":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2013White);
                    break;

                case "Office2010Blue":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2010Blue);
                    break;

                case "Office2010Black":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2010Black);
                    break;

                case "Office2010Silver":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2010Silver);
                    break;

                case "VisualStudio2015":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.VisualStudio2015);
                    break;

                case "SystemTheme":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.SystemTheme);
                    break;

                default:
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Default);
                    break;
                }
            }
        }
        /// <summary>
        /// Invokes the specified parameter.
        /// </summary>
        /// <param name="parameter">The parameter.</param>
        protected override void Invoke(object parameter)
        {
            var    cb     = this.AssociatedObject as ComboBox;
            Window window = VisualUtils.FindAncestor(cb, typeof(Window)) as Window;

            // Apply Visual Style based on the selected theme
            if (window != null && cb != null)
            {
                switch (cb.SelectedItem.ToString())
                {
                case "Metro":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Metro);
                    break;

                case "Saffron":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Saffron);
                    break;

                case "Office365":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office365);
                    break;

                case "Office2016Colorful":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2016Colorful);
                    break;

                case "Office2016DarkGray":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2016DarkGray);
                    break;

                case "Office2016White":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2016White);
                    break;

                case "VisualStudio2013":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.VisualStudio2013);
                    break;

                case "Office2013DarkGray":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2013DarkGray);
                    break;

                case "Office2013LightGray":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2013LightGray);
                    break;

                case "Office2013White":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2013White);
                    break;

                case "Office2010Blue":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2010Blue);
                    break;

                case "Office2010Black":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2010Black);
                    break;

                case "Office2010Silver":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Office2010Silver);
                    break;

                case "VisualStudio2015":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.VisualStudio2015);
                    break;

                case "SystemTheme":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.SystemTheme);
                    break;

                case "Material Light":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.MaterialLight);
                    break;

                case "Material Light Blue":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.MaterialLightBlue);
                    break;

                case "Material Dark":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.MaterialDark);
                    break;

                case "Material Dark Blue":
                    SfSkinManager.SetVisualStyle(window, VisualStyles.MaterialDarkBlue);
                    break;

                default:
                    SfSkinManager.SetVisualStyle(window, VisualStyles.Default);
                    break;
                }
            }
        }