private OrderRouter() { routeRules = Rule.Create <OrderModel>(o => o.Status == OrderStatus.New, o => Route()) .Add(o => o.Status == OrderStatus.NameChosen, o => container.Add(new OrderView(new OrderViewModel(o)))) .Add(o => o.Status == OrderStatus.ItemsSelected, o => container.Add(new CheckoutView(new CheckoutViewModel(o)))) .Add(o => o.Status == OrderStatus.Submitted, o => container.Add(new CompleteView(new CompleteViewModel(o)))); }
public void drawGrid() //vykreslí hotové hrací pole s padajícím blokem v aktuální pozici a orientaci { c1.Clear(); for (int y = 0; y < rows; y++) //cyklus pro vykreslení { for (int x = 0; x < columns; x++) { if (Grid[x, y] != 0) { brush.Color = switchDrawingColor(Grid, x, y); Rectangle rectangle = new Rectangle() { Fill = brush, Stroke = Brushes.Black, StrokeThickness = 1, Height = height - 2, Width = width - 2, RadiusX = 2, RadiusY = 2 }; Canvas.SetLeft(rectangle, x * (width - 1) + x + 2); //nastavení pozice Canvas.SetTop(rectangle, y * (height - 1) + y + 2); c1.Add(rectangle); //přidá Dítě Canvasu } } } }
private void RenderEmbed(IEmbed embed, UIElementCollection blockUIElementCollection) { switch (embed.Type) { case "link": { if (!embed.Thumbnail.HasValue) { return; } var result = new Windows.UI.Xaml.Controls.Image { HorizontalAlignment = HorizontalAlignment.Left, MaxHeight = Math.Min(75, embed.Thumbnail.Value.Height.Value), Source = new BitmapImage { DecodePixelType = DecodePixelType.Logical, DecodePixelHeight = Math.Min(75, embed.Thumbnail.Value.Height.Value), UriSource = new Uri(embed.Thumbnail.Value.Url), }, }; blockUIElementCollection.Add(result); } break; case "gifv": { var result = new MediaElement { IsLooping = true, AreTransportControlsEnabled = false, Source = new Uri(embed.Video.Value.Url), MaxHeight = Math.Min(250, embed.Video.Value.Height.Value), MaxWidth = Math.Min(400, embed.Video.Value.Width.Value), HorizontalAlignment = HorizontalAlignment.Left, IsMuted = true, }; blockUIElementCollection.Add(result); } break; case "image": { var result = new Windows.UI.Xaml.Controls.Image { HorizontalAlignment = HorizontalAlignment.Left, MaxHeight = Math.Min(250, embed.Thumbnail.Value.Height.Value), MaxWidth = Math.Min(400, embed.Thumbnail.Value.Width.Value), Source = new BitmapImage { DecodePixelType = DecodePixelType.Logical, DecodePixelHeight = Math.Min(250, embed.Thumbnail.Value.Height.Value), UriSource = new Uri(embed.Url), }, }; blockUIElementCollection.Add(result); } break; default: Debug.WriteLine("Unknown Embed Type -- " + embed.Type); break; } }
public void Draw(UIElementCollection children) { if (!this.IsAlive) { return; } // Draw all bones first, then circles (head and hands). DateTime cur = DateTime.Now; foreach (var segment in this.segments) { Segment seg = segment.Value.GetEstimatedSegment(cur); if (!seg.IsCircle()) { var line = new Line { StrokeThickness = seg.Radius * 2, X1 = seg.X1, Y1 = seg.Y1, X2 = seg.X2, Y2 = seg.Y2, Stroke = this.bonesBrush, StrokeEndLineCap = PenLineCap.Round, StrokeStartLineCap = PenLineCap.Round }; children.Add(line); } } foreach (var segment in this.segments) { Segment seg = segment.Value.GetEstimatedSegment(cur); if (seg.IsCircle()) { var circle = new Ellipse { Width = seg.Radius * 2, Height = seg.Radius * 2 }; circle.SetValue(Canvas.LeftProperty, seg.X1 - seg.Radius); circle.SetValue(Canvas.TopProperty, seg.Y1 - seg.Radius); circle.Stroke = this.jointsBrush; circle.StrokeThickness = 1; circle.Fill = this.bonesBrush; children.Add(circle); } } // Remove unused players after 1/2 second. if (DateTime.Now.Subtract(this.LastUpdated).TotalMilliseconds > 500) { this.IsAlive = false; } }
public void SetOrderBars(List <Order> orders) { RemoveOrders(); //orders[0] is fake for (int i = 1; i < orders.Count; i++) { PositionPanel positionPanel = new PositionPanel(); orders[i].bar.index = i; orderElements.Add(orders[i].bar); orderElements.Add(positionPanel); positionPanels.Add(positionPanel); } Select(Village.Position); }
/// <summary> /// Add text to canvas /// </summary> /// <param name="text">The text</param> /// <param name="fontSize">The font size</param> /// <param name="fontName">The font name</param> /// <param name="left">The left position</param> /// <param name="top">The top position</param> public void AddText(string text, int fontSize, string fontName, int left, int top) { TextBlock tb = new TextBlock(); tb.Text = text; tb.FontSize = fontSize; tb.FontFamily = new FontFamily(fontName); tb.Foreground = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)); Canvas.SetLeft(tb, left); Canvas.SetTop(tb, top); _uiElements.Add(tb); }
private void DrawGrid(Axis axis, UIElementCollection uIElementCollection, Size size) { var gridProvider = axis as IGridLineProvider; if (gridProvider == null || axis == null || HorizontalPen == null || GridVisibility == GridVisibility.HIDDEN) { return; // Nothing to draw } if (!axis.ShowGridLine) { return;// Nothing to draw } var gridLines = gridProvider.GetGridLines(); if (gridLines == null || gridLines.Length <= 0) { return; // Nothing to draw } if (Orientation == Orientation.VERTICAL) { var gridLineLength = size.Height; var gridPen = axis.GridLinePen != null ? axis.GridLinePen : this.VerticalPen; foreach (var line in gridLines) { if (!line.IsLong && GridVisibility == GridVisibility.LONGTICKS) { continue; } uIElementCollection.Add(CreateLine(line.Position, 0, line.Position, gridLineLength, gridPen)); } } else { double gridLineLength = size.Width; var gridPen = axis.GridLinePen != null ? axis.GridLinePen : this.HorizontalPen; foreach (var line in gridLines) { if (!line.IsLong && GridVisibility == GridVisibility.LONGTICKS) { continue; } uIElementCollection.Add(CreateLine(0, line.Position, gridLineLength, line.Position, gridPen)); } } }
public void DrawFrame(UIElementCollection children) { this.frameCount++; // Draw all shapes in the scene for (int i = 0; i < this.things.Count; i++) { var thing = this.things[i]; thing.Draw(children); } // Show scores if (this.scores.Count != 0) { int i = 0; foreach (var score in this.scores) { Label label = MakeSimpleLabel( score.Value.ToString(CultureInfo.InvariantCulture), new Rect( (0.02 + (i * 0.6)) * this.sceneRect.Width, 0.01 * this.sceneRect.Height, 0.4 * this.sceneRect.Width, 0.3 * this.sceneRect.Height), new SolidColorBrush(System.Windows.Media.Color.FromArgb(200, 255, 255, 255))); label.FontSize = Math.Max(1, Math.Min(this.sceneRect.Width / 12, this.sceneRect.Height / 12)); children.Add(label); i++; } } // Show game timer if (this.gameMode != GameMode.Off) { TimeSpan span = DateTime.Now.Subtract(this.gameStartTime); string text = span.Minutes.ToString(CultureInfo.InvariantCulture) + ":" + span.Seconds.ToString("00"); Label timeText = MakeSimpleLabel( text, new Rect( 0.1 * this.sceneRect.Width, 0.25 * this.sceneRect.Height, 0.89 * this.sceneRect.Width, 0.72 * this.sceneRect.Height), new SolidColorBrush(System.Windows.Media.Color.FromArgb(160, 255, 255, 255))); timeText.FontSize = Math.Max(1, this.sceneRect.Height / 16); timeText.HorizontalContentAlignment = HorizontalAlignment.Right; timeText.VerticalContentAlignment = VerticalAlignment.Bottom; children.Add(timeText); } }
protected void GenerateVisualChildren() { if (_visualChildrenGenerated) { return; } if (_visualChildren == null) { _visualChildren = CreateUIElementCollection(this); } else { _visualChildren.Clear(); } foreach (var period in CalendarView.Periods) { _visualChildren.Add(new CalendarViewPeriodPresenter { Period = period, CalendarView = CalendarView, ListView = ListView }); } _visualChildrenGenerated = true; }
public static void AddRange(this UIElementCollection collection, List <UIElement> elementsToAdd) { foreach (var item in elementsToAdd) { collection.Add(item); } }
private void SetHomeItem(UIElementCollection collection) { var home = new BreadcrumbHome() { Style = this.HomeItemStyle ?? ResourceService.GetDictionaryValue <Style>("BreadcrumbButtonStyle") }; if (string.IsNullOrEmpty(this.HomeText)) { if (this.HomeTemplate == null) { home.ContentTemplate = ResourceService.GetDictionaryValue <DataTemplate>("BreadCrumbHome"); home.DataContext = this.HomeIcon; } else { home.ContentTemplate = this.HomeTemplate; } } else { home.Content = this.HomeText; } home.Click += (sender, args) => OnHomeSelected(); collection.Add(home); }
private void CreateItems() { if (_itemsPresenter == null) { return; } DataList dataList = DataList; if (dataList == null) { return; } Style itemContainerStyle = ItemContainerStyle; DataTemplate itemTemplate = ItemTemplate; if (itemTemplate == null) { return; } UIElementCollection items = _itemsPresenter.Children; int index = 0; foreach (object dataItem in dataList) { ListViewItem item = CreateItem(dataItem, index, itemTemplate, itemContainerStyle); if (item != null) { items.Add(item); index++; } } }
public static void Add(this UIElementCollection col, params UIElement[] elements) { foreach (UIElement ele in elements) { col.Add(ele); } }
public static void Add(this UIElementCollection collection, Circle c) { foreach (var el in c.UIElements) { collection.Add(el); } }
public static void Add(this UIElementCollection collection, Line l) { foreach (var el in l.UIElements) { collection.Add(el); } }
public static void AddTimeToNotes(UIElementCollection notes, SeqElemType elemType, double top) { #if DEBUG_TIMING TextBlock tb = new TextBlock() { FontSize = 20, Text = String.Format("{0:N2}", top / GameUIConstants.PixelsPerSecond) }; Canvas.SetTop(tb, top); switch (elemType) { case SeqElemType.LeftArrow: Canvas.SetLeft(tb, GameUIConstants.LeftArrowX); break; case SeqElemType.DownArrow: Canvas.SetLeft(tb, GameUIConstants.DownArrowX); break; case SeqElemType.UpArrow: Canvas.SetLeft(tb, GameUIConstants.UpArrowX); break; case SeqElemType.RightArrow: Canvas.SetLeft(tb, GameUIConstants.RightArrowX); break; } notes.Add(tb); #endif }
public static void AddRange(this UIElementCollection collection, IEnumerable <UIElement> visuals) { foreach (UIElement visual in visuals) { collection.Add(visual); } }
private void DoUpdateGridLines(UIElementCollection target, double[] source, Orientation orientation) { if (source == null) { return; } var newCt = source.Length; var oldCt = target.Count; if (oldCt > newCt) { target.RemoveRange(newCt, oldCt - newCt); } for (int i = 0; i < source.Length; i++) { var newValue = source[i]; if (i < oldCt) { ((Line)target[i]).DataContext = newValue; } else { var line = new Line(); line.DataContext = newValue; SetGridLineBindings(line, orientation); target.Add(line); } } }
void Children_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { #if PERFSTAT var t0 = Performance.now(); #endif UIElementCollection oldItems = null; UIElementCollection newItems = null; var list = e.NewItems; if (list != null) { newItems = new UIElementCollection(); foreach (UIElement uiElement in list) { newItems.Add(uiElement); } } list = e.OldItems; if (list != null) { oldItems = new UIElementCollection(); foreach (UIElement uiElement in list) { oldItems.Add(uiElement); } } #if PERFSTAT Performance.Counter("Panel.Children_CollectionChanged without manage children", t0); #endif //we put "this" below because the sender is directly the colection and we need to have an access to the control ManageChildrenChanged(this, oldItems, newItems); }
private void panelElemsCount_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e, UIElementCollection c, FrameworkElement[] objArray) { DecimalUpDown d = (DecimalUpDown)sender; int Count = (int)d.Value; if (c.Count > Count) { int delNum = c.Count - Count; for (int i = 0; i < delNum; i++) { c.RemoveAt(c.Count - 1); } } else if (c.Count < Count) { for (int i = c.Count; i < Count; i++) { //c.Add(objArray[i % objArray.Length]); string gridXaml = XamlWriter.Save(objArray[i % objArray.Length]); StringReader stringReader = new StringReader(gridXaml); XmlReader xmlReader = XmlReader.Create(stringReader); c.Add((FrameworkElement)XamlReader.Load(xmlReader)); } } }
private TopicView2 GetTopicView(UIElementCollection elementCollection, string topic) { string topicName = Topic.None.Equals(topic.ToLower().Trim()) ? this.NoneTopicName : topic.Trim(); foreach (UIElement?view in elementCollection) { TopicView2?topicView = view as TopicView2; if (topicView == null) { continue; } if (topicView.TopicName.ToLower().Trim() == topicName.ToLower()) { return(topicView); } } // If we didn't find a TopicView2, Create one and add it to the given ElementCollection TopicView2 tView = CreateTopicView(topicName, GetTopicColor(topicName)); elementCollection.Add(tView); if (!this.TopicColors.ContainsKey(topicName)) { this.TopicColors.Add(topicName, tView.TopicColor); } return(tView); }
/// <summary> /// Creates a new RichTextBlock, if the last element of the provided collection isn't already a RichTextBlock. /// </summary> /// <returns>The rich text block</returns> private RichTextBlock CreateOrReuseRichTextBlock(UIElementCollection blockUIElementCollection, RenderContext context) { // Reuse the last RichTextBlock, if possible. if (blockUIElementCollection != null && blockUIElementCollection.Count > 0 && blockUIElementCollection[blockUIElementCollection.Count - 1] is RichTextBlock) { return((RichTextBlock)blockUIElementCollection[blockUIElementCollection.Count - 1]); } var result = new RichTextBlock { CharacterSpacing = CharacterSpacing, FontFamily = FontFamily, FontSize = FontSize, FontStretch = FontStretch, FontStyle = FontStyle, FontWeight = FontWeight, Foreground = context.Foreground, IsTextSelectionEnabled = IsTextSelectionEnabled, TextWrapping = TextWrapping }; blockUIElementCollection?.Add(result); return(result); }
/// <summary> /// 构造一个 FocusTrackerAdorner 对象,并指定它所在的 AdornerLayer 及所在范围。 /// </summary> /// <param name="layerRoot">layer 对应的根控件。</param> /// <param name="layer">本 Adorner 所添加到的 Layer。</param> /// <param name="scope">最外层的范围控件。</param> /// <param name="scopeLayer">最外层的范围控件对应的 AdornerLayer。</param> private FocusTrackerAdorner(UIElement layerRoot, AdornerLayer layer, UIElement scope, AdornerLayer scopeLayer) : base(layerRoot) { if (scope == null) { throw new ArgumentNullException("scope"); } if (layer == null) { throw new ArgumentNullException("layer"); } _scope = scope; _scopeLayer = scopeLayer; _layerRoot = layerRoot; _layer = layer; _children = new UIElementCollection(this, this); _tracker = new FocusTrackerControl { Adorner = this }; _children.Add(_tracker); this.Loaded += OnLoaded; scope.GotKeyboardFocus += scope_GotKeyboardFocus; }
private void UpdateGrid() { UIElementCollection gridChilds = this.CheckersGrid.Children; for (int i = 0; i < _gameState.Length; ++i) { for (int j = 0; j < _gameState.Length; ++j) { Button b = new Button() { MinHeight = 40, MinWidth = 40 }; b.Click += ButtonGrid_Click; gridChilds.Add(b); Grid.SetRow(b, i); Grid.SetColumn(b, j); if (_gameState[i][j] == 1) { b.Content = new Ellipse() { Width = 30, Height = 30, Fill = Brushes.Red }; } else if (_gameState[i][j] == 2) { b.Content = new Ellipse() { Width = 30, Height = 30, Fill = Brushes.Black }; } } } }
public static void AddRange(this UIElementCollection children, IEnumerable collection) { foreach (UIElement element in collection) { children.Add(element); } }
/// <summary> /// Safe and fast way to add a child UIElement /// </summary> /// <returns>true if child is already set or added</returns> public bool AddChild(UIElement child) { if (child == null) { return(false); } if (child.Parent != null) { if (child.Parent == this) { return(true); } if (child.Parent is Panel p) { p.Children.Remove(child); } else { throw new Exception(child.Name + " UIElement has non-Panel parent " + child.Parent.Name + " already. Can't move!"); } } Children.Add(child); return(true); }
public static void AddIfNotNull(this UIElementCollection aThis, UIElement item) { if (item != null) { aThis.Add(item); } }
public static void AddRange(this UIElementCollection collection, IEnumerable <UIElement> items) { foreach (var item in items) { collection.Add(item); } }
void TranslateList(List listData, UIElementCollection ElemList) { foreach (ListItem item in listData.ListItems) { foreach (Block itemblock in item.Blocks) { if (itemblock is Paragraph) { BulletDecorator bull = GetBulletStyle(); TextBlock single = new TextBlock(); Paragraph temp = itemblock as Paragraph; foreach (Run run in temp.Inlines) { Run newrun = new Run(); newrun.Text = run.Text; newrun.TextDecorations = run.TextDecorations; newrun.FontFamily = run.FontFamily; newrun.FontSize = run.FontSize; newrun.FontStyle = run.FontStyle; newrun.FontWeight = run.FontWeight; newrun.Foreground = run.Foreground; single.Inlines.Add(newrun); } single.TextAlignment = itemblock.TextAlignment; single.TextWrapping = TextWrapping.Wrap; single.Margin = new Thickness(2, 0, 0, 0); bull.Child = single; ElemList.Add(bull); } } } }
public static object BuildImageTextblock(string file, string message) { StackPanel stackPanel = new StackPanel(); stackPanel.Orientation = Orientation.Horizontal; try { stackPanel.Children.Add(new Image() { Source = BitmapImageExtension.Load(file), Stretch = Stretch.None }); } catch (Exception) { } UIElementCollection children = stackPanel.Children; TextBlock textBlock1 = new TextBlock(); textBlock1.Text = message; textBlock1.Margin = new Thickness(5.0, 0.0, 0.0, 0.0); TextBlock textBlock2 = textBlock1; children.Add(textBlock2); return(stackPanel); }
/// <summary> /// Renders a table element. /// </summary> /// <param name="element"></param> /// <param name="blockUIElementCollection"></param> /// <param name="context"></param> private void RenderTable(TableBlock element, UIElementCollection blockUIElementCollection, RenderContext context) { var table = new MarkdownTable(element.ColumnDefinitions.Count, element.Rows.Count, TableBorderThickness, TableBorderBrush); table.HorizontalAlignment = HorizontalAlignment.Left; table.Margin = TableMargin; // Add each row. for (int rowIndex = 0; rowIndex < element.Rows.Count; rowIndex++) { var row = element.Rows[rowIndex]; // Add each cell. for (int cellIndex = 0; cellIndex < Math.Min(element.ColumnDefinitions.Count, row.Cells.Count); cellIndex++) { var cell = row.Cells[cellIndex]; // Cell content. var cellContent = CreateOrReuseRichTextBlock(null, context); cellContent.Margin = TableCellPadding; Grid.SetRow(cellContent, rowIndex); Grid.SetColumn(cellContent, cellIndex); switch (element.ColumnDefinitions[cellIndex].Alignment) { case ColumnAlignment.Center: cellContent.TextAlignment = TextAlignment.Center; break; case ColumnAlignment.Right: cellContent.TextAlignment = TextAlignment.Right; break; } if (rowIndex == 0) cellContent.FontWeight = FontWeights.Bold; var paragraph = new Paragraph(); context.TrimLeadingWhitespace = true; RenderInlineChildren(paragraph.Inlines, cell.Inlines, paragraph, context); cellContent.Blocks.Add(paragraph); table.Children.Add(cellContent); } } blockUIElementCollection.Add(table); }
/// <summary> /// Renders a code element. /// </summary> /// <param name="element"></param> /// <param name="blockUIElementCollection"></param> /// <param name="context"></param> private void RenderCode(CodeBlock element, UIElementCollection blockUIElementCollection, RenderContext context) { var textBlock = CreateTextBlock(context); textBlock.FontFamily = CodeFontFamily ?? FontFamily; textBlock.Foreground = CodeForeground ?? context.Foreground; textBlock.LineHeight = FontSize * 1.4; textBlock.Text = element.Text; var border = new Border(); border.Background = CodeBackground; border.BorderBrush = CodeBorderBrush; border.BorderThickness = CodeBorderThickness; border.Padding = CodePadding; border.Margin = CodeMargin; border.HorizontalAlignment = HorizontalAlignment.Left; border.Child = textBlock; // Add it to the blocks blockUIElementCollection.Add(border); }
/// <summary> /// Renders a quote element. /// </summary> /// <param name="element"></param> /// <param name="blockUIElementCollection"></param> private void RenderQuote(QuoteBlock element, UIElementCollection blockUIElementCollection, RenderContext context) { if (QuoteForeground != null) { context = context.Clone(); context.Foreground = QuoteForeground; } var stackPanel = new StackPanel(); RenderBlocks(element.Blocks, stackPanel.Children, context); var border = new Border(); border.Margin = QuoteMargin; border.Background = QuoteBackground; border.BorderBrush = QuoteBorderBrush ?? context.Foreground; border.BorderThickness = QuoteBorderThickness; border.Padding = QuotePadding; border.Child = stackPanel; blockUIElementCollection.Add(border); }
/// <summary> /// Creates a new RichTextBlock, if the last element of the provided collection isn't already a RichTextBlock. /// </summary> /// <param name="blockUIElementCollection"></param> /// <param name="context"></param> /// <returns></returns> private RichTextBlock CreateOrReuseRichTextBlock(UIElementCollection blockUIElementCollection, RenderContext context) { // Reuse the last RichTextBlock, if possible. if (blockUIElementCollection != null && blockUIElementCollection.Count > 0 && blockUIElementCollection[blockUIElementCollection.Count - 1] is RichTextBlock) return (RichTextBlock)blockUIElementCollection[blockUIElementCollection.Count - 1]; var result = new RichTextBlock(); result.CharacterSpacing = CharacterSpacing; result.FontFamily = FontFamily; result.FontSize = FontSize; result.FontStretch = FontStretch; result.FontStyle = FontStyle; result.FontWeight = FontWeight; result.Foreground = context.Foreground; result.IsTextSelectionEnabled = IsTextSelectionEnabled; result.TextWrapping = TextWrapping; if (blockUIElementCollection != null) blockUIElementCollection.Add(result); return result; }
/// <summary> /// Renders a list element. /// </summary> /// <param name="element"></param> /// <param name="blockUIElementCollection"></param> /// <param name="context"></param> private void RenderListElement(ListBlock element, UIElementCollection blockUIElementCollection, RenderContext context) { // Create a grid with two columns. Grid grid = new Grid(); grid.Margin = ListMargin; // The first column for the bullet (or number) and the second for the text. grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(ListGutterWidth) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); for (int rowIndex = 0; rowIndex < element.Items.Count; rowIndex ++) { var listItem = element.Items[rowIndex]; // Add a row definition. grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); // Add the bullet or number. var bullet = CreateTextBlock(context); bullet.Margin = ParagraphMargin; switch (element.Style) { case ListStyle.Bulleted: bullet.Text = "•"; break; case ListStyle.Numbered: bullet.Text = $"{rowIndex + 1}."; break; } bullet.HorizontalAlignment = HorizontalAlignment.Right; bullet.Margin = new Thickness(0, 0, ListBulletSpacing, 0); Grid.SetRow(bullet, rowIndex); grid.Children.Add(bullet); // Add the list item content. var content = new StackPanel(); RenderBlocks(listItem.Blocks, content.Children, context); Grid.SetColumn(content, 1); Grid.SetRow(content, rowIndex); grid.Children.Add(content); } blockUIElementCollection.Add(grid); }
/// <summary> /// Renders a horizontal rule element. /// </summary> /// <param name="element"></param> /// <param name="blockUIElementCollection"></param> /// <param name="context"></param> private void RenderHorizontalRule(HorizontalRuleBlock element, UIElementCollection blockUIElementCollection, RenderContext context) { var rectangle = new Rectangle(); rectangle.HorizontalAlignment = HorizontalAlignment.Stretch; rectangle.Height = HorizontalRuleThickness; rectangle.Fill = HorizontalRuleBrush ?? context.Foreground; rectangle.Margin = HorizontalRuleMargin; blockUIElementCollection.Add(rectangle); }