public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { bool isMouseOver = (bool)values[0]; if (isMouseOver == false) { return(false); } FrameworkElement element = values[1] as FrameworkElement; if (element == null) { return(false); } object selected_obj = values[2]; DevExpress.Xpf.Grid.EditGridCellData cell_data = element.DataContext as DevExpress.Xpf.Grid.EditGridCellData; if (cell_data == null) { return(false); } object target_obj = cell_data.RowData.Row; return(isMouseOver && (selected_obj == target_obj)); } catch { return(false); } }
private void data_ContentChanged(object sender, EventArgs e) { DevExpress.Xpf.Grid.EditGridCellData data = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData; if (data != null) { this.RowIndex = (data.RowData.ControllerVisibleIndex + 1).ToString(); } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); DevExpress.Xpf.Grid.EditGridCellData data = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData; if (data != null) { data.ContentChanged -= new EventHandler(data_ContentChanged); data.ContentChanged += new EventHandler(data_ContentChanged); this.RowIndex = (data.RowData.ControllerVisibleIndex + 1).ToString(); } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); DevExpress.Xpf.Grid.EditGridCellData data = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData; data.ContentChanged -= new EventHandler(data_ContentChanged); data.ContentChanged += new EventHandler(data_ContentChanged); this.updateWidth(data); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); DevExpress.Xpf.Grid.EditGridCellData data = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData; if (data != null) { System.Windows.Controls.Control control = null; control = data.View.GetAncestorByType <GridView>(); if (control == null) { //control = data.View.GetAncestorByType<TreeView>(); } if (control != null) { Binding b = new Binding(); b.Source = control; b.Path = new System.Windows.PropertyPath("SearchText"); this.SetBinding(GridViewHighlightLabel.HighlightTextProperty, b); } } }
private void PART_DetailButton_Click(object sender, RoutedEventArgs e) { DevExpress.Xpf.Grid.EditGridCellData data = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData; List <GridViewDetailInfo> list = new List <GridViewDetailInfo>(); if (data.RowData.Row != null) { Type rowType = data.RowData.Row.GetType(); bool isfoler = false; if (rowType.Name == "FileX" || rowType.Name == "FileEntity") { string proName = string.Empty; if (rowType.Name == "FileX") { proName = "Type"; } else if (rowType.Name == "FileEntity") { proName = "ProxyFileX.Type"; } string filetype = this._GetValue(rowType, proName, data.RowData.Row); if (filetype == "Folder") { isfoler = true; } } foreach (DevExpress.Xpf.Grid.GridColumnData c in data.RowData.CellData) { if (this.IsFilterNullOrWhiteSpaceFild && c.Column.Header.ToSafeString().IsNullOrEmptyOrWhiteSpace()) { continue; } GridViewDetailInfo detailInfo = new GridViewDetailInfo(); detailInfo.Label = c.Column.Header.ToSafeString(); detailInfo.Text = this._GetValue(rowType, c.Column.FieldName, data.RowData.Row); if (detailInfo.Label == "物理大小" || detailInfo.Label == "逻辑大小") { if (isfoler) { detailInfo.Text = string.Empty; } else { long t; bool b = long.TryParse(detailInfo.Text, out t); if (b) { detailInfo.Text = System.Utility.Helper.File.GetFileSize(t); } } } list.Add(detailInfo); } var exifInfoDetails = ReadExifInfos(data.RowData.Row); if (exifInfoDetails.IsValid()) { list.AddRange(exifInfoDetails); } } else { foreach (DevExpress.Xpf.Grid.GridColumnData c in data.RowData.CellData) { if (this.IsFilterNullOrWhiteSpaceFild && c.Column.Header.ToSafeString().IsNullOrEmptyOrWhiteSpace()) { continue; } list.Add(new GridViewDetailInfo { Label = c.Column.Header.ToSafeString(), Text = string.Empty }); } } Window window = null; if (GetDetailWindow != null) { window = GetDetailWindow(); } else { window = new Window(); } GridViewDetailControl detail = new GridViewDetailControl { ItemsSource = list }; window.Content = detail; window.Owner = Window.GetWindow(data.View); window.ShowDialog(); }
private void data_ContentChanged(object sender, EventArgs e) { DevExpress.Xpf.Grid.EditGridCellData data = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData; this.updateWidth(data); }
private void updateWidth(DevExpress.Xpf.Grid.EditGridCellData data) { this.Width = data.RowData.Level * this.RowIndent; //(data.RowData.View as DevExpress.Xpf.Grid.TreeListView).ExpandNode(data.RowData.RowHandle.Value); }