/// <summary> /// Sets the text value of a grid cell in a given output grid /// </summary> /// <param name="strataValue"> /// The strata value to which this grid cell belongs; used to search the list of grids and /// return the proper System.Windows.Controls.Grid for text insertion. /// </param> /// <param name="textBlockConfig">The configuration options for this block of text</param> private void SetGridText(string strataValue, TextBlockConfig textBlockConfig) { Grid grid = new Grid(); grid = GetStrataGrid(strataValue); TextBlock txt = new TextBlock(); txt.Foreground = this.Resources["cellForeground"] as SolidColorBrush; txt.Text = textBlockConfig.Text; txt.Margin = textBlockConfig.Margin; txt.VerticalAlignment = textBlockConfig.VerticalAlignment; txt.HorizontalAlignment = textBlockConfig.HorizontalAlignment; Grid.SetRow(txt, textBlockConfig.RowNumber); Grid.SetColumn(txt, textBlockConfig.ColumnNumber); grid.Children.Add(txt); }
private void SetGridText(string strataValue, TextBlockConfig textBlockConfig, FontWeight fontWeight) { Grid grid = new Grid(); grid = GetStrataGrid(strataValue); TextBlock txt = new TextBlock(); txt.Text = textBlockConfig.Text; txt.Margin = textBlockConfig.Margin; txt.VerticalAlignment = textBlockConfig.VerticalAlignment; txt.HorizontalAlignment = textBlockConfig.HorizontalAlignment; txt.FontWeight = fontWeight; int rowNum = textBlockConfig.RowNumber; int colNum = textBlockConfig.ColumnNumber; if (colNum == 0 && rowNum > 0) { Rectangle rctHeader = new Rectangle(); rctHeader.Style = this.Resources["gridHeaderCellRectangle"] as Style; Grid.SetRow(rctHeader, rowNum); Grid.SetColumn(rctHeader, 0); grid.Children.Add(rctHeader); txt.Style = this.Resources["columnHeadingText"] as Style; } if (colNum > 0) { StackPanel panel = new StackPanel(); panel.Margin = new Thickness(2, 4, 2, 4); panel.Children.Add(txt); Grid.SetRow(panel, rowNum); Grid.SetColumn(panel, colNum); grid.Children.Add(panel); } else { Grid.SetRow(txt, rowNum); Grid.SetColumn(txt, colNum); grid.Children.Add(txt); } }
private void SetGridText(string strataValue, TextBlockConfig textBlockConfig, FontWeight fontWeight) { Grid grid = new Grid(); grid = GetStrataGrid(strataValue); TextBlock txt = new TextBlock(); txt.Foreground = this.Resources["cellForeground"] as SolidColorBrush; txt.FontWeight = fontWeight; txt.Text = textBlockConfig.Text; txt.Margin = textBlockConfig.Margin; txt.VerticalAlignment = textBlockConfig.VerticalAlignment; txt.HorizontalAlignment = textBlockConfig.HorizontalAlignment; txt.TextAlignment = textBlockConfig.TextAlignment; txt.TextWrapping = TextWrapping.Wrap; txt.MaxWidth = 300; txt.Visibility = textBlockConfig.ControlVisibility; if (IsHostedByEnter) { txt.MouseEnter += new MouseEventHandler(rowDef_MouseEnter); txt.MouseLeave += new MouseEventHandler(rowDef_MouseLeave); txt.MouseUp += new MouseButtonEventHandler(rowDef_MouseUp); } Grid.SetZIndex(txt, 1000); Grid.SetRow(txt, textBlockConfig.RowNumber); Grid.SetColumn(txt, textBlockConfig.ColumnNumber); grid.Children.Add(txt); if (checkboxAllowUpdates.IsChecked == true) { //txt.MouseLeftButtonDown += new MouseButtonEventHandler(gridCell_MouseLeftButtonDown); } }
private void SetGridText(Grid grid, TextBlockConfig textBlockConfig) { TextBlock txt = new TextBlock(); txt.Text = textBlockConfig.Text; txt.Margin = textBlockConfig.Margin; txt.VerticalAlignment = textBlockConfig.VerticalAlignment; txt.HorizontalAlignment = textBlockConfig.HorizontalAlignment; Grid.SetRow(txt, textBlockConfig.RowNumber); Grid.SetColumn(txt, textBlockConfig.ColumnNumber); grid.Children.Add(txt); }
private void SetGridImage(string strataValue, byte[] imageBlob, TextBlockConfig textBlockConfig, FontWeight fontWeight) { Grid grid = new Grid(); grid = GetStrataGrid(strataValue); Image image = new Image(); System.IO.MemoryStream stream = new System.IO.MemoryStream(imageBlob); BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.StreamSource = stream; bitmap.EndInit(); image.Source = bitmap; image.Height = bitmap.Height; image.Width = bitmap.Width; if (IsHostedByEnter) { image.MouseEnter += new MouseEventHandler(rowDef_MouseEnter); image.MouseLeave += new MouseEventHandler(rowDef_MouseLeave); image.MouseUp += new MouseButtonEventHandler(rowDef_MouseUp); } Grid.SetZIndex(image, 1000); Grid.SetRow(image, textBlockConfig.RowNumber); Grid.SetColumn(image, textBlockConfig.ColumnNumber); grid.Children.Add(image); }
/// <summary> /// Sets the text value of a grid cell in a given output grid /// </summary> /// <param name="strataValue"> /// The strata value to which this grid cell belongs; used to search the list of grids and /// return the proper System.Windows.Controls.Grid for text insertion. /// </param> /// <param name="textBlockConfig">The configuration options for this block of text</param> private void SetGridText(string strataValue, TextBlockConfig textBlockConfig) { Grid grid = new Grid(); grid = GetStrataGrid(strataValue); TextBlock txt = new TextBlock(); txt.Text = textBlockConfig.Text; txt.Margin = textBlockConfig.Margin; txt.VerticalAlignment = textBlockConfig.VerticalAlignment; txt.HorizontalAlignment = textBlockConfig.HorizontalAlignment; Grid.SetRow(txt, textBlockConfig.RowNumber); Grid.SetColumn(txt, textBlockConfig.ColumnNumber); grid.Children.Add(txt); }
private void SetGridText(string strataValue, TextBlockConfig textBlockConfig, FontWeight fontWeight, double total) { Grid grid = new Grid(); grid = GetStrataGrid(strataValue); TextBlock txt = new TextBlock(); txt.Text = textBlockConfig.Text; txt.Margin = textBlockConfig.Margin; txt.VerticalAlignment = textBlockConfig.VerticalAlignment; txt.HorizontalAlignment = textBlockConfig.HorizontalAlignment; txt.FontWeight = fontWeight; int rowNum = textBlockConfig.RowNumber; int colNum = textBlockConfig.ColumnNumber; if (colNum == 0 && rowNum > 0) { Rectangle rctHeader = new Rectangle(); rctHeader.Style = this.Resources["gridHeaderCellRectangle"] as Style; Grid.SetRow(rctHeader, rowNum); Grid.SetColumn(rctHeader, 0); grid.Children.Add(rctHeader); txt.Style = this.Resources["columnHeadingText"] as Style; } else if (colNum > 0 && rowNum > 0 && colNum < grid.ColumnDefinitions.Count - 1) { double value = double.Parse(txt.Text); double pct = value / total; double break1 = 0; double break2 = 20; double break3 = 40; double break4 = 60; double break5 = 80; double.TryParse(txtPct1.Text, out break1); double.TryParse(txtPct2.Text, out break2); double.TryParse(txtPct3.Text, out break3); double.TryParse(txtPct4.Text, out break4); double.TryParse(txtPct5.Text, out break5); if (cmbBreakType.SelectedIndex == 1) { pct = value; } else { break1 = break1 / 100; break2 = break2 / 100; break3 = break3 / 100; break4 = break4 / 100; break5 = break5 / 100; } if (checkboxConditionalShading.IsChecked == true && (break1 < break2 && break2 < break3 && break3 < break4 && break4 < break5)) { if (pct >= break1 && pct < break2) { Rectangle rctHeat = new Rectangle(); rctHeat.Fill = ColorList[4]; Grid.SetRow(rctHeat, rowNum); Grid.SetColumn(rctHeat, colNum); grid.Children.Add(rctHeat); } else if (pct >= break2 && pct < break3) { Rectangle rctHeat = new Rectangle(); rctHeat.Fill = ColorList[3]; Grid.SetRow(rctHeat, rowNum); Grid.SetColumn(rctHeat, colNum); grid.Children.Add(rctHeat); } else if (pct >= break3 && pct < break4) { Rectangle rctHeat = new Rectangle(); rctHeat.Fill = ColorList[2]; Grid.SetRow(rctHeat, rowNum); Grid.SetColumn(rctHeat, colNum); grid.Children.Add(rctHeat); } else if (pct >= break4 && pct < break5) { Rectangle rctHeat = new Rectangle(); rctHeat.Fill = ColorList[1]; Grid.SetRow(rctHeat, rowNum); Grid.SetColumn(rctHeat, colNum); grid.Children.Add(rctHeat); } else if (pct >= break5 && pct <= double.MaxValue) { Rectangle rctHeat = new Rectangle(); rctHeat.Fill = ColorList[0]; Grid.SetRow(rctHeat, rowNum); Grid.SetColumn(rctHeat, colNum); grid.Children.Add(rctHeat); } } else { Rectangle rctNormal = new Rectangle(); rctNormal.Fill = Brushes.White; Grid.SetRow(rctNormal, rowNum); Grid.SetColumn(rctNormal, colNum); grid.Children.Add(rctNormal); } } if (colNum > 0) { StackPanel panel = new StackPanel(); panel.Margin = new Thickness(2, 4, 2, 4); panel.Children.Add(txt); Grid.SetRow(panel, rowNum); Grid.SetColumn(panel, colNum); grid.Children.Add(panel); } else { Grid.SetRow(txt, rowNum); Grid.SetColumn(txt, colNum); grid.Children.Add(txt); } }
private void SetGridText(string strataValue, TextBlockConfig textBlockConfig, FontWeight fontWeight) { Grid grid = new Grid(); grid = GetGroupGrid(strataValue); TextBlock txt = new TextBlock(); txt.FontWeight = fontWeight; txt.Text = textBlockConfig.Text; txt.Margin = textBlockConfig.Margin; txt.VerticalAlignment = textBlockConfig.VerticalAlignment; txt.HorizontalAlignment = textBlockConfig.HorizontalAlignment; txt.TextWrapping = TextWrapping.Wrap; txt.MaxWidth = 300; Grid.SetZIndex(txt, 1000); Grid.SetRow(txt, textBlockConfig.RowNumber); Grid.SetColumn(txt, textBlockConfig.ColumnNumber); grid.Children.Add(txt); }
private void SetGridImage(string strataValue, byte[] imageBlob, TextBlockConfig textBlockConfig, FontWeight fontWeight) { Grid grid = new Grid(); grid = GetGroupGrid(strataValue); Image image = new Image(); System.IO.MemoryStream stream = new System.IO.MemoryStream(imageBlob); BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.StreamSource = stream; bitmap.EndInit(); image.Source = bitmap; image.Height = bitmap.Height; image.Width = bitmap.Width; Grid.SetZIndex(image, 1000); Grid.SetRow(image, textBlockConfig.RowNumber); Grid.SetColumn(image, textBlockConfig.ColumnNumber); grid.Children.Add(image); }