private void Redraw() { grdMain.Children.Clear(); grdMain.RowDefinitions.Clear(); grdMain.ColumnDefinitions.Clear(); AddGridHeader(); foreach (DataRowView rowView in dv) { DataRow row = rowView.Row; StrataGridListRow sRow = new StrataGridListRow(); sRow.StrataLabel = row[0].ToString(); if (row[1] == DBNull.Value) { sRow.OutcomeRateExposure = null; } else { sRow.OutcomeRateExposure = Convert.ToDecimal(row[1]); } if (row[2] == DBNull.Value) { sRow.OutcomeRateNoExposure = null; } else { sRow.OutcomeRateNoExposure = Convert.ToDecimal(row[2]); } if (row[3] == DBNull.Value) { sRow.RiskRatio = null; } else { sRow.RiskRatio = Convert.ToDecimal(row[3]); } if (row[4] == DBNull.Value) { sRow.RiskLower = null; } else { sRow.RiskLower = Convert.ToDecimal(row[4]); } if (row[5] == DBNull.Value) { sRow.RiskUpper = null; } else { sRow.RiskUpper = Convert.ToDecimal(row[5]); } if (row[6] == DBNull.Value) { sRow.OddsRatio = null; } else { sRow.OddsRatio = Convert.ToDecimal(row[6]); } if (row[7] == DBNull.Value) { sRow.OddsLower = null; } else { sRow.OddsLower = Convert.ToDecimal(row[7]); } if (row[8] == DBNull.Value) { sRow.OddsUpper = null; } else { sRow.OddsUpper = Convert.ToDecimal(row[8]); } AddRow(sRow, false); } }
public void AddRow(StrataGridListRow strataGridListRow, bool addToTable = true) { if (addToTable) { if (table.Select("[" + table.Columns[0].ColumnName + "] = '" + strataGridListRow.StrataLabel.Replace("'", "''") + "'", "").Length > 0) { // don't add. return; } else { table.Rows.Add(strataGridListRow.StrataLabel, strataGridListRow.OutcomeRateExposure, strataGridListRow.OutcomeRateNoExposure, strataGridListRow.RiskRatio, strataGridListRow.RiskLower, strataGridListRow.RiskUpper, strataGridListRow.OddsRatio, strataGridListRow.OddsLower, strataGridListRow.OddsUpper); } } grdMain.RowDefinitions.Add(new RowDefinition()); grdMain.RowDefinitions[grdMain.RowDefinitions.Count - 1].Height = GridLength.Auto; Rectangle r1 = new Rectangle(); r1.Style = this.Resources["gridCellRectangle"] as Style; Grid.SetColumn(r1, 0); Grid.SetColumnSpan(r1, 10); Grid.SetRow(r1, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(r1); r1.MouseEnter += new MouseEventHandler(rowDef_MouseEnter); r1.MouseLeave += new MouseEventHandler(rowDef_MouseLeave); r1.MouseUp += new MouseButtonEventHandler(rowDef_MouseUp); Border b1 = new Border(); b1.Style = this.Resources["gridCellBorder"] as Style; b1.BorderThickness = new Thickness(1, 0, 1, 1); b1.IsHitTestVisible = false; Grid.SetColumn(b1, 0); Grid.SetRow(b1, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b1); Border b2 = new Border(); b2.Style = this.Resources["gridCellBorder"] as Style; b2.IsHitTestVisible = false; Grid.SetColumn(b2, 1); Grid.SetRow(b2, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b2); Border b3 = new Border(); b3.Style = this.Resources["gridCellBorder"] as Style; b3.IsHitTestVisible = false; Grid.SetColumn(b3, 2); Grid.SetRow(b3, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b3); Border b4 = new Border(); b4.Style = this.Resources["gridCellBorder"] as Style; b4.IsHitTestVisible = false; Grid.SetColumn(b4, 3); Grid.SetRow(b4, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b4); Border b5 = new Border(); b5.Style = this.Resources["gridCellBorder"] as Style; b5.IsHitTestVisible = false; Grid.SetColumn(b5, 4); Grid.SetRow(b5, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b5); Border b6 = new Border(); b6.Style = this.Resources["gridCellBorder"] as Style; b6.IsHitTestVisible = false; Grid.SetColumn(b6, 5); Grid.SetRow(b6, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b6); Border b7 = new Border(); b7.Style = this.Resources["gridCellBorder"] as Style; b7.IsHitTestVisible = false; Grid.SetColumn(b7, 6); Grid.SetRow(b7, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b7); Border b8 = new Border(); b8.Style = this.Resources["gridCellBorder"] as Style; b8.IsHitTestVisible = false; Grid.SetColumn(b8, 7); Grid.SetRow(b8, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b8); Border b9 = new Border(); b9.Style = this.Resources["gridCellBorder"] as Style; b9.IsHitTestVisible = false; Grid.SetColumn(b9, 8); Grid.SetRow(b9, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b9); TextBlock t1 = new TextBlock(); t1.Text = strataGridListRow.StrataLabel; t1.Margin = (Thickness)this.Resources["genericTextMargin"]; t1.IsHitTestVisible = false; Grid.SetColumn(t1, 0); Grid.SetRow(t1, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t1); TextBlock t2 = new TextBlock(); if(strataGridListRow.OutcomeRateExposure.HasValue) t2.Text = strataGridListRow.OutcomeRateExposure.Value.ToString("F4"); t2.Margin = (Thickness)this.Resources["genericTextMargin"]; t2.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t2.IsHitTestVisible = false; Grid.SetColumn(t2, 1); Grid.SetRow(t2, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t2); TextBlock t3 = new TextBlock(); if (strataGridListRow.OutcomeRateNoExposure.HasValue) t3.Text = strataGridListRow.OutcomeRateNoExposure.Value.ToString("F4"); t3.Margin = (Thickness)this.Resources["genericTextMargin"]; t3.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t3.IsHitTestVisible = false; Grid.SetColumn(t3, 2); Grid.SetRow(t3, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t3); TextBlock t4 = new TextBlock(); if (strataGridListRow.RiskRatio.HasValue) t4.Text = strataGridListRow.RiskRatio.Value.ToString("F4"); t4.Margin = (Thickness)this.Resources["genericTextMargin"]; t4.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t4.IsHitTestVisible = false; Grid.SetColumn(t4, 3); Grid.SetRow(t4, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t4); TextBlock t5 = new TextBlock(); if (strataGridListRow.RiskLower.HasValue) t5.Text = strataGridListRow.RiskLower.Value.ToString("F4"); t5.Margin = (Thickness)this.Resources["genericTextMargin"]; t5.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t5.IsHitTestVisible = false; Grid.SetColumn(t5, 4); Grid.SetRow(t5, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t5); TextBlock t6 = new TextBlock(); if (strataGridListRow.RiskUpper.HasValue) t6.Text = strataGridListRow.RiskUpper.Value.ToString("F4"); t6.Margin = (Thickness)this.Resources["genericTextMargin"]; t6.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t6.IsHitTestVisible = false; Grid.SetColumn(t6, 5); Grid.SetRow(t6, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t6); TextBlock t7 = new TextBlock(); if (strataGridListRow.OddsRatio.HasValue) t7.Text = strataGridListRow.OddsRatio.Value.ToString("F4"); t7.Margin = (Thickness)this.Resources["genericTextMargin"]; t7.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t7.IsHitTestVisible = false; Grid.SetColumn(t7, 6); Grid.SetRow(t7, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t7); TextBlock t8 = new TextBlock(); if (strataGridListRow.OddsLower.HasValue) t8.Text = strataGridListRow.OddsLower.Value.ToString("F4"); t8.Margin = (Thickness)this.Resources["genericTextMargin"]; t8.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t8.IsHitTestVisible = false; Grid.SetColumn(t8, 7); Grid.SetRow(t8, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t8); TextBlock t9 = new TextBlock(); if (strataGridListRow.OddsUpper.HasValue) t9.Text = strataGridListRow.OddsUpper.Value.ToString("F4"); t9.Margin = (Thickness)this.Resources["genericTextMargin"]; t9.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t9.IsHitTestVisible = false; Grid.SetColumn(t9, 8); Grid.SetRow(t9, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t9); }
private void Redraw() { grdMain.Children.Clear(); grdMain.RowDefinitions.Clear(); grdMain.ColumnDefinitions.Clear(); AddGridHeader(); foreach (DataRowView rowView in dv) { DataRow row = rowView.Row; StrataGridListRow sRow = new StrataGridListRow(); sRow.StrataLabel = row[0].ToString(); if (row[1] == DBNull.Value) { sRow.OutcomeRateExposure = null; } else { sRow.OutcomeRateExposure = Convert.ToDecimal(row[1]); } if (row[2] == DBNull.Value) { sRow.OutcomeRateNoExposure = null; } else { sRow.OutcomeRateNoExposure = Convert.ToDecimal(row[2]); } if (row[3] == DBNull.Value) { sRow.RiskRatio = null; } else { sRow.RiskRatio = Convert.ToDecimal(row[3]); } if (row[4] == DBNull.Value) { sRow.OddsRatio = null; } else { sRow.OddsRatio = Convert.ToDecimal(row[4]); } if (row[5] == DBNull.Value) { sRow.OddsLower = null; } else { sRow.OddsLower = Convert.ToDecimal(row[5]); } if (row[6] == DBNull.Value) { sRow.OddsUpper = null; } else { sRow.OddsUpper = Convert.ToDecimal(row[6]); } AddRow(sRow, false); } }
private void AddFreqGrid(string strataVar, string value, string crosstabVar, string groupReference, DataTable table) { StackPanel crosstabPanel = new StackPanel(); StackPanel groupPanel = new StackPanel(); bool strataSummaryOnly = (bool)checkboxStrataSummaryOnly.IsChecked; bool isGrouped = this.DashboardHelper.GetAllGroupsAsList().Contains(GadgetOptions.MainVariableName); if (isGrouped && strataGroupPanel == null) { strataGroupPanel = new GadgetStrataListPanel(StrataListPanelMode.GroupMode); strataGroupPanel.SnapsToDevicePixels = true; panelMain.Children.Add(strataGroupPanel); } groupPanel.Tag = groupReference; bool inList = false; foreach (StackPanel panel in groupList) { if (panel.Tag == groupPanel.Tag) { groupPanel = panel; inList = true; } } if (!inList) { groupList.Add(groupPanel); } int columnCount = table.Columns.Count; Expander expander = new Expander(); TextBlock txtExpanderHeader = new TextBlock(); txtExpanderHeader.Text = value; txtExpanderHeader.Style = this.Resources["genericOutputExpanderText"] as Style; string formattedValue = value; if (string.IsNullOrEmpty(strataVar) && GadgetOptions.StrataVariableNames.Count == 0) { formattedValue = crosstabVar; } else { if (value.EndsWith(" = ")) { formattedValue = value + dashboardHelper.Config.Settings.RepresentationOfMissing; } } if (isGrouped) { formattedValue = groupReference + ", " + formattedValue; } txtExpanderHeader.Text = formattedValue; expander.Header = txtExpanderHeader; if (columnCount == 3 && table.Rows.Count == 2 && (isRunningGrouped2x2 == null || isRunningGrouped2x2 == true)) // is 2x2 { isRunningGrouped2x2 = true; decimal yyVal = decimal.Parse(table.Rows[0][1].ToString()); decimal ynVal = decimal.Parse(table.Rows[0][2].ToString()); decimal nyVal = decimal.Parse(table.Rows[1][1].ToString()); decimal nnVal = decimal.Parse(table.Rows[1][2].ToString()); Controls.GadgetTwoByTwoPanel twoByTwoPanel = new Controls.GadgetTwoByTwoPanel(yyVal, ynVal, nyVal, nnVal); twoByTwoPanel.ValuesUpdated += new TwoByTwoValuesUpdatedHandler(twoByTwoPanel_ValuesUpdated); if (panelMain.Orientation == Orientation.Horizontal) { twoByTwoPanel.Orientation = Orientation.Horizontal; } else { twoByTwoPanel.Orientation = Orientation.Vertical; } twoByTwoPanel.Margin = new Thickness(5); if (isGrouped) { twoByTwoPanel.ExposureVariable = groupReference; } else { twoByTwoPanel.ExposureVariable = this.GadgetOptions.MainVariableName; if (strataSummaryOnly) { twoByTwoPanel.Visibility = System.Windows.Visibility.Collapsed; expander.Visibility = System.Windows.Visibility.Collapsed; } } twoByTwoPanel.OutcomeVariable = this.GadgetOptions.CrosstabVariableName; twoByTwoPanel.OutcomeYesLabel = table.Columns[1].ColumnName; twoByTwoPanel.OutcomeNoLabel = table.Columns[2].ColumnName; twoByTwoPanel.ExposureYesLabel = table.Rows[0][0].ToString(); twoByTwoPanel.ExposureNoLabel = table.Rows[1][0].ToString(); if (showPercents) { twoByTwoPanel.ShowRowColumnPercents = true; } else { twoByTwoPanel.ShowRowColumnPercents = false; } if (string.IsNullOrEmpty(strataVar) && GadgetOptions.StrataVariableNames.Count == 0) { crosstabPanel.Margin = (Thickness)this.Resources["genericElementMargin"]; crosstabPanel.Children.Add(twoByTwoPanel); if (isGrouped && strataGroupPanel != null) { StrataGridListRow sRow = new StrataGridListRow(); sRow.StrataLabel = groupReference; sRow.OutcomeRateExposure = twoByTwoPanel.OutcomeRateExposure; sRow.OutcomeRateNoExposure = twoByTwoPanel.OutcomeRateNoExposure; sRow.RiskRatio = twoByTwoPanel.RiskRatio; sRow.OddsRatio = twoByTwoPanel.OddsRatio; sRow.OddsLower = twoByTwoPanel.OddsRatioLower; sRow.OddsUpper = twoByTwoPanel.OddsRatioUpper; strataGroupPanel.AddRow(sRow); strataGroupPanel.RowClicked += new StrataGridRowClickedHandler(strataGroupPanel_NoStrata_RowClicked); strataGroupPanel.ExpandAllClicked += new StrataGridExpandAllClickedHandler(strataGroupPanel_NoStrata_ExpandAllClicked); } groupPanel.Children.Add(crosstabPanel); //panelMain.Children.Add(crosstabPanel); if (!panelMain.Children.Contains(groupPanel)) { panelMain.Children.Add(groupPanel); } } else { GadgetStrataListPanel strataListPanel = new GadgetStrataListPanel(); bool found = false; foreach (UIElement element in groupPanel.Children) { if (element is GadgetStrataListPanel) { found = true; strataListPanel = (element as GadgetStrataListPanel); break; } } if (!found) { strataListPanel.RowClicked += new StrataGridRowClickedHandler(strataListPanel_RowClicked); strataListPanel.ExpandAllClicked += new StrataGridExpandAllClickedHandler(strataListPanel_ExpandAllClicked); strataListPanel.SnapsToDevicePixels = true; strataListPanels.Add(strataListPanel); groupPanel.Children.Add(strataListPanel); if (!isGrouped && strataSummaryOnly) { strataListPanel.Visibility = System.Windows.Visibility.Collapsed; } //panelMain.Children.Add(strataListPanel); } StrataGridListRow sRow = new StrataGridListRow(); sRow.StrataLabel = formattedValue; sRow.OutcomeRateExposure = twoByTwoPanel.OutcomeRateExposure; sRow.OutcomeRateNoExposure = twoByTwoPanel.OutcomeRateNoExposure; sRow.RiskRatio = twoByTwoPanel.RiskRatio; sRow.OddsRatio = twoByTwoPanel.OddsRatio; sRow.OddsLower = twoByTwoPanel.OddsRatioLower; sRow.OddsUpper = twoByTwoPanel.OddsRatioUpper; strataListPanel.AddRow(sRow); if (isGrouped && strataGroupPanel != null) { strataListPanel.ExpanderHeader = groupReference; sRow = new StrataGridListRow(); sRow.StrataLabel = groupReference; sRow.OutcomeRateExposure = null; sRow.OutcomeRateNoExposure = null; sRow.RiskRatio = null; sRow.OddsRatio = null; sRow.OddsLower = null; sRow.OddsUpper = null; strataGroupPanel.AddRow(sRow); strataGroupPanel.RowClicked += new StrataGridRowClickedHandler(strataGroupPanel_RowClicked); strataGroupPanel.ExpandAllClicked += new StrataGridExpandAllClickedHandler(strataGroupPanel_ExpandAllClicked); } twoByTwoPanel.Tag = formattedValue; crosstabPanel.Margin = (Thickness)this.Resources["genericElementMargin"]; crosstabPanel.Children.Add(twoByTwoPanel); expander.Margin = (Thickness)this.Resources["expanderMargin"]; expander.IsExpanded = true; expander.Content = crosstabPanel; groupPanel.Children.Add(expander); //panelMain.Children.Add(expander); strataExpanderList.Add(expander); if (groupList.Count == 0) { groupList.Add(groupPanel); } if (!panelMain.Children.Contains(groupPanel)) { panelMain.Children.Add(groupPanel); } } strata2x2GridList.Add(twoByTwoPanel); return; } else if ((columnCount != 3 || table.Rows.Count != 2) && (isRunningGrouped2x2 == true)) { return; } isRunningGrouped2x2 = false; Grid chiSquaregrid = new Grid(); chiSquaregrid.Tag = value; chiSquaregrid.HorizontalAlignment = HorizontalAlignment.Center; chiSquaregrid.Margin = new Thickness(0, 5, 0, 10); chiSquaregrid.Visibility = System.Windows.Visibility.Collapsed; chiSquaregrid.ColumnDefinitions.Add(new ColumnDefinition()); chiSquaregrid.ColumnDefinitions.Add(new ColumnDefinition()); chiSquaregrid.ColumnDefinitions.Add(new ColumnDefinition()); chiSquaregrid.RowDefinitions.Add(new RowDefinition()); chiSquaregrid.RowDefinitions.Add(new RowDefinition()); Grid grid = new Grid(); grid.Tag = value; grid.Style = this.Resources["genericOutputGrid"] as Style; grid.Visibility = System.Windows.Visibility.Collapsed; grid.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; for (int i = 0; i < columnCount; i++) { ColumnDefinition column = new ColumnDefinition(); column.Width = GridLength.Auto; grid.ColumnDefinitions.Add(column); } ColumnDefinition totalColumn = new ColumnDefinition(); totalColumn.Width = GridLength.Auto; grid.ColumnDefinitions.Add(totalColumn); ScrollViewer sv = new ScrollViewer(); sv.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; sv.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; sv.MaxHeight = System.Windows.SystemParameters.PrimaryScreenHeight - 320; sv.MaxWidth = System.Windows.SystemParameters.PrimaryScreenWidth - 300; sv.Margin = (Thickness)this.Resources["expanderMargin"]; Grid gridOuter = new Grid(); gridOuter.ColumnDefinitions.Add(new ColumnDefinition()); gridOuter.ColumnDefinitions.Add(new ColumnDefinition()); gridOuter.RowDefinitions.Add(new RowDefinition()); gridOuter.RowDefinitions.Add(new RowDefinition()); Grid.SetColumn(grid, 1); Grid.SetRow(grid, 1); gridOuter.Children.Add(grid); TextBlock tblock1 = new TextBlock(); RotateTransform rotate = new RotateTransform(270); tblock1.RenderTransform = rotate; tblock1.Margin = new Thickness(0, 0, -5, 0); tblock1.FontWeight = FontWeights.Bold; tblock1.FontSize = tblock1.FontSize + 2; if (dashboardHelper.GetAllGroupsAsList().Contains(cbxExposureField.SelectedItem.ToString())) { tblock1.Text = value; } else { tblock1.Text = cbxExposureField.SelectedItem.ToString(); } tblock1.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; tblock1.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetColumn(tblock1, 0); Grid.SetRow(tblock1, 1); gridOuter.Children.Add(tblock1); TextBlock tblock2 = new TextBlock(); tblock2.Name = "tblockOutcomeGridHeader"; tblock2.FontWeight = FontWeights.Bold; tblock2.FontSize = tblock1.FontSize + 2; tblock2.Text = cbxOutcomeField.SelectedItem.ToString(); tblock2.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; tblock2.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetColumn(tblock2, 1); Grid.SetRow(tblock2, 0); gridOuter.Children.Add(tblock2); sv.Content = gridOuter; TextBlock txtDisclaimerLabel = new TextBlock(); txtDisclaimerLabel.Text = string.Empty; txtDisclaimerLabel.Margin = new Thickness(2, 8, 2, 10); txtDisclaimerLabel.HorizontalAlignment = HorizontalAlignment.Center; txtDisclaimerLabel.Tag = value; gridDisclaimerList.Add(txtDisclaimerLabel); crosstabPanel.Children.Add(sv); crosstabPanel.Children.Add(chiSquaregrid); crosstabPanel.Children.Add(txtDisclaimerLabel); if (string.IsNullOrEmpty(strataVar) && GadgetOptions.StrataVariableNames.Count == 0) { panelMain.Children.Add(crosstabPanel); } else { crosstabPanel.Margin = (Thickness)this.Resources["genericElementMargin"]; expander.Margin = (Thickness)this.Resources["expanderMargin"]; expander.IsExpanded = true; expander.Content = crosstabPanel; panelMain.Children.Add(expander); } strataChiSquareGridList.Add(chiSquaregrid); strataGridList.Add(grid); }
public void AddRow(StrataGridListRow strataGridListRow, bool addToTable = true) { if (addToTable) { if (table.Select("[" + table.Columns[0].ColumnName + "] = '" + strataGridListRow.StrataLabel.Replace("'", "''") + "'", "").Length > 0) { // don't add. return; } else { table.Rows.Add(strataGridListRow.StrataLabel, strataGridListRow.OutcomeRateExposure, strataGridListRow.OutcomeRateNoExposure, strataGridListRow.RiskRatio, strataGridListRow.OddsRatio, strataGridListRow.OddsLower, strataGridListRow.OddsUpper); } } grdMain.RowDefinitions.Add(new RowDefinition()); grdMain.RowDefinitions[grdMain.RowDefinitions.Count - 1].Height = GridLength.Auto; Rectangle r1 = new Rectangle(); r1.Style = this.Resources["gridCellRectangle"] as Style; Grid.SetColumn(r1, 0); Grid.SetColumnSpan(r1, 8); Grid.SetRow(r1, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(r1); r1.MouseEnter += new MouseEventHandler(rowDef_MouseEnter); r1.MouseLeave += new MouseEventHandler(rowDef_MouseLeave); r1.MouseUp += new MouseButtonEventHandler(rowDef_MouseUp); Border b1 = new Border(); b1.Style = this.Resources["gridCellBorder"] as Style; b1.BorderThickness = new Thickness(1, 0, 1, 1); b1.IsHitTestVisible = false; Grid.SetColumn(b1, 0); Grid.SetRow(b1, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b1); Border b2 = new Border(); b2.Style = this.Resources["gridCellBorder"] as Style; b2.IsHitTestVisible = false; Grid.SetColumn(b2, 1); Grid.SetRow(b2, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b2); Border b3 = new Border(); b3.Style = this.Resources["gridCellBorder"] as Style; b3.IsHitTestVisible = false; Grid.SetColumn(b3, 2); Grid.SetRow(b3, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b3); Border b4 = new Border(); b4.Style = this.Resources["gridCellBorder"] as Style; b4.IsHitTestVisible = false; Grid.SetColumn(b4, 3); Grid.SetRow(b4, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b4); Border b5 = new Border(); b5.Style = this.Resources["gridCellBorder"] as Style; b5.IsHitTestVisible = false; Grid.SetColumn(b5, 4); Grid.SetRow(b5, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b5); Border b6 = new Border(); b6.Style = this.Resources["gridCellBorder"] as Style; b6.IsHitTestVisible = false; Grid.SetColumn(b6, 5); Grid.SetRow(b6, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b6); Border b7 = new Border(); b7.Style = this.Resources["gridCellBorder"] as Style; b7.IsHitTestVisible = false; Grid.SetColumn(b7, 6); Grid.SetRow(b7, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(b7); TextBlock t1 = new TextBlock(); t1.Text = strataGridListRow.StrataLabel; t1.Margin = (Thickness)this.Resources["genericTextMargin"]; t1.IsHitTestVisible = false; Grid.SetColumn(t1, 0); Grid.SetRow(t1, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t1); TextBlock t2 = new TextBlock(); if (strataGridListRow.OutcomeRateExposure.HasValue) { t2.Text = strataGridListRow.OutcomeRateExposure.Value.ToString("F4"); } t2.Margin = (Thickness)this.Resources["genericTextMargin"]; t2.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t2.IsHitTestVisible = false; Grid.SetColumn(t2, 1); Grid.SetRow(t2, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t2); TextBlock t3 = new TextBlock(); if (strataGridListRow.OutcomeRateNoExposure.HasValue) { t3.Text = strataGridListRow.OutcomeRateNoExposure.Value.ToString("F4"); } t3.Margin = (Thickness)this.Resources["genericTextMargin"]; t3.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t3.IsHitTestVisible = false; Grid.SetColumn(t3, 2); Grid.SetRow(t3, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t3); TextBlock t4 = new TextBlock(); if (strataGridListRow.RiskRatio.HasValue) { t4.Text = strataGridListRow.RiskRatio.Value.ToString("F4"); } t4.Margin = (Thickness)this.Resources["genericTextMargin"]; t4.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t4.IsHitTestVisible = false; Grid.SetColumn(t4, 3); Grid.SetRow(t4, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t4); TextBlock t5 = new TextBlock(); if (strataGridListRow.OddsRatio.HasValue) { t5.Text = strataGridListRow.OddsRatio.Value.ToString("F4"); } t5.Margin = (Thickness)this.Resources["genericTextMargin"]; t5.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t5.IsHitTestVisible = false; Grid.SetColumn(t5, 4); Grid.SetRow(t5, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t5); TextBlock t6 = new TextBlock(); if (strataGridListRow.OddsLower.HasValue) { t6.Text = strataGridListRow.OddsLower.Value.ToString("F4"); } t6.Margin = (Thickness)this.Resources["genericTextMargin"]; t6.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t6.IsHitTestVisible = false; Grid.SetColumn(t6, 5); Grid.SetRow(t6, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t6); TextBlock t7 = new TextBlock(); if (strataGridListRow.OddsUpper.HasValue) { t7.Text = strataGridListRow.OddsUpper.Value.ToString("F4"); } t7.Margin = (Thickness)this.Resources["genericTextMargin"]; t7.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; t7.IsHitTestVisible = false; Grid.SetColumn(t7, 6); Grid.SetRow(t7, grdMain.RowDefinitions.Count - 1); grdMain.Children.Add(t7); }