public TextBlock(TextBlockStyle style) { if (style != null) { ApplyTextBlockStyle(style); } }
void SetTextBlockStyle(TextBlockStyle textBlockStyle) { switch (textBlockStyle) { case TextBlockStyle.H1: styleItem.Content = "H1"; styleItem.BorderBrush = Brushes.Black; styleItem.Background = Brushes.Black; styleItem.Foreground = Brushes.White; break; case TextBlockStyle.H2: styleItem.Content = "H2"; styleItem.BorderBrush = new SolidColorBrush(SMART_GUIDE_CONTROL_COLOR); styleItem.Background = new SolidColorBrush(SMART_GUIDE_CONTROL_COLOR); styleItem.Foreground = Brushes.White; break; case TextBlockStyle.H3: styleItem.Content = "H3"; styleItem.BorderBrush = new SolidColorBrush(SMART_GUIDE_CONTROL_COLOR); styleItem.Background = new SolidColorBrush(SMART_GUIDE_CONTROL_COLOR); styleItem.Foreground = Brushes.White; break; case TextBlockStyle.NORMAL: default: styleItem.Content = "¶"; styleItem.BorderBrush = new SolidColorBrush(SMART_GUIDE_CONTROL_COLOR); styleItem.Background = Brushes.White; styleItem.Foreground = new SolidColorBrush(SMART_GUIDE_CONTROL_COLOR); break; } }
public TreeStyle(TreeStyle style) : base(style) { MarkStyle = new ImageButtonStyle(style.MarkStyle); LabelStyle = new TextBlockStyle(style.LabelStyle); SelectionBackground = style.SelectionBackground; SelectionHoverBackground = style.SelectionHoverBackground; }
public void ApplyTextBlockStyle(TextBlockStyle style) { ApplyWidgetStyle(style); TextColor = style.TextColor; DisabledTextColor = style.DisabledTextColor; Font = style.Font; }
public static TextButtonStyle ToTextButtonStyle(this ButtonStyle buttonStyle, TextBlockStyle textBlockStyle) { if (buttonStyle == null) { return(null); } return(new TextButtonStyle(buttonStyle, textBlockStyle)); }
public WindowStyle(WindowStyle style) : base(style) { TitleStyle = new TextBlockStyle(style.TitleStyle); CloseButtonStyle = new ImageButtonStyle(style.CloseButtonStyle); }
public WindowStyle() { TitleStyle = new TextBlockStyle(); CloseButtonStyle = new ImageButtonStyle(); }
public ImageTextButtonStyle(ButtonStyle buttonStyle, TextBlockStyle textBlockStyle) : base(buttonStyle) { LabelStyle = textBlockStyle != null ? new TextBlockStyle(textBlockStyle) : null; }
public TreeStyle() { MarkStyle = new ImageButtonStyle(); LabelStyle = new TextBlockStyle(); }
public ButtonStyle() { LabelStyle = new TextBlockStyle(); ImageStyle = new PressableImageStyle(); }
public ButtonStyle(ButtonStyle style) : base(style) { LabelStyle = new TextBlockStyle(style.LabelStyle); ImageStyle = new PressableImageStyle(style.ImageStyle); }
private TextBlock CreateTextBlock(string text, int row, int column, TextBlockStyle textBlockStyle) { int columnSpan = 1; HorizontalAlignment horizontalAlignment = HorizontalAlignment.Center; double fontSize = Application.Current.MainWindow.ActualHeight / 35; Brush foreground = new SolidColorBrush(Color.FromRgb(45, 61, 63)); FontFamily fontFamily = new FontFamily("Franklin Gothic Book"); FontWeight fontWeight = FontWeights.Light; Thickness margin = new Thickness(0); switch (textBlockStyle) { case TextBlockStyle.Department: fontSize *= 1.3; columnSpan = 8; foreground = Brushes.White; fontWeight = FontWeights.DemiBold; break; case TextBlockStyle.DoctorName: fontSize *= 1.15; horizontalAlignment = HorizontalAlignment.Left; fontWeight = FontWeights.Normal; margin = new Thickness(10, 0, 10, 0); break; case TextBlockStyle.WorkTime: fontSize *= 0.9; fontWeight = FontWeights.ExtraLight; margin = new Thickness(3, 0, 3, 0); break; case TextBlockStyle.Days: fontFamily = new FontFamily("Franklin Gothic"); fontWeight = FontWeights.DemiBold; break; default: break; } Border border = new Border(); if (textBlockStyle == TextBlockStyle.Department) { border.Background = new SolidColorBrush(Color.FromRgb(0, 169, 220)); border.HorizontalAlignment = HorizontalAlignment.Stretch; } else { border.BorderThickness = new Thickness(1, 1, 0, 0); border.BorderBrush = Brushes.LightGray; } Grid.SetRow(border, row); Grid.SetColumn(border, column); Grid.SetColumnSpan(border, columnSpan); GridMain.Children.Add(border); TextBlock textBlock = new TextBlock(); textBlock.Text = text; textBlock.HorizontalAlignment = horizontalAlignment; textBlock.FontSize = fontSize; textBlock.Foreground = foreground; textBlock.VerticalAlignment = VerticalAlignment.Center; textBlock.FontFamily = fontFamily; textBlock.FontWeight = fontWeight; textBlock.TextWrapping = TextWrapping.Wrap; textBlock.Margin = margin; Grid.SetRow(textBlock, row); Grid.SetColumn(textBlock, column); Grid.SetColumnSpan(textBlock, columnSpan); if (textBlockStyle == TextBlockStyle.DoctorName) { textBlock.Text = string.Empty; textBlock.Inlines.Add(new Bold(new Run(text.Substring(0, 1)) { FontSize = fontSize * 1.3 })); textBlock.Inlines.Add(text.Substring(1, text.Length - 1)); } if (textBlockStyle == TextBlockStyle.Department) { Image image = new Image(); image.Source = DataProvider.GetImageForDepartment(text); image.Margin = new Thickness(0, 4, 20, 4); image.VerticalAlignment = VerticalAlignment.Center; RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.HighQuality); StackPanel stackPanel = new StackPanel(); stackPanel.Orientation = Orientation.Horizontal; stackPanel.HorizontalAlignment = HorizontalAlignment.Center; stackPanel.VerticalAlignment = VerticalAlignment.Center; stackPanel.Children.Add(image); stackPanel.Children.Add(textBlock); Grid.SetRow(stackPanel, row); Grid.SetColumn(stackPanel, column); Grid.SetColumnSpan(stackPanel, columnSpan); GridMain.Children.Add(stackPanel); } else { GridMain.Children.Add(textBlock); } return(textBlock); }
public TextButtonStyle() { LabelStyle = new TextBlockStyle(); }
public TextButtonStyle(TextButtonStyle style) : base(style) { LabelStyle = new TextBlockStyle(style.LabelStyle); }
public TreeStyle(TreeStyle style) : base(style) { MarkStyle = new ImageButtonStyle(style.MarkStyle); LabelStyle = new TextBlockStyle(style.LabelStyle); }
public TextButtonStyle(TextButtonStyle style) : base(style) { LabelStyle = style.LabelStyle != null ? new TextBlockStyle(style.LabelStyle) : null; }