Example #1
0
        private void MainGrid_CellFormatting(object sender, GridCellFormatEventArgs e)
        {
            var item = e.Item as LogModel;

            var settings = ViewModel.GetGridHighlightSettings();

            if (Eto.Platform.Instance.IsMac)
            {
                if (_selectionChanging && e.Item == ViewModel.SelectedLine)
                {
                    e.BackgroundColor = SystemColors.Highlight;
                    e.ForegroundColor = SystemColors.HighlightText;
                    return;
                }
            }

            if (Eto.Platform.Instance.IsWpf)
            {
                e.KeepHighlightWpf = true;
            }

            foreach (var colorTextItem in settings.GroupBy(m => m.RowQueryText).Select(m => m.First()))
            {
                if (colorTextItem.RowQueryText == string.Empty)
                {
                    continue;
                }

                if (item.Line.Contains(colorTextItem.RowQueryText))
                {
                    e.BackgroundColor = colorTextItem.BackgroundColor;
                    e.ForegroundColor = colorTextItem.ForegroundColor;
                }
            }
        }
Example #2
0
        private void grid_CellFormatting(object sender, GridCellFormatEventArgs e)
        {
            var col      = (MyGridColumn)e.Column;
            var cellData = col.CellBinding.GetValue(e.Item);

            e.BackgroundColor = cellData.Color;
        }
        private void MainGrid_CellFormatting(object sender, GridCellFormatEventArgs e)
        {
            if (e.Column == ColorColumn)
            {
                var item = e.Item as HighlightConfig;


                e.ForegroundColor = item.ForegroundColor;
                e.BackgroundColor = item.BackgroundColor;
                e.Font            = new Font(SystemFont.TitleBar, 12);
            }
        }
Example #4
0
        private void fileView_CellFormatting(object sender, GridCellFormatEventArgs e)
        {
            if (e.Item == null)
            {
                return;
            }

            var element   = (FileElement)e.Item;
            var isChanged = element.ArchiveFileInfo.ContentChanged || _stateInfo.ArchiveChildren.Where(x => x.StateChanged).Any(x => x.FilePath == element.ArchiveFileInfo.FilePath);

            e.ForegroundColor = isChanged ? ColorChangedState : ColorDefaultState;
        }
Example #5
0
        private void folderView_CellFormatting(object sender, GridCellFormatEventArgs e)
        {
            if (e.Item == null)
            {
                return;
            }

            var gridItem = (TreeGridItem)e.Item;
            var path     = GetAbsolutePath(gridItem);

            e.ForegroundColor = _changedDirectories.Contains(path) ? ColorChangedState : ColorDefaultState;
        }
Example #6
0
        // Styling - set tree grid items to be bold if they or any children are selected
        void _OnFormatCell(object sender, GridCellFormatEventArgs e)
        {
            switch (e.Column.HeaderText)
            {
            case TagTypeLabel:
                var checkItem = e.Item as OSMTreeGridItem;
                var isSelectedOrHasChildSelected = false;

                if (checkItem.IsSelected())
                {
                    isSelectedOrHasChildSelected = true;
                }
                else if (checkItem.Children.Count > 0)
                {
                    foreach (OSMTreeGridItem child in checkItem.Children)
                    {
                        if (child.IsSelected())
                        {
                            isSelectedOrHasChildSelected = true;
                            break;
                        }
                    }
                }

                if (isSelectedOrHasChildSelected)
                {
                    e.Font = new Font(SystemFont.Bold);
                }
                else
                {
                    e.Font = new Font(SystemFont.Default);
                }
                break;

            case TagWikiLabel:
                e.ForegroundColor = new ColorHSL(230f, 1.0f, 0.5f);
                break;

            case TagKVLabel:
                e.ForegroundColor = new ColorHSL(0f, 0f, 0.33f);
                e.Font            = new Font(FontFamilies.Sans, 8.0f, FontStyle.None);
                break;

            case "Description":
                e.Font = new Font(FontFamilies.Sans, 8.0f, FontStyle.Italic);
                break;
            }
        }
Example #7
0
        void PropertyGridView_CellFormatting(object sender, GridCellFormatEventArgs e)
        {
            PropertyPOCO poco = e.Item as PropertyPOCO;

            if (poco != null)
            {
                if (poco.Group)
                {
                    if (e.Font != null)
                    {
                        e.Font = new Font(e.Font.FamilyName, e.Font.Size, FontStyle.Bold);
                    }
                    e.BackgroundColor = Colors.LightGrey;
                    if (e.Column.DataCell.GetType() == typeof(PropertyCustomCheckCell))
                    {
                        PropertyCustomCheckCell cell = e.Column.DataCell as PropertyCustomCheckCell;
                        if (cell != null)
                        {
                            CheckBox checkBox = cell.checkBox as CheckBox;
                            if (checkBox != null)
                            {
                                checkBox.Visible = false;
                            }
                        }
                    }
                }
                else
                {
                    if (e.Font != null)
                    {
                        e.Font = new Font(e.Font.FamilyName, e.Font.Size, FontStyle.None);
                    }
                    if (e.Column.DataCell.GetType() == typeof(PropertyCustomCheckCell))
                    {
                        PropertyCustomCheckCell cell = e.Column.DataCell as PropertyCustomCheckCell;
                        if (cell != null)
                        {
                            CheckBox checkBox = cell.checkBox as CheckBox;
                            if (checkBox != null)
                            {
                                checkBox.Visible = true;
                            }
                        }
                    }
                }
            }
        }
Example #8
0
 private void grid_CellFormatting(object sender, GridCellFormatEventArgs e)
 {
     try
     {
         var col      = (CommonalityGridColumn)e.Column;
         var cellData = col.CellBinding.GetValue(e.Item);
         // Can get a crash here with rapid resize due to grid view lagging display because cellData can be null
         if (cellData != null)
         {
             e.BackgroundColor = cellData.CellColor;
             e.ForegroundColor = inverseColor(e.BackgroundColor);
         }
     }
     catch (Exception)
     {
     }
 }
Example #9
0
        void PropertyGridView_CellFormatting(object sender, GridCellFormatEventArgs e)
        {
            PropertyPOCO poco = e.Item as PropertyPOCO;

            if (poco != null)
            {
                if (poco.Group)
                {
                    if (e.Font != null)
                    {
                        e.Font = new Font(e.Font.FamilyName, e.Font.Size, FontStyle.Bold);
                    }
                    e.BackgroundColor = Colors.LightGrey;
                }
                else
                {
                    if (e.Font != null)
                    {
                        e.Font = new Font(e.Font.FamilyName, e.Font.Size, FontStyle.None);
                    }
                }
            }
        }
Example #10
0
 public void OnCellFormatting(GridCellFormatEventArgs args)
 {
     Callback.OnCellFormatting(Widget, args);
 }
Example #11
0
 public void OnCellFormatting(GridCellFormatEventArgs args)
 {
     Widget.OnCellFormatting(args);
 }
Example #12
0
 public void Format(GridCellFormatEventArgs args)
 {
     Source.OnCellFormatting(args);
 }
Example #13
0
 /// <summary>
 /// Raises the cell formatting event.
 /// </summary>
 public void OnCellFormatting(Grid widget, GridCellFormatEventArgs e)
 {
     using (widget.Platform.Context)
         widget.OnCellFormatting(e);
 }