public DesignerSkinEditorWindowViewModel() { SkinProperty testProp = new SkinProperty("TestProperty", Colors.Black); SkinProperty optionalTestProp = new OptionalSkinProperty("OptionalProperty", testProp); SkinProperty stringProp = new SkinProperty("TestImagePath", null); SkinProperty doubleProp = new SkinProperty("TestPercentage", .42); GeneralColors = new List <SkinProperty>() { testProp, testProp, testProp }; BackgroundImage = new List <SkinProperty>() { stringProp }; CalendarDefault = new List <SkinProperty>() { testProp, testProp, testProp }; Calendar0 = new List <SkinProperty>() { testProp, optionalTestProp }; Calendar50 = new List <SkinProperty>() { testProp, optionalTestProp }; Calendar100 = new List <SkinProperty>() { testProp, optionalTestProp }; CalendarWeek = new List <SkinProperty>() { doubleProp, testProp, optionalTestProp }; CalendarWeek0 = new List <SkinProperty>() { optionalTestProp, optionalTestProp }; CalendarWeek50 = new List <SkinProperty>() { optionalTestProp, optionalTestProp }; CalendarWeek100 = new List <SkinProperty>() { optionalTestProp, optionalTestProp }; CalendarHover = new List <SkinProperty>() { testProp, testProp, testProp }; }
private void ImportFromResourceDictionary(ResourceDictionary source) { CalendarWeekOpacity = ImportProperty(nameof(CalendarWeekOpacity), source); // The background image property is unique in that it's optional with no direct fallback value; // if it doesn't exist, it should just be null. string backgroundPathValue = source.Contains(nameof(BackgroundImagePath)) ? (string)source[nameof(BackgroundImagePath)] : null; BackgroundImagePath = new SkinProperty(nameof(BackgroundImagePath), backgroundPathValue); BackgroundColor = ImportProperty(nameof(BackgroundColor), source); ForegroundColor = ImportProperty(nameof(ForegroundColor), source); MenuBorderColor = ImportProperty(nameof(MenuBorderColor), source); CalendarBorderColor = ImportProperty(nameof(CalendarBorderColor), source); CalendarDefaultBgColor = ImportProperty(nameof(CalendarDefaultBgColor), source); Calendar0BgColor = ImportProperty(nameof(Calendar0BgColor), source); Calendar50BgColor = ImportProperty(nameof(Calendar50BgColor), source); Calendar100BgColor = ImportProperty(nameof(Calendar100BgColor), source); CalendarDefaultFgColor = ImportProperty(nameof(CalendarDefaultFgColor), source); Calendar0FgColor = ImportOptionalProperty(nameof(Calendar0FgColor), source, CalendarDefaultFgColor); Calendar50FgColor = ImportOptionalProperty(nameof(Calendar50FgColor), source, CalendarDefaultFgColor); Calendar100FgColor = ImportOptionalProperty(nameof(Calendar100FgColor), source, CalendarDefaultFgColor); CalendarWeekBgColor = ImportProperty(nameof(CalendarWeekBgColor), source); CalendarWeek0BgColor = ImportOptionalProperty(nameof(CalendarWeek0BgColor), source, Calendar0BgColor); CalendarWeek50BgColor = ImportOptionalProperty(nameof(CalendarWeek50BgColor), source, Calendar50BgColor); CalendarWeek100BgColor = ImportOptionalProperty(nameof(CalendarWeek100BgColor), source, Calendar100BgColor); CalendarWeekFgColor = ImportOptionalProperty(nameof(CalendarWeekFgColor), source, CalendarDefaultFgColor); CalendarWeek0FgColor = ImportOptionalProperty(nameof(CalendarWeek0FgColor), source, Calendar0FgColor); CalendarWeek50FgColor = ImportOptionalProperty(nameof(CalendarWeek50FgColor), source, Calendar50FgColor); CalendarWeek100FgColor = ImportOptionalProperty(nameof(CalendarWeek100FgColor), source, Calendar100FgColor); CalendarHoverBgColor = ImportProperty(nameof(CalendarHoverBgColor), source); CalendarHoverFgColor = ImportProperty(nameof(CalendarHoverFgColor), source); CalendarHoverBorderColor = ImportProperty(nameof(CalendarHoverBorderColor), source); }
private OptionalSkinProperty ImportOptionalProperty(string key, ResourceDictionary source, SkinProperty fallback) { if (source.Contains(key)) { object value = source[key]; return(new OptionalSkinProperty(key, value, fallback)); } else { return(new OptionalSkinProperty(key, fallback)); } }