public override ImageSource Select(DevExpress.Xpf.Grid.TreeList.TreeListRowData rowData)
        {
            FileSystemItemModelBase item = rowData.Row as FileSystemItemModelBase;

            if (item == null)
            {
                return(null);
            }
            return(GetImageByFileItemType(item.ItemType, rowData.Node.IsExpanded, item.HasChildren()));
        }
        public override System.Windows.Media.ImageSource Select(DevExpress.Xpf.Grid.TreeList.TreeListRowData rowData)
        {
            Employee empl = (rowData.Row as Employee);

            if (empl == null)
            {
                return(null);
            }
            return(GetImageByGroupName(empl.GroupName));
        }
示例#3
0
        public override ImageSource Select(DevExpress.Xpf.Grid.TreeList.TreeListRowData rowData)
        {
            if (rowData == null || rowData.Row == null)
            {
                return(base.Select(rowData));
            }

            var type = rowData.Row.GetType();

            if (!_getImageStrategies.ContainsKey(type))
            {
                return(base.Select(rowData));
            }

            return(_getImageStrategies[type](rowData.Row));
        }
示例#4
0
 private void updateWidth()
 {
     if (!this.IsUseXlyRowIndent)
     {
         return;
     }
     this.Dispatcher.BeginInvoke(new EventHandler <EventArgs>((o, a) =>
     {
         try
         {
             double max_width = 0;
             foreach (DevExpress.Xpf.Grid.RowControl row in this.HierarchyPanel.Children)
             {
                 if (!row.IsVisible)
                 {
                     continue;
                 }
                 DevExpress.Xpf.Grid.TreeList.TreeListRowData rowData = row.DataContext as DevExpress.Xpf.Grid.TreeList.TreeListRowData;
                 object value     = rowData.Row.GetType().GetProperty(this.XlyRowPropertyName).GetValue(rowData.Row);
                 FormattedText ft = new FormattedText(value.ToSafeString(),
                                                      System.Globalization.CultureInfo.CurrentUICulture,
                                                      System.Windows.FlowDirection.LeftToRight,
                                                      new Typeface((FontFamily)TextElement.GetFontFamily(this),
                                                                   (FontStyle)TextElement.GetFontStyle(this),
                                                                   (FontWeight)TextElement.GetFontWeight(this),
                                                                   (FontStretch)TextElement.GetFontStretch(this)),
                                                      (double)TextElement.GetFontSize(this),
                                                      (Brush)TextElement.GetForeground(this));
                 double current_width = ft.Width + this.XlyRowIndent * rowData.Level + this.XlyRowIndentOffset;
                 if (max_width < current_width)
                 {
                     max_width = current_width;
                 }
             }
             this.treeList.Columns[0].Width = max_width;
         }
         catch (Exception ex)
         {
             LogHelper.Error("树展开时出错", ex);
         }
     }), System.Windows.Threading.DispatcherPriority.ApplicationIdle, new object[] { null, null });
 }
        public override ImageSource Select(DevExpress.Xpf.Grid.TreeList.TreeListRowData rowData)
        {
            var fileSystemItem = rowData.Row as FileSystemItem;

            return(ImagesHelper.GetImage(fileSystemItem));
        }