private string GetStyleFor(Type element) { var matching = StyleDefinitions.Where(def => def.Matches(element, MatchMethod, GetParentMethod)) .OrderByDescending(def => def.Specificity, SimpleCssStyleDefinition.SpecificityComparer.Instance) .ThenByDescending(def => def.Index); var styles = GetDistinctPrioritizedStyles(matching); if (StyleSelectorFilter != null) { styles = StyleSelectorFilter(styles); } return(styles.Select(pair => pair.First + ": " + pair.Second + ";") .StrCat(" ")); }
public DefaultStyleDefinitionProvider() { this.Definitions = new StyleDefinitions( borderThickness: ThicknessDefinitions.Create(Scales.SmallScaleInt, ThicknessDefinitions.GetThicknessTypes()), thicknessLarge: ThicknessDefinitions.Create(Scales.LargeScaleInt, ThicknessDefinitions.GetThicknessTypes()), brush: BrushDefinitions.Create(new DefaultColorPaletteDefinitionProvider().ColorDefinitions), fontSize: FontSizes.Create(FontSizes.CreateValues()), spacing: Values.Create(Scales.LargeScaleDouble), width: Values.Create(Scales.LargeScaleDouble), height: Values.Create(Scales.LargeScaleDouble), cornerRadius: CornerRadiusDefinitions.CreateCornerRadiusDefinitions(Scales.SmallScaleDouble, CornerRadiusDefinitions.GetCornerRadiusTypes()), fontWeight: FontWeightDefinitions.Create(), horizontalAlignment: EnumEx.GetValues <HorizontalAlignment>().Select(alignment => (name: alignment.ToString(), alignment)), verticalAlignment: EnumEx.GetValues <VerticalAlignment>().Select(alignment => (name: alignment.ToString(), alignment)), pseudoClasses: PseudoClassHelper.GetAllPseudoClasses() ); }