private void ExampleGrid_OnRowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e) { // get the object that the user has selected and cast it as a Company object var selectedCompany = this.exampleGrid.SelectedItem as Company; // if the selected item is a company and the company has some location records if (selectedCompany != null) { // get the details element of the main DataGrid and cast it to a StackPanel var panel = e.DetailsElement as StackPanel; if (panel != null) { // just be sure that the panel does have two children that are datagrids... if (panel.Children.Count >= 2) { DataGrid innerGrid = panel.Children[0] as DataGrid; if ((innerGrid != null) && (selectedCompany.Locations != null)) { innerGrid.ItemsSource = selectedCompany.Locations; } DataGrid staffGrid = panel.Children[1] as DataGrid; if ((staffGrid != null) && (selectedCompany.Staff != null)) { staffGrid.ItemsSource = selectedCompany.Staff; } } } } }
private void GridTaxOfficesRowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e) { var gridUsers = (DataGrid)e.DetailsElement; if (e.Row.Visibility != Visibility.Visible || gridUsers.ItemsSource != null) return; iTRAACHelpers.WpfDataGridStandardBehavior(gridUsers); //whack:gridUsers.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(gridUsers_MouseLeftButtonDown); gridUsers.ItemsSource = TaxOfficeModel.OfficeUsers(e.Row.DataContext); }
private void dataGrid_RowDetailsVisibilityChanged(object sender, Control.DataGridRowDetailsEventArgs e) { WPFdataGrid.DataGridControl dataGrid = elementHost1.Child as WPFdataGrid.DataGridControl; Control.DataGrid grid = dataGrid.grid; Control.DataGrid data = e.DetailsElement.FindName("details") as Control.DataGrid; Control.DataGridRow dataRow = e.Row as Control.DataGridRow; PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(dataRow.Item); var PName = properties["PName"]?.GetValue(dataRow.Item)?.ToString(); using (Pokemon db = new Pokemon()) { if (detailsObservable == null || !(detailsObservable.Any(p => p.PName == PName)) && db.PokemonBaseStats.Any(p => p.PName == PName)) { var monsterDetails = (from p in db.PokemonBaseStats select p.PokemonCapRate).ToList(); foreach (var monster in monsterDetails) { detailsObservable.Add(monster); } ListCollectionView detailsView = new ListCollectionView(detailsObservable); detailsView.Filter = (p) => { PokemonCapRate capRate = p as PokemonCapRate; if (capRate.PName == PName) { return(true); } return(false); }; if (!(monsterDetails == null)) { data.ItemsSource = detailsView; } } else { data.ItemsSource = (from p in detailsObservable where p.PName == PName select p).ToList(); } } data.IsReadOnly = grid.IsReadOnly; data.SelectedIndex = -1; data.CellEditEnding += new EventHandler <Control.DataGridCellEditEndingEventArgs>(detailGrid_CellValueChanged); }
private void dataGrid1_RowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e) { DataGridRow row = e.Row as DataGridRow; FrameworkElement tb = GetTemplateChildByName(row, "RowHeaderToggleButton"); if (tb != null) { if (row.DetailsVisibility == System.Windows.Visibility.Visible) { (tb as ToggleButton).IsChecked = true; } else { (tb as ToggleButton).IsChecked = false; } } }
protected internal virtual new void OnRowDetailsVisibilityChanged(DataGridRowDetailsEventArgs e) { Contract.Requires(e != null); }
private void EmpDataGrid_RowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e) { }
void DtGrid_LoadingRowDetails(object sender, DataGridRowDetailsEventArgs e) { T_HR_CUSTOMGUERDONRECORD sr = e.Row.DataContext as T_HR_CUSTOMGUERDONRECORD; SalaryContrast getdgdetail = Utility.FindChildControl<SalaryContrast>(DtGrid, "dgdetail"); if (sr.EMPLOYEEID != string.Empty && sr.SALARYYEAR != string.Empty && sr.SALARYMONTH != string.Empty) { string months = sr.SALARYMONTH; string years = sr.SALARYYEAR; if (sr.SALARYMONTH == "1") { years = (Convert.ToInt32(years) - 1).ToString(); months = "12"; } else { months = (Convert.ToInt32(months) - 1).ToString(); } getdgdetail.FlashData(sr.EMPLOYEEID, years, months, SalaryGenerateType.CustomSalaryRecord); } else { getdgdetail.Visibility = Visibility.Collapsed; } }
void DtGrid_LoadingRowDetails(object sender, DataGridRowDetailsEventArgs e) { DataGrid gridDetails = e.DetailsElement as DataGrid; T_HR_EMPLOYEESALARYRECORD sr = e.Row.DataContext as T_HR_EMPLOYEESALARYRECORD; if (sr.EMPLOYEEID != string.Empty && sr.SALARYYEAR != string.Empty && sr.SALARYMONTH != string.Empty) { string months = sr.SALARYMONTH; string years = sr.SALARYYEAR; if (sr.SALARYMONTH == "1") { years = (Convert.ToInt32(years) - 1).ToString(); months = "12"; } else { months = (Convert.ToInt32(months) - 1).ToString(); } SalaryServiceClient clienttemp = new SalaryServiceClient(); clienttemp.GetSalaryRecordOneCompleted += (o, ev) => { if (ev.Error == null) { if (ev.Result != null) { List<T_HR_EMPLOYEESALARYRECORD> salaryrecordlast = new List<T_HR_EMPLOYEESALARYRECORD>(); salaryrecordlast.Add(ev.Result); gridDetails.ItemsSource = salaryrecordlast; gridDetails.Visibility = Visibility.Visible; } else { gridDetails.Visibility = Visibility.Collapsed; } } else { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ev.Error.Message)); } }; clienttemp.GetSalaryRecordOneAsync(sr.EMPLOYEEID, years, months); } else { gridDetails.Visibility = Visibility.Collapsed; } }
private void DataGrid_LoadingRowDetails(object sender, DataGridRowDetailsEventArgs e) { }
internal void OnUnloadingRowDetailsWrapper(DataGridRow row) { if (row != null && row.DetailsLoaded == true && row.DetailsPresenter != null) { DataGridRowDetailsEventArgs e = new DataGridRowDetailsEventArgs(row, row.DetailsPresenter.DetailsElement); OnUnloadingRowDetails(e); row.DetailsLoaded = false; } }
private void NotificationView_RowDetailsVisibilityChanged( object sender, DataGridRowDetailsEventArgs e ) { Notification notification = NotificationView.SelectedValue as Notification; if ( notification != null && String.IsNullOrEmpty( notification.Message ) ) e.DetailsElement.Visibility = Visibility.Collapsed; else e.DetailsElement.Visibility = Visibility.Visible; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgEDetails_RowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e) { DataGrid grid = e.DetailsElement as DataGrid; int count; if (grid.ItemsSource != null) { count = grid.ItemsSource.OfType<object>().Count(); if (count == 0) grid.Visibility = System.Windows.Visibility.Collapsed; } else grid.Visibility = System.Windows.Visibility.Collapsed; }
// #endregion Public Methods #region Protected Methods /// <summary> /// Raises the <see cref="E:System.Windows.Controls.DataGrid.RowDetailsVisibilityChanged" /> event. /// </summary> /// <param name="e">The event data.</param> protected internal virtual void OnRowDetailsVisibilityChanged(DataGridRowDetailsEventArgs e) { EventHandler<DataGridRowDetailsEventArgs> handler = this.RowDetailsVisibilityChanged; if (handler != null) { handler(this, e); } }
void DaGrHR_LoadingRowDetails(object sender,DataGridRowDetailsEventArgs e) { if (e.Row.DataContext != null) { //DaGrHR.Columns.Add(); } }
private void MainDataGrid_LoadingRowDetails(object sender, DataGridRowDetailsEventArgs e) { MainDataGrid.UpdateLayout(); MainDataGrid.UpdateDefaultStyle(); MainDataGrid.Items.Refresh(); }
/// <summary> /// Occurs when the character datagrid is clicked. /// Displays selected character info in its row details. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void characterDataGrid_RowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e) { AddSelectedRowToRowDetails(e.Row.GetIndex()); var innerDataGrid = e.DetailsElement as DataGrid; if (innerDataGrid != null) { innerDataGrid.CanUserAddRows = charactersDataGrid.CanUserDeleteRows; innerDataGrid.CanUserDeleteRows = charactersDataGrid.CanUserDeleteRows; innerDataGrid.CanUserResizeRows = charactersDataGrid.CanUserResizeRows; innerDataGrid.IsReadOnly = charactersDataGrid.IsReadOnly; innerDataGrid.ItemsSource = ((IListSource)_rowDetailsTable).GetList(); } }
protected virtual new void OnUnloadingRowDetails(DataGridRowDetailsEventArgs e) { }
/// <summary> /// Invokes the RowDetailsVisibilityChanged event /// </summary> protected internal virtual void OnRowDetailsVisibilityChanged(DataGridRowDetailsEventArgs e) { if (RowDetailsVisibilityChanged != null) { RowDetailsVisibilityChanged(this, e); } var row = e.Row; // LoadingRowDetails only needs to be called when row.DetailsVisibility == Visibility.Visible. // OnLoadingRowDetailsWrapper already makes this check, so we omit it here. // // No need to used DelayedOnLoadingRowDetails because OnRowDetailsVisibilityChanged isn't called until after the // template is expanded. OnLoadingRowDetailsWrapper(row); }
internal void OnLoadingRowDetailsWrapper(DataGridRow row) { if (row != null && row.DetailsLoaded == false && row.DetailsVisibility == Visibility.Visible && row.DetailsPresenter != null) { DataGridRowDetailsEventArgs e = new DataGridRowDetailsEventArgs(row, row.DetailsPresenter.DetailsElement); OnLoadingRowDetails(e); row.DetailsLoaded = true; } }
/// <summary> /// Invokes the UnloadingRowDetails event /// </summary> protected virtual void OnUnloadingRowDetails(DataGridRowDetailsEventArgs e) { if (UnloadingRowDetails != null) { UnloadingRowDetails(this, e); } }
/// <summary> /// Notifies the DataGrid that the visibility is changed. This is intended to be Invoked at lower than Layout priority to give the template time to expand. /// </summary> private static object DelayedRowDetailsVisibilityChanged(object arg) { var row = (DataGridRow)arg; var dataGrid = row.DataGridOwner; var detailsElement = row.DetailsPresenter != null ? row.DetailsPresenter.DetailsElement : null; if (dataGrid != null) { var detailsEventArgs = new DataGridRowDetailsEventArgs(row, detailsElement); dataGrid.OnRowDetailsVisibilityChanged(detailsEventArgs); } return null; }
/// <summary> /// Raises the UnloadingRowDetails event /// </summary> protected virtual void OnUnloadingRowDetails(DataGridRowDetailsEventArgs e) { EventHandler<DataGridRowDetailsEventArgs> handler = this.UnloadingRowDetails; if (handler != null) { this.LoadingOrUnloadingRow = true; handler(this, e); this.LoadingOrUnloadingRow = false; } }