public override void OnApplyTemplate() { _rootElement = GetTemplateChild(DataGridRow.DATAGRIDROW_elementRoot) as Panel; if (_expanderButton != null) { _expanderButton.Checked -= ExpanderButton_Checked; _expanderButton.Unchecked -= ExpanderButton_Unchecked; } _expanderButton = GetTemplateChild(DATAGRIDROWGROUPHEADER_expanderButton) as ToggleButton; if (_expanderButton != null) { EnsureExpanderButtonIsChecked(); _expanderButton.Checked += new RoutedEventHandler(ExpanderButton_Checked); _expanderButton.Unchecked += new RoutedEventHandler(ExpanderButton_Unchecked); } _headerElement = GetTemplateChild(DataGridRow.DATAGRIDROW_elementRowHeader) as DataGridRowHeader; if (_headerElement != null) { _headerElement.Owner = this; EnsureHeaderStyleAndVisibility(null); } _indentSpacer = GetTemplateChild(DATAGRIDROWGROUPHEADER_indentSpacer) as FrameworkElement; if (_indentSpacer != null) { _indentSpacer.Width = _totalIndent; } _itemCountElement = GetTemplateChild(DATAGRIDROWGROUPHEADER_itemCountElement) as TextBlock; _propertyNameElement = GetTemplateChild(DATAGRIDROWGROUPHEADER_propertyNameElement) as TextBlock; UpdateTitleElements(); }
// Token: 0x06005D39 RID: 23865 RVA: 0x001A3F1C File Offset: 0x001A211C private static object OnCoerceContentTemplateSelector(DependencyObject d, object baseValue) { DataGridRowHeader dataGridRowHeader = d as DataGridRowHeader; DataGridRow parentRow = dataGridRowHeader.ParentRow; DataGrid grandParentObject = (parentRow != null) ? parentRow.DataGridOwner : null; return(DataGridHelper.GetCoercedTransferPropertyValue(dataGridRowHeader, baseValue, ContentControl.ContentTemplateSelectorProperty, parentRow, DataGridRow.HeaderTemplateSelectorProperty, grandParentObject, DataGrid.RowHeaderTemplateSelectorProperty)); }
// Token: 0x06005D42 RID: 23874 RVA: 0x001A40F8 File Offset: 0x001A22F8 private static object OnCoerceIsRowSelected(DependencyObject d, object baseValue) { DataGridRowHeader dataGridRowHeader = (DataGridRowHeader)d; DataGridRow parentRow = dataGridRowHeader.ParentRow; if (parentRow != null) { return(parentRow.IsSelected); } return(baseValue); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.wrap = ((System.Windows.Controls.WrapPanel)(target)); #line 15 "..\..\OptionWindow.xaml" this.wrap.AddHandler(System.Windows.FrameworkContentElement.LoadedEvent, new System.Windows.RoutedEventHandler(this.Wrap_Loaded)); #line default #line hidden return; case 2: this.the = ((System.Windows.Controls.DataGrid)(target)); return; case 3: this.qe = ((System.Windows.Controls.Primitives.DataGridRowHeader)(target)); return; case 4: this.qsds = ((System.Windows.Controls.Primitives.DataGridRowHeader)(target)); return; case 5: this.one = ((System.Windows.Controls.DataGridRow)(target)); return; case 6: this.two = ((System.Windows.Controls.DataGridRow)(target)); return; case 7: this.three = ((System.Windows.Controls.DataGridRow)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Builds the visual tree for the column header when a new template is applied. /// </summary> public override void OnApplyTemplate() { this.RootElement = GetTemplateChild(DATAGRIDROW_elementRoot) as Panel; // if (this.RootElement != null) { EnsureBackground(); ApplyState(false /*animate*/); } bool updateVerticalScrollBar = false; if (this._cellsElement != null) { // If we're applying a new template, we want to remove the cells from the previous _cellsElement this._cellsElement.Children.Clear(); updateVerticalScrollBar = true; } this._cellsElement = GetTemplateChild(DATAGRIDROW_elementCells) as DataGridCellsPresenter; if (this._cellsElement != null) { this._cellsElement.OwningRow = this; // Cells that were already added before the Template was applied need to // be added to the Canvas if (this.Cells.Count > 0) { foreach (DataGridCell cell in this.Cells) { this._cellsElement.Children.Add(cell); } } } _detailsElement = GetTemplateChild(DATAGRIDROW_elementDetails) as DataGridDetailsPresenter; if (_detailsElement != null && this.OwningGrid != null) { _detailsElement.OwningRow = this; if (this.ActualDetailsVisibility == Visibility.Visible && this.ActualDetailsTemplate != null && this._appliedDetailsTemplate == null) { // Apply the DetailsTemplate now that the row template is applied. SetDetailsVisibilityInternal(this.ActualDetailsVisibility, _detailsVisibilityNotificationPending /*raiseNotification*/, false /*animate*/); _detailsVisibilityNotificationPending = false; } } _bottomGridLine = GetTemplateChild(DATAGRIDROW_elementBottomGridLine) as Rectangle; EnsureGridLines(); _headerElement = GetTemplateChild(DATAGRIDROW_elementRowHeader) as DataGridRowHeader; if (_headerElement != null) { _headerElement.Owner = this; if (this.Header != null) { _headerElement.Content = Header; } EnsureHeaderStyleAndVisibility(null); } // The height of this row might have changed after applying a new style, so fix the vertical scroll bar if (this.OwningGrid != null && updateVerticalScrollBar) { this.OwningGrid.UpdateVerticalScrollBar(); } }
/// <summary> /// AutomationPeer for DataGridRowHeader /// </summary> /// <param name="owner">DataGridRowHeader</param> public DataGridRowHeaderAutomationPeer(DataGridRowHeader owner) : base(owner) { }
public void Load() { _resultHeaderTags = TagCollection.VirtualTags.Where((dt) => dt.Group.Any((gr) => gr.ToLower().Contains("result"))).ToArray(); _resultValueTags = TagCollection.DataTags.Where((dt) => dt.Group.Any((gr) => gr.ToLower().Contains("result"))).ToArray(); _resultSigmaTags = TagCollection.DataTags.Where((dt) => dt.Group.Any((gr) => gr.ToLower().Contains("sigma"))).ToArray(); _cells = new List<List<ResultCell>>(); //getting the number of columns foreach (DataTag tag in _resultValueTags) { //number of columns is equal to the highest number in the 'testpointX' data tags var tpNum = Regex.Match(tag.Name, @"[\d+]"); if (tpNum.Success) numCols = Math.Max(numCols, Convert.ToByte(tpNum.Value)); } //add one row to the grid for the column headers var rowOne = new RowDefinition(); rowOne.Name = "columnHeaders"; rowOne.Height = GridLength.Auto; resultsGrid.RowDefinitions.Add(rowOne); numRows++; //add one column to the grid for the row headers var colOne = new ColumnDefinition(); colOne.Width = GridLength.Auto; resultsGrid.ColumnDefinitions.Add(colOne); numCols++; //adding the columns to the grid for (int i = 1; i < numCols; i++) { var col = new ColumnDefinition(); col.Name = "Header" + i.ToString(); resultsGrid.ColumnDefinitions.Add(col); ResultsHeader headerBox = new ResultsHeader(); headerBox.HeaderText = i.ToString(); DataGridColumnHeader columnHeader = new DataGridColumnHeader(); columnHeader.HorizontalContentAlignment = HorizontalAlignment.Stretch; columnHeader.VerticalContentAlignment = VerticalAlignment.Stretch; columnHeader.Content = headerBox; Grid.SetColumn(columnHeader, i); Grid.SetRow(columnHeader, 0); resultsGrid.Children.Add(columnHeader); } //adding the rows and row headers foreach (DataTag tag in _resultHeaderTags) { RowDefinition rowDef = new RowDefinition(); rowDef.Height = GridLength.Auto; rowDef.Name = tag.Name.Split('.').Last(); //So I can find it later, regex removes all non alpha chars resultsGrid.RowDefinitions.Add(rowDef); ResultsHeader headerBox = new ResultsHeader(); headerBox.HeaderText = tag.Description; //headerBox.headerText.HorizontalAlignment = HorizontalAlignment.Left; headerBox.HorizontalAlignment = HorizontalAlignment.Stretch; DataGridRowHeader rowHeader = new DataGridRowHeader(); rowHeader.HorizontalContentAlignment = HorizontalAlignment.Stretch; rowHeader.VerticalContentAlignment = VerticalAlignment.Stretch; rowHeader.HorizontalAlignment = HorizontalAlignment.Stretch; rowHeader.Content = headerBox; Grid.SetRow(rowHeader, resultsGrid.RowDefinitions.Count - 1); Grid.SetColumn(rowHeader, 0); resultsGrid.Children.Add(rowHeader); numRows++; } //adding the result cells for (int row = 0; row < numRows; row++) { if (row == 0) { _cells.Add(null); continue; } else _cells.Add(new List<ResultCell>()); for (int col = 0; col < numCols; col++) { if (col == 0) { _cells[row].Add(null); continue; } var cell = new ResultCell(); Grid.SetColumn(cell, col); Grid.SetRow(cell, row); _cells[row].Add(cell); resultsGrid.Children.Add(cell); } } //creating the highlight and setting it's length _highlight = new Rectangle(); _highlight.Fill = new SolidColorBrush(Color.FromArgb(255 / 2, 255, 255, 0)); _highlight.Visibility = Visibility.Hidden; resultsGrid.Children.Add(_highlight); Grid.SetRowSpan(_highlight, numRows); Grid.SetZIndex(_highlight, 2); // must be between 0 and 5 curTestPoint = TagCollection.Get("CurrentTestPoint"); curTestPoint.ValueSet += curTestPoint_ValueSet; curTestPoint.ValueChanged += curTestPoint_ValueSet; //keeping the result values updated foreach (DataTag result in _resultValueTags) { result.ValueChanged += result_ValueChanged; result.ValueSet += result_ValueChanged; } foreach (DataTag sigma in _resultSigmaTags) { sigma.ValueChanged += result_ValueChanged; sigma.ValueSet += result_ValueChanged; } }
// Token: 0x06005D3B RID: 23867 RVA: 0x001A3F94 File Offset: 0x001A2194 private static object OnCoerceWidth(DependencyObject d, object baseValue) { DataGridRowHeader dataGridRowHeader = d as DataGridRowHeader; return(DataGridHelper.GetCoercedTransferPropertyValue(dataGridRowHeader, baseValue, FrameworkElement.WidthProperty, dataGridRowHeader.DataGridOwner, DataGrid.RowHeaderWidthProperty)); }
// Token: 0x06005D37 RID: 23863 RVA: 0x001A3EB0 File Offset: 0x001A20B0 private static object OnCoerceContent(DependencyObject d, object baseValue) { DataGridRowHeader dataGridRowHeader = d as DataGridRowHeader; return(DataGridHelper.GetCoercedTransferPropertyValue(dataGridRowHeader, baseValue, ContentControl.ContentProperty, dataGridRowHeader.ParentRow, DataGridRow.HeaderProperty)); }