コード例 #1
0
        public void RowsTextColorCustomProvider()
        {
            var teams   = Util.GetTeams();
            var palette = new PaletteProvider();

            //it will not hit below lines because of not displayed on UI. Needs to be handled on UI test
            palette.OnColorRequested += (i, o) => {
                Assert.IsTrue(i < teams.Count && teams.ElementAt(i) == o);
                return((i % 2 == 0) ? Color.Black : Color.DarkGray);
            };

            var dg = new DataGrid {
                RowsTextColorPalette = palette,
                ItemsSource          = teams,
            };

            Assert.IsTrue(dg.RowsTextColorPalette == palette);
        }
コード例 #2
0
        public static void ApplyColorScheme(C1FlexGrid grid, ColorScheme cs)
        {
            var c = PaletteProvider.GetPalette(cs);

            if (c != null)
            {
                grid.RowBackground =
                    grid.AlternatingRowBackground   =
                        grid.CursorBackground       =
                            grid.EditorBackground   = new SolidColorBrush(Colors.Transparent);
                grid.TopLeftCellBackground          = new SolidColorBrush(c[0]);
                grid.RowHeaderBackground            = new SolidColorBrush(c[1]);
                grid.RowHeaderSelectedBackground    = new SolidColorBrush(c[2]);
                grid.ColumnHeaderBackground         = CreateGradientBrush(c[3], c[4]);
                grid.ColumnHeaderSelectedBackground = CreateGradientBrush(c[5], c[6]);
                grid.GridLinesBrush       = new SolidColorBrush(c[7]);;
                grid.HeaderGridLinesBrush = new SolidColorBrush(c[8]);
                grid.SelectionBackground  = new SolidColorBrush(c[9]);
            }
        }