void InitSource() { var sources = new List <object> { "Embedded", "Custom", }; var customSourceItem = new EditorSettingsItemViewModel(null, "Custom source", "") { IsVisible = false, Action = (string value) => Markdown = value, }; var sourceTypeItem = new PickerSettingsViewModel(null, "Source", sources, "Embedded") { Action = (object value) => { var isCustom = $"{value}" == "Custom"; customSourceItem.IsVisible = false; switch ($"{value}") { case "Embedded": Markdown = embeded; break; case "Custom": customSourceItem.IsVisible = true; Markdown = customSourceItem.Value; break; } } }; SourceCard = new SettingsCardViewModel("Source") { Items = new ObservableCollection <SettingsItemViewModel> { sourceTypeItem, customSourceItem, } }; }
List <SettingsItemViewModel> GetListStyleSettings(ListStyle style) { var items = new List <SettingsItemViewModel>(); var bulletSymbolItem = new EntrySettingsItemViewModel(this, "Symbol", style.Symbol) { Action = (string value) => style.Symbol = value, IsVisible = false, }; var bulletSizeItem = new StepperSettingsItemViewModel(this, "Bullet size", style.BulletSize) { Action = (int value) => style.BulletSize = value, IsVisible = style.BulletStyleType == ListStyleType.Circle || style.BulletStyleType == ListStyleType.Square, }; var bulletFontSizeItem = new StepperSettingsItemViewModel(this, "Bullet font size", (int)(style.BulletFontSize ?? 0)) { Action = (int value) => style.BulletFontSize = value, IsVisible = style.BulletStyleType == ListStyleType.Decimal || style.BulletStyleType == ListStyleType.Symbol, }; var bulletLineHeightItem = new StepperSettingsItemViewModel(this, "Bullet line height", (int)(style.BulletLineHeight ?? 0)) { Action = (int value) => style.BulletLineHeight = value, IsVisible = style.BulletStyleType == ListStyleType.Decimal || style.BulletStyleType == ListStyleType.Symbol, }; var bulletFontAttributesItem = new PickerSettingsViewModel(this, "Bullet font attributes", fontAttributeItems, style.BulletFontAttributes) { Action = (object value) => style.BulletFontAttributes = (FontAttributes)value, IsVisible = style.BulletStyleType == ListStyleType.Decimal || style.BulletStyleType == ListStyleType.Symbol, }; var bulletTypeItem = new PickerSettingsViewModel(this, "Bullet type", listStyleTypeItems, style.BulletStyleType) { Action = (object value) => { style.BulletStyleType = (ListStyleType)value; bulletSymbolItem.IsVisible = style.BulletStyleType == ListStyleType.Symbol; var isTextType = style.BulletStyleType == ListStyleType.Decimal || style.BulletStyleType == ListStyleType.Symbol; var isBoxType = style.BulletStyleType == ListStyleType.Circle || style.BulletStyleType == ListStyleType.Square; bulletSizeItem.IsVisible = isBoxType; bulletFontSizeItem.IsVisible = isTextType; bulletLineHeightItem.IsVisible = isTextType; bulletFontAttributesItem.IsVisible = isTextType; }, }; items.AddRange(new List <SettingsItemViewModel> { bulletTypeItem, bulletSymbolItem, bulletFontSizeItem, bulletLineHeightItem, bulletFontAttributesItem, bulletSizeItem, new PickerSettingsViewModel(this, "Bullet vertical options", layoutOptionsItems, new LayoutOptionsWrapper(style.BulletVerticalOptions)) { Action = (object value) => style.BulletVerticalOptions = ((LayoutOptionsWrapper)value).LayoutOptions, }, new PickerSettingsViewModel(this, "Item vertical options", layoutOptionsItems, new LayoutOptionsWrapper(style.ItemVerticalOptions)) { Action = (object value) => style.ItemVerticalOptions = ((LayoutOptionsWrapper)value).LayoutOptions, }, new StepperSettingsItemViewModel(this, "Indentation", (int)style.Indentation) { Action = (int value) => style.Indentation = value, }, new StepperSettingsItemViewModel(this, "Spacing", (int)(style.Spacing ?? 0)) { Action = (int value) => style.Spacing = value, }, new StepperSettingsItemViewModel(this, "Items vertical spacing", (int)style.ItemsVerticalSpacing) { Action = (int value) => style.ItemsVerticalSpacing = value, } }); return(items); }