private static void BackgroundStyleCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { CanvasLayoutThumbnail _owner = d as CanvasLayoutThumbnail; BackgroundItem backgroundItem = e.NewValue as BackgroundItem; if (backgroundItem != null) { _owner.Background = backgroundItem.ColorStyle; } }
public BackgroundObject(BackgroundItem item) { graphic = item.Graphic; unknown = item.Unknown; x = item.X; y = item.Y; id = item.Id; linkedId = item.LinkedId; flags = item.Flags; doorTiming = item.DoorTiming; unknownFlags = item.UnknownFlags; }
public WallWindow(MainWindowManager manager, bool edit, BackgroundItem bgItem) { InitializeComponent(); this.manager = manager; openFileManager = new OpenFileManager(); this.edit = edit; this.bgItem = bgItem; if (edit) { SetValues(); } }
/// <summary> /// Saves the wall's information and closes the window. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AcceptWall_Click(object sender, RoutedEventArgs e) { string errorMessage = null; try { if (String.IsNullOrEmpty(name)) { errorMessage = "You have to input a name."; throw new NullReferenceException(); } if (String.IsNullOrEmpty(image)) { errorMessage = "You have to select an image for the wall."; throw new NullReferenceException(); } name = name.Replace(" ", "_"); if (manager.CheckIfNumber(name)) { errorMessage = "The name cannot be only numbers."; throw new Exception(); } if (edit) { manager.BgItems.Remove(bgItem); } if (manager.NameRepeated(name)) { errorMessage = "This name already exists"; throw new NullReferenceException(); } BackgroundItem auxBgItem = new BackgroundItem(name, solid, bulletProof, image); manager.BgItems.Add(auxBgItem); manager.BgItems.OrderBy(x => x.Name); this.Close(); } catch (Exception) { MessageBox.Show(errorMessage, "Attention", MessageBoxButton.OK, MessageBoxImage.Warning); } }
bool IsDoor(BackgroundItem bk) { if (bk.Graphic >= 1 && bk.Graphic <= 16) { return(true); } if (bk.Graphic >= 23 && bk.Graphic <= 26) { return(true); } if (bk.Graphic >= 32 && bk.Graphic <= 36) { return(true); } return(false); }
static BackgroundItem() { m_instance = new BackgroundItem(); }
//#region PreviewColorCommand //private static RelayCommand _previewColorCommand; ///// <summary> ///// Command khi rê chuột chọn màu ///// </summary> //public static RelayCommand PreviewColorCommand //{ // get { return _previewColorCommand ?? (_previewColorCommand = new RelayCommand(p => PreviewExecute(p))); } //} //private static void PreviewExecute(object p) //{ // if (p is GalleryItem galleryItem) // { // Global.BeginInit(); // EColorManagment eColor = galleryItem.Content as EColorManagment; // if ((Application.Current as IAppGlobal).SelectedTheme != null && (Application.Current as IAppGlobal).DocumentControl != null) // { // (Application.Current as IAppGlobal).SelectedTheme.Colors = eColor; // if ((Application.Current as IAppGlobal).SelectedThemeView != null) // (Application.Current as IAppGlobal).SelectedThemeView.Colors = eColor; // (Application.Current as IAppGlobal).SelectedSlide.UpdateThemeColor(); // } // Global.EndInit(); // } //} //#endregion //#region PreviewColorCancelCommand //private static RelayCommand _PreviewColorCancelCommand; //public static RelayCommand PreviewColorCancelCommand //{ // get { return _PreviewColorCancelCommand ?? (_PreviewColorCancelCommand = new RelayCommand(p => PreviewColorCancelExecute(p))); } //} //private static void PreviewColorCancelExecute(object p) //{ // if (BackupColor != null) // { // Global.BeginInit(); // if (!IsChangeColor) // { // if ((Application.Current as IAppGlobal).SelectedTheme != null && (Application.Current as IAppGlobal).DocumentControl != null) // { // (Application.Current as IAppGlobal).SelectedTheme.Colors = BackupColor; // if ((Application.Current as IAppGlobal).SelectedThemeView != null) // (Application.Current as IAppGlobal).SelectedThemeView.Colors = BackupColor; // foreach (var item in (Application.Current as IAppGlobal).DocumentControl.Slides) // { // item.UpdateThemeColor(); // } // } // } // else // { // IsChangeColor = false; // } // Global.EndInit(); // } //} //#endregion //#region ColorDropDownCommand //private static RelayCommand _colorDropDownCommand; //public static RelayCommand ColorDropDownCommand //{ // get { return _colorDropDownCommand ?? (_colorDropDownCommand = new RelayCommand(p => ColorDropDownExecute())); } //} //private static void ColorDropDownExecute() //{ // BackupColor = (Application.Current as IAppGlobal).SelectedTheme.Colors; //} //#endregion //private RelayCommand _treeviewCommand; //public RelayCommand TreeViewCommand //{ // get { return _treeviewCommand ?? (_treeviewCommand = new RelayCommand(p => TreeViewExecute(p))); } //} //private void TreeViewExecute(object p) //{ // SlideMaster slide = null; // if ((Application.Current as IAppGlobal).SelectedSlide is SlideMaster slideMaster) // { // slide = slideMaster; // } // else if ((Application.Current as IAppGlobal).SelectedSlide is LayoutMaster layoutMaster) // { // slide = layoutMaster.SlideParent; // } // if (slide != null) // { // foreach (EThemes item in (Application.Current as IAppGlobal).LocalThemesCollection) // { // if (slide.ThemesName == item.Name) // { // (Application.Current as IAppGlobal).SelectedThemes = item; // } // } // ThemeDesign.SelectedValue = (Application.Current as IAppGlobal).SelectedThemes; // } //} //#endregion #region GenerateBackgroundStype /// <summary> /// Tạo ra các Background Style /// </summary> private void GenerateBackgroundStype() { //Style1 BackgroundItem bgItem = new BackgroundItem(); ColorGradientBrush gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); LinearGradientBrush gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 1); GradientStop gradientStop = new GradientStop(); gradientStop.Offset = 0.0; gradientStop.Color = Colors.Transparent; gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "", Brightness = 1 }, Offset = 0.0 }); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 1"; Backgrounds.Add(bgItem); //Style2 bgItem = new BackgroundItem(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 1); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); Binding _binding = new Binding("SelectedTheme.Colors.Accent4.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 4", Brightness = 1 }, Offset = 0.0 }); gradientBrush.GradientStops.Add(gradientStop); _binding = new Binding("SelectedTheme.Colors.Accent4.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 4", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 2"; Backgrounds.Add(bgItem); //Style3 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 1); _binding = new Binding("SelectedTheme.Colors.Accent5.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 5", Brightness = 1 }, Offset = 0.0 }); gradientBrush.GradientStops.Add(gradientStop); _binding = new Binding("SelectedTheme.Colors.Accent5.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 5", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 3"; Backgrounds.Add(bgItem); //Style4 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 1); _binding = new Binding("SelectedTheme.Colors.Accent6.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 6", Brightness = 1 }, Offset = 0.0 }); gradientBrush.GradientStops.Add(gradientStop); _binding = new Binding("SelectedTheme.Colors.Accent6.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 6", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 4"; Backgrounds.Add(bgItem); //Style5 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 0); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.BackgroundDark1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền tối 1", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 5"; Backgrounds.Add(bgItem); //Style6 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 0); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent4.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 4", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 6"; Backgrounds.Add(bgItem); //Style7 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 0); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent5.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 5", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 7"; Backgrounds.Add(bgItem); //Style8 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 0); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent6.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 6", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 8"; Backgrounds.Add(bgItem); //Style9 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); RadialGradientBrush radialGradient = new RadialGradientBrush(); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); radialGradient.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.BackgroundDark1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền tối 1", Brightness = 1 }, Offset = 1.0 }); radialGradient.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = radialGradient; bgItem.Name = "Style 9"; Backgrounds.Add(bgItem); //Style10 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); radialGradient = new RadialGradientBrush(); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); radialGradient.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent4.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 4", Brightness = 1 }, Offset = 1.0 }); radialGradient.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = radialGradient; bgItem.Name = "Style 10"; Backgrounds.Add(bgItem); //Style11 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); radialGradient = new RadialGradientBrush(); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); radialGradient.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent5.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 5", Brightness = 1 }, Offset = 1.0 }); radialGradient.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = radialGradient; bgItem.Name = "Style 11"; Backgrounds.Add(bgItem); //Style12 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); radialGradient = new RadialGradientBrush(); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); radialGradient.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent6.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 6", Brightness = 1 }, Offset = 1.0 }); radialGradient.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = radialGradient; bgItem.Name = "Style 12"; Backgrounds.Add(bgItem); }