private void BuildCanvas(Point location, Size size) { ButtonRectangle.SetValue(Canvas.TopProperty, location.Y); ButtonRectangle.SetValue(Canvas.LeftProperty, location.X); ButtonRectangle.SetValue(Canvas.WidthProperty, size.Width); ButtonRectangle.SetValue(Canvas.HeightProperty, size.Height); ButtonWrapper.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; ButtonWrapper.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; ButtonWrapper.SetValue(Canvas.LeftProperty, ButtonRectangle.GetValue(Canvas.LeftProperty)); ButtonWrapper.SetValue(Canvas.TopProperty, ButtonRectangle.GetValue(Canvas.TopProperty)); }
private static void OnItemHeightOrWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { WrapPanel source = (WrapPanel)d; double value = (double)e.NewValue; // Ignore the change if requested if (source._ignorePropertyChange) { source._ignorePropertyChange = false; return; } // Validate the length (which must either be NaN or a positive, // finite number) if (!value.IsNaN() && ((value <= 0.0) || double.IsPositiveInfinity(value))) { // Reset the property to its original state before throwing source._ignorePropertyChange = true; source.SetValue(e.Property, (double)e.OldValue); string message = string.Format( CultureInfo.InvariantCulture, Microsoft.Phone.Controls.Toolkit.Properties.Resources.WrapPanel_OnItemHeightOrWidthPropertyChanged_InvalidValue, value); throw new ArgumentException(message, "value"); } // The length properties affect measuring. source.InvalidateMeasure(); }
private static void OnOrientationPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { WrapPanel source = (WrapPanel)d; Orientation value = (Orientation)e.NewValue; // Ignore the change if requested if (source._ignorePropertyChange) { source._ignorePropertyChange = false; return; } // Validate the Orientation if ((value != Orientation.Horizontal) && (value != Orientation.Vertical)) { // Reset the property to its original state before throwing source._ignorePropertyChange = true; source.SetValue(OrientationProperty, (Orientation)e.OldValue); string message = string.Format( CultureInfo.InvariantCulture, Microsoft.Phone.Controls.Toolkit.Properties.Resources.WrapPanel_OnOrientationPropertyChanged_InvalidValue, value); throw new ArgumentException(message, "value"); } // Orientation affects measuring. source.InvalidateMeasure(); }
/* * En este caso añadimos un wrap panel a la derecha * Utilizamos un bucle para generarlos y configurarlos */ private WrapPanel parteDerecha() { WrapPanel wrapDerecha = new WrapPanel(); // Utilizamos una anchura predefinida para conseguir visualizar los botones en dos columnas wrapDerecha.Width = 130; foreach (var btn in listaBotones) { Button boton = new Button() { Width = 32, Height = 32, Content = new Image { Source = new BitmapImage(new Uri("icons/" + btn + ".png", UriKind.Relative)), VerticalAlignment = VerticalAlignment.Center } }; boton.Name = "btn" + btn; boton.Margin = new Thickness(15); boton.Background = Brushes.White; wrapDerecha.Children.Add(boton); } // Situamos el panel en la parte de arriba wrapDerecha.SetValue(DockPanel.DockProperty, Dock.Right); return(wrapDerecha); }
private void WrapperFactory() { ButtonWrapper = new WrapPanel(); ButtonWrapper.SetValue(Canvas.ZIndexProperty, 3); ButtonWrapper.Background = new SolidColorBrush(Colors.Transparent); ButtonWrapper.Orientation = _orientation; ButtonWrapper.SizeChanged += ButtonWrapper_SizeChanged; }
private void Info_Init() { List <SystemConfig> configList = new List <SystemConfig>(); List <SystemConfig> detailsConfig = ContainerManager.SystemConfigs.GetSystemConfigs("MapElement", _mapElement.MapElementCategoryID, "MapInfoPanel"); string controlMode = detailsConfig.Where(t => t.Name == "ControlMode").FirstOrDefault().Value; string controlName = detailsConfig.Where(t => t.Name == "ControlName").FirstOrDefault().Value; string displayMode = detailsConfig.Where(t => t.Name == "DisplayMode").FirstOrDefault().Value; //标题 this.detailTitle.Text = "详情"; //控件模式 switch (controlMode) { case "Auto": //自动生成 SystemConfig tempConfig = detailsConfig.Where(t => t.Name == "FieldItems").FirstOrDefault(); List <SystemConfig> dsList = ContainerManager.SystemConfigs.GetSystemConfigs(tempConfig); if (displayMode == "Data") { #region 数据显示模式 for (int i = 0; i < dsList.Count; i++) { List <SystemConfig> itemConfig = ContainerManager.SystemConfigs.GetSystemConfigs(dsList[i]); if (itemConfig.Count == 0) { break; } string name; string bindField; string value; #region 获得配置信息 name = itemConfig.Where(t => t.Name == "Name").FirstOrDefault().Value; bindField = itemConfig.Where(t => t.Name == "BindField").FirstOrDefault().Value; value = bindField.IndexOf('.') == -1 ? GetFieldValue(bindField) : GetXMLFieldValue(bindField); TZPanelItem pItem = new TZPanelItem(); pItem.NameText = name; pItem.ValueText = value; this.infoPanel.Children.Add(pItem); #endregion } #endregion } else if (displayMode == "Avatar") { //创建详情面板 Grid grid = new Grid() { Margin = new Thickness(5, 8, 0, 8) }; grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(80, GridUnitType.Pixel) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) }); this.infoPanel.Children.Insert(0, grid); StackPanel topPanel = new StackPanel() { VerticalAlignment = VerticalAlignment.Center }; topPanel.SetValue(Grid.RowProperty, 0); topPanel.SetValue(Grid.ColumnProperty, 1); grid.Children.Add(topPanel); Image avatarImage = new Image() { Stretch = Stretch.Uniform, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 5, 0), Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(this._mapElement.Avatar == null ? "" : this._mapElement.Avatar, UriKind.RelativeOrAbsolute)) }; avatarImage.SetValue(Grid.RowProperty, 0); avatarImage.SetValue(Grid.ColumnProperty, 0); grid.Children.Add(avatarImage); WrapPanel contentPanel = new WrapPanel(); contentPanel.SetValue(Grid.RowProperty, 1); contentPanel.SetValue(Grid.ColumnSpanProperty, 2); grid.Children.Add(contentPanel); for (int i = 0; i < dsList.Count; i++) { List <SystemConfig> itemConfig = ContainerManager.SystemConfigs.GetSystemConfigs(dsList[i]); string name; string bindField; string value; #region 获得配置信息 name = itemConfig.Where(t => t.Name == "Name").FirstOrDefault().Value; bindField = itemConfig.Where(t => t.Name == "BindField").FirstOrDefault().Value; value = bindField.IndexOf('.') == -1 ? GetFieldValue(bindField) : GetXMLFieldValue(bindField); #endregion if (i > 2) { TZPanelItem itemControl = new TZPanelItem() { NameText = name, ValueText = value, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 5, 5, 0) }; contentPanel.Children.Add(itemControl); } else { TextBlock itemControl = new TextBlock() { Text = value, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(6), Style = Application.Current.Resources["DefaultTextBlockStyle3"] as Style }; topPanel.Children.Add(itemControl); } } } break; case "Custom": //自定义 //UIElement customControl = Activator.CreateInstance(Type.GetType(controlName)) as UIElement; //PropertyInfo propInfo = customControl.GetType().GetProperty("MapElement"); //propInfo.SetValue(customControl, this._mapElement, null); //this.Content = customControl; break; } SystemConfig tempBtnItemsConfig = detailsConfig.Where(t => t.Name == "ButtonItems").FirstOrDefault(); List <SystemConfig> btnItems = ContainerManager.SystemConfigs.GetSystemConfigs(tempBtnItemsConfig); foreach (SystemConfig btnItem in btnItems) { List <SystemConfig> itemPropertys = ContainerManager.SystemConfigs.GetSystemConfigs(btnItem); string type = itemPropertys.Where(t => t.Name == "Type").FirstOrDefault().Value; string tooltip = itemPropertys.Where(t => t.Name == "Tooltip").FirstOrDefault().Value; string imageUrl = itemPropertys.Where(t => t.Name == "ImageUrl").FirstOrDefault().Value; string command = itemPropertys.Where(t => t.Name == "Command").FirstOrDefault().Value; ConfigHelper.ProcessImageUrl(ref imageUrl); Image btn = new Image() { Height = 18, Width = 18, Stretch = Stretch.Uniform, Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(imageUrl, UriKind.RelativeOrAbsolute)), Cursor = Cursors.Hand }; if (btnItems.IndexOf(btnItem) > 0) { btn.Margin = new Thickness(10, 0, 0, 0); } switch (type) { case "Details": btn.MouseLeftButtonUp += imgDetails_MouseLeftButtonUp; break; case "Playback": btn.MouseLeftButtonUp += imgTrajectory_MouseLeftButtonUp; break; case "Round": btn.MouseLeftButtonUp += imgRound_MouseLeftButtonUp; break; case "Custom": btn.MouseLeftButtonUp += imgDetails_MouseLeftButtonUp; break; case "Cells": btn.MouseLeftButtonUp += imgCells_MouseLeftButtonUp; break; default: break; } this.buttonItems.Children.Add(btn); } if (this._mapElement.MapElementCategoryID == 1) { this.tbLastLocationPanel.Visibility = Visibility.Visible; //最后定位时间 WebAPIHelper dt = new WebAPIHelper(); dt.GetDataCompleted += (s, args) => { MapElementHisCoord entity = args.DataResult as MapElementHisCoord; if (entity != null) { DateTime nowTime = DateTime.Now; DateTime historyTime = entity.SatelliteTime; TimeSpan ts = nowTime.Subtract(historyTime).Duration(); if (ts.TotalMinutes > 0) { if (ts.TotalMinutes <= 60) { tbLastLocation.Text = string.Format("{0}分钟前", Convert.ToInt32(ts.TotalMinutes)); } else if (ts.TotalHours <= 24) { tbLastLocation.Text = string.Format("{0}小时前", Convert.ToInt32(ts.TotalHours)); } else { tbLastLocation.Text = string.Format("{0}天前", Convert.ToInt32(ts.TotalDays)); } } } }; string url = String.Format("api/MapElementHisCoord/GetNew?mapElementCategoryID=1&mapElementID={0}", this._id); dt.GetDataAsync <MapElementHisCoord>(url); } else { this.tbLastLocationPanel.Visibility = Visibility.Collapsed; } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (this._mapElement == null) { return; } List <SystemConfig> detailsConfigs = ContainerManager.SystemConfigs.GetMapElementConfigs(this._mapElement.MapElementCategoryID, "DetailsWindow"); MapElementCategorie mecEntity; string controlMode; string controlName; string displayMode; #region 获得配置信息 //获得元素种类信息 mecEntity = ContainerManager.MapElementCategorys.Where(t => t.ID == this._mapElement.MapElementCategoryID).FirstOrDefault(); controlMode = detailsConfigs.Where(t => t.Name == "ControlMode").FirstOrDefault().Value; controlName = detailsConfigs.Where(t => t.Name == "ControlName").FirstOrDefault().Value; displayMode = detailsConfigs.Where(t => t.Name == "DisplayMode").FirstOrDefault().Value; #endregion //标题 this.Header = mecEntity.Name + "详情"; //控件模式 switch (controlMode) { case "Auto": //自动生成 SystemConfig itemsConfig = detailsConfigs.Where(t => t.Name == "Items").FirstOrDefault(); List <SystemConfig> itemList = ContainerManager.SystemConfigs.GetSystemConfigs(itemsConfig); if (displayMode == "Data") { #region 数据显示模式 //创建详情面板 Grid grid = new Grid() { Margin = new Thickness(0, 0, 0, 8) }; grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(60, GridUnitType.Pixel) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Pixel) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); this.Content = grid; TextBlock topTextBlock = new TextBlock() { Margin = new Thickness(10, 0, 0, 0), FontSize = 20, Foreground = new SolidColorBrush(Colors.Orange), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center }; topTextBlock.SetValue(Grid.RowProperty, 0); grid.Children.Add(topTextBlock); Grid lineGrid = new Grid() { Background = new SolidColorBrush(Colors.Gray) }; lineGrid.SetValue(Grid.RowProperty, 1); grid.Children.Add(lineGrid); WrapPanel contentPanel = new WrapPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(5, 0, 0, 0) }; contentPanel.SetValue(Grid.RowProperty, 2); grid.Children.Add(contentPanel); for (int i = 0; i < itemList.Count; i++) { List <SystemConfig> itemConfigs = ContainerManager.SystemConfigs.GetSystemConfigs(itemList[i]); string name; string bindField; string value; double?width = null; double?height = null; #region 获得配置信息 name = itemConfigs.Where(t => t.Name == "Name").FirstOrDefault().Value; bindField = itemConfigs.Where(t => t.Name == "BindField").FirstOrDefault().Value; value = bindField.IndexOf('.') == -1 ? ConfigHelper.GetFieldValue(this._mapElement, bindField) : ConfigHelper.GetXMLFieldValue(this._mapElement, bindField); string strWidth = itemConfigs.Where(t => t.Name == "Width").FirstOrDefault().Value; if (!string.IsNullOrEmpty(strWidth)) { width = Convert.ToInt32(strWidth); } string strHeight = itemConfigs.Where(t => t.Name == "Height").FirstOrDefault().Value; if (!string.IsNullOrEmpty(strHeight)) { height = Convert.ToInt32(strHeight); } #endregion if (i == 0) { topTextBlock.Text = value; } else { TZPanelItem itemControl = new TZPanelItem() { NameText = name, ValueText = value, Margin = new Thickness(0, 0, 5, 0), HorizontalAlignment = HorizontalAlignment.Left }; if (width != null) { itemControl.Width = (double)width; } if (height != null) { itemControl.Height = (double)height; } contentPanel.Children.Add(itemControl); } } #endregion } else if (displayMode == "Avatar") { #region 头像显示模式 //创建详情面板 Grid grid = new Grid() { Margin = new Thickness(5, 8, 0, 8) }; grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100, GridUnitType.Pixel) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) }); this.Content = grid; StackPanel topPanel = new StackPanel() { VerticalAlignment = VerticalAlignment.Center }; topPanel.SetValue(Grid.RowProperty, 0); topPanel.SetValue(Grid.ColumnProperty, 1); grid.Children.Add(topPanel); //创建头像 Image avatarImage = new Image() { Stretch = Stretch.Uniform, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 5, 0) }; string imageUrl = this._mapElement.Avatar; if (string.IsNullOrEmpty(imageUrl)) { imageUrl = "/Techzen.ICS.CS;component/Images/default_picture.jpg"; } else { ConfigHelper.ProcessImageUrl(ref imageUrl); } avatarImage.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(imageUrl, UriKind.RelativeOrAbsolute)); avatarImage.SetValue(Grid.RowProperty, 0); avatarImage.SetValue(Grid.ColumnProperty, 0); grid.Children.Add(avatarImage); WrapPanel contentPanel = new WrapPanel(); contentPanel.SetValue(Grid.RowProperty, 1); contentPanel.SetValue(Grid.ColumnSpanProperty, 2); grid.Children.Add(contentPanel); for (int i = 0; i < itemList.Count; i++) { List <SystemConfig> itemConfigs = ContainerManager.SystemConfigs.GetSystemConfigs(itemList[i]); string name; string bindField; string value; double?width = null; double?height = null; #region 获得配置信息 name = itemConfigs.Where(t => t.Name == "Name").FirstOrDefault().Value; bindField = itemConfigs.Where(t => t.Name == "BindField").FirstOrDefault().Value; value = bindField.IndexOf('.') == -1 ? ConfigHelper.GetFieldValue(this._mapElement, bindField) : ConfigHelper.GetXMLFieldValue(this._mapElement, bindField); string strWidth = itemConfigs.Where(t => t.Name == "Width").FirstOrDefault().Value; if (!string.IsNullOrEmpty(strWidth)) { width = Convert.ToInt32(strWidth); } string strHeight = itemConfigs.Where(t => t.Name == "Height").FirstOrDefault().Value; if (!string.IsNullOrEmpty(strHeight)) { height = Convert.ToInt32(strHeight); } #endregion TZPanelItem itemControl = new TZPanelItem() { NameText = name, ValueText = value, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 5, 0) }; if (width != null) { itemControl.Width = (double)width; } if (height != null) { itemControl.Height = (double)height; } if (i < 3) { topPanel.Children.Add(itemControl); } else { contentPanel.Children.Add(itemControl); } } #endregion } break; case "Custom": //自定义 UIElement customControl = Activator.CreateInstance(Type.GetType(controlName)) as UIElement; PropertyInfo propInfo = customControl.GetType().GetProperty("MapElement"); propInfo.SetValue(customControl, this._mapElement, null); this.Content = customControl; break; } }
public OrderPanelHeader(OrderViewModel order, double width) { _order = order; this.Width = width; this.SnapsToDevicePixels = true; this.MouseDown += root_MouseDown; this.MouseUp += root_MouseUp; Binding binding; BrushesPair brPair; // кисть заголовка BrushesPair brPairHeader = getHeaderBrushes(); // отступы Thickness rowMargin = new Thickness(0.02 * width, 0, 0.02 * width, 0); // шрифты double fontScale = (double)WpfHelper.GetAppGlobalValue("AppFontScale", 1.0d); double labelFontSize = fontScale * (double)WpfHelper.GetAppGlobalValue("ordPnlHdrLabelFontSize"); // 0. номер стола и заказа this.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0d, GridUnitType.Star) }); // 1. официант this.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(0.7d, GridUnitType.Star) }); // 2. дата создания заказа и таймер заказа this.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0d, GridUnitType.Star) }); // 0. номер стола и заказа Border brdHdrTableRow = new Border() { BorderBrush = Brushes.DarkBlue }; brdHdrTableRow.SetValue(Grid.RowProperty, 0); brdHdrTableRow.BorderThickness = new Thickness(1, 1, 1, 0); if (brPairHeader != null) { brdHdrTableRow.Background = brPairHeader.Background; brdHdrTableRow.SetValue(TextBlock.ForegroundProperty, brPairHeader.Foreground); } // уголки рамок brdHdrTableRow.CornerRadius = new CornerRadius(0.03 * width, 0.03 * width, 0, 0); Grid grdHdrTableRow = new Grid(); grdHdrTableRow.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0, GridUnitType.Auto) }); grdHdrTableRow.ColumnDefinitions.Add(new ColumnDefinition()); // стол TextBlock tblTable = new TextBlock() { VerticalAlignment = VerticalAlignment.Center, Margin = rowMargin }; tblTable.SetValue(Grid.ColumnProperty, 0); Run tbTableLabel1 = new Run() { Text = "Стол №: ", FontSize = labelFontSize }; tblTable.Inlines.Add(tbTableLabel1); Run tbTableName = new Run() { FontWeight = FontWeights.Bold }; binding = new Binding("TableName") { Source = _order }; tbTableName.SetBinding(Run.TextProperty, binding); tbTableName.FontSize = fontScale * (double)WpfHelper.GetAppGlobalValue("ordPnlHdrTableNameFontSize"); tblTable.Inlines.Add(tbTableName); grdHdrTableRow.Children.Add(tblTable); // номер заказа Border brdOrderNumber = new Border(); brdOrderNumber.SetValue(Grid.ColumnProperty, 1); TextBlock tblOrderNumber = new TextBlock() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = rowMargin }; Run tbTableLabel2 = new Run() { Text = "Заказ №: ", FontSize = labelFontSize }; tblOrderNumber.Inlines.Add(tbTableLabel2); Run tbOrderNumber = new Run() { FontWeight = FontWeights.Bold }; binding = new Binding("Number") { Source = _order }; // , Converter = new IsZeroConverter() tbOrderNumber.SetBinding(Run.TextProperty, binding); tbOrderNumber.FontSize = fontScale * (double)WpfHelper.GetAppGlobalValue("ordPnlHdrOrderNumberFontSize"); tblOrderNumber.Inlines.Add(tbOrderNumber); brdOrderNumber.Child = tblOrderNumber; grdHdrTableRow.Children.Add(brdOrderNumber); brdHdrTableRow.Child = grdHdrTableRow; this.Children.Add(brdHdrTableRow); // 1. официант Border brdHdrWaiter = new Border() { BorderBrush = Brushes.DarkBlue, BorderThickness = new Thickness(1, 0, 1, 0) }; brdHdrWaiter.SetValue(Grid.RowProperty, 1); if (brPairHeader != null) { brdHdrWaiter.Background = brPairHeader.Background; brdHdrWaiter.SetValue(TextBlock.ForegroundProperty, brPairHeader.Foreground); } TextBlock tbWaiter = new TextBlock() { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left, TextWrapping = TextWrapping.Wrap, FontWeight = FontWeights.Bold, Margin = new Thickness(0.02 * width, 0, 0.02 * width, 0) }; binding = new Binding("Waiter") { Source = _order }; tbWaiter.SetBinding(TextBlock.TextProperty, binding); tbWaiter.FontSize = fontScale * (double)WpfHelper.GetAppGlobalValue("ordPnlHdrWaiterNameFontSize"); brdHdrWaiter.Child = tbWaiter; this.Children.Add(brdHdrWaiter); // метка отдела Viewbox vbxDivisionMark = new Viewbox() { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Stretch = Stretch.Fill, ClipToBounds = true }; vbxDivisionMark.Width = 0.2d * width; vbxDivisionMark.SetValue(Grid.ColumnProperty, 1); vbxDivisionMark.SetValue(Grid.RowProperty, 0); vbxDivisionMark.SetValue(Grid.RowSpanProperty, 2); Polygon divisionMark = new Polygon() { Opacity = 0.7, Points = new PointCollection(new Point[] { new Point(0, 0), new Point(10, 0), new Point(10, 10) }) }; if (!_order.DivisionColorRGB.IsNull()) { divisionMark.Fill = WpfHelper.GetBrushFromRGBString(order.DivisionColorRGB); } vbxDivisionMark.Child = divisionMark; this.Children.Add(vbxDivisionMark); // 2. дата создания заказа и таймер заказа Border brdHdrOrderTime = new Border() { BorderBrush = Brushes.DarkBlue, BorderThickness = new Thickness(1.0d) }; brdHdrOrderTime.SetValue(Grid.RowProperty, 2); if (brPairHeader != null) { brdHdrOrderTime.Background = brPairHeader.Background; brdHdrOrderTime.SetValue(TextBlock.ForegroundProperty, brPairHeader.Foreground); } Grid grdHdrOrderTime = new Grid() { Margin = rowMargin }; grdHdrOrderTime.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(4.0d, GridUnitType.Star) }); grdHdrOrderTime.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(4.0d, GridUnitType.Star) }); // дата создания заказа WrapPanel pnlOrderDate = new WrapPanel() { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left }; pnlOrderDate.SetValue(Grid.ColumnProperty, 0); TextBlock tbOrderDateLabel = new TextBlock() { Text = "Создан в: ", FontSize = labelFontSize, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left }; pnlOrderDate.Children.Add(tbOrderDateLabel); TextBlock tbOrderDate = new TextBlock() { FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap, Text = _order.CreateDate.ToKDSPanelString() }; tbOrderDate.FontSize = fontScale * (double)WpfHelper.GetAppGlobalValue("ordPnlHdrOrderCreateDateFontSize"); pnlOrderDate.Children.Add(tbOrderDate); grdHdrOrderTime.Children.Add(pnlOrderDate); // таймер Border brdOrderTimer = new Border() { Padding = new Thickness(5d, 3d, 5d, 3d), Margin = new Thickness(0, 3d, 0, 3d) }; brdOrderTimer.SetValue(Grid.ColumnProperty, 1); // уголки double timerCornerRadius = 0.025 * width; brdOrderTimer.CornerRadius = new CornerRadius(timerCornerRadius, timerCornerRadius, timerCornerRadius, timerCornerRadius); brPair = BrushHelper.AppBrushes["orderHeaderTimer"]; if (brPair != null) { brdOrderTimer.Background = brPair.Background; brdOrderTimer.SetValue(TextBlock.ForegroundProperty, brPair.Foreground); } // панель элементов WrapPanel pnlOrderTimer = new WrapPanel() { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; TextBlock tbOrderTimerLabel = new TextBlock() { Text = "Прошло: ", FontSize = labelFontSize, FontStretch = FontStretches.Condensed }; pnlOrderTimer.Children.Add(tbOrderTimerLabel); TextBlock tbOrderTimer = new TextBlock() { FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap }; tbOrderTimer.FontSize = fontScale * (double)WpfHelper.GetAppGlobalValue("ordPnlHdrOrderTimerFontSize"); binding = new Binding("WaitingTimerString") { Source = _order }; tbOrderTimer.SetBinding(TextBlock.TextProperty, binding); pnlOrderTimer.Children.Add(tbOrderTimer); brdOrderTimer.Child = pnlOrderTimer; grdHdrOrderTime.Children.Add(brdOrderTimer); brdHdrOrderTime.Child = grdHdrOrderTime; this.Children.Add(brdHdrOrderTime); }