private void DataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == 4 && e.CellValue == null)
         {
             e.Style.BackgroundColor = Color.IndianRed;
             e.Style.ForegroundColor = Color.White;
         }
         else if (e.ColumnIndex == 4 && int.Parse(e.CellValue.ToString()) >= 0)
         {
             e.Style.BackgroundColor = Color.YellowGreen;
             e.Style.ForegroundColor = Color.White;
         }
         
         e.Handled = true;
     }
     catch
     {
         if (e.ColumnIndex == 4)
         {
             e.Style.BackgroundColor = Color.IndianRed;
             e.Style.ForegroundColor = Color.White;
             e.Handled = true;
         }
     }
 }
예제 #2
0
 private void DataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
 {
     if (e.Column.MappingName == "Name")
     {
         e.Style.FontAttribute = FontAttributes.Bold;
         e.Handled             = true;
     }
 }
예제 #3
0
 private void DataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
 {
     if (e.ColumnIndex == 4)
     {
         e.Style.BackgroundColor = Color.FromRgb(225, 245, 254);
     }
     e.Handled = true;
 }
예제 #4
0
        //protected override void OnAppearing()
        //{
        //    base.OnAppearing();
        //    App.MasterDashboardPage = this;
        //}

        private void DataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
        {
            if (e.ColumnIndex == 1 && e.CellValue.ToString() == "4")
            {
                e.Style.BackgroundColor = Color.YellowGreen;
                e.Style.ForegroundColor = Color.White;
            }
            e.Handled = true;
        }
예제 #5
0
        /// <summary>
        /// Triggers when a cell comes to the View
        /// </summary>
        /// <param name="sender">DataGrid_QueryCellStyle event sender</param>
        /// <param name="e">DataGrid_QueryCellStyle event args e</param>
        private void DataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
        {
            if (e.ColumnIndex == 3 || (this.DataGrid.GetUnboundRowAtRowIndex(e.RowIndex) != null && this.DataGrid.GetUnboundRowAtRowIndex(e.RowIndex).Position == UnboundRowsPosition.FixedBottom))
            {
                e.Style.BackgroundColor = Color.FromRgb(225, 245, 254);
            }

            e.Handled = true;
        }
예제 #6
0
 private void dgPiutang_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
 {
     if (e.Column.MappingName == "selisih")
     {
         var   cellValue = e.DisplayText == null ? string.Empty : e.DisplayText.ToString();
         float value     = float.Parse(cellValue);
         if (value < 0)
         {
             e.Style.BackColor = Color.Pink;
         }
     }
 }
예제 #7
0
 private void SfDataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
 {
     if (e.Column.MappingName == "Status")
     {
         if (e.DisplayText.ToString() == "Active")
         {
             e.Style.TextColor = Color.Green;
         }
         else
         {
             e.Style.TextColor = Color.Red;
         }
     }
 }
예제 #8
0
        static private void DataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
        {
            if (e.ColumnIndex == 5 && e.RowIndex % 2 == 1) //black for every other end total
            {
                e.Style.BackgroundColor = Color.Black;
                e.Style.ForegroundColor = Color.Black;
            }

            if (e.ColumnIndex == 6 && e.RowIndex % 2 == 1)  //black for every other runnig total
            {
                e.Style.BackgroundColor = Color.Black;
                e.Style.ForegroundColor = Color.Black;
            }

            e.Handled = true;
        }
예제 #9
0
        private void SfDataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
        {
            double value = (e.DataRow.RowData as SalesByYear).QS2;

            if (value < 300000 && e.ColumnIndex == 2)
            {
                e.Style.BackColor = Color.LightGoldenrodYellow;
            }

            if (value < 200000 && e.ColumnIndex == 3)
            {
                e.Style.BackColor = Color.LightBlue;
            }

            if (value < 400000 && e.ColumnIndex == 4)
            {
                e.Style.BackColor = Color.RosyBrown;
            }
        }
예제 #10
0
        private void SfDataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
        {
            double qS2 = (e.DataRow.RowData as SalesByYear).QS2;
            double qS3 = (e.DataRow.RowData as SalesByYear).QS3;
            double qS4 = (e.DataRow.RowData as SalesByYear).QS4;

            if (e.Column.MappingName == "QS2" && qS2 < 300000.00 && qS2 > 100000.00)
            {
                e.Style.BackColor = Color.LightGoldenrodYellow;
            }

            if (e.Column.MappingName == "QS3" && qS3 < 500000.00 && qS3 > 300000.00)
            {
                e.Style.BackColor = Color.LightBlue;
            }

            if (e.Column.MappingName == "QS4" && qS4 < 600000.00 && qS4 > 300000.00)
            {
                e.Style.BackColor = Color.RosyBrown;
            }
        }
예제 #11
0
        /// <summary>
        /// Pretty print each row
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sfDataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
        {
            int index = e.RowIndex - 1;

            //do not paint the header
            if (index == -1)
            {
                return;
            }

            //custom cell style
            e.Style.TextMargins = new Padding(3, 3, 3, 3);
            e.Style.Font        = new Syncfusion.WinForms.DataGrid.Styles.GridFontInfo(new Font("Segoe UI", 13, FontStyle.Regular, GraphicsUnit.Point));

            //check to make sure the row data is valid
            if (e.DataRow.RowData is SelectableTaskDecorator st)
            {
                //paint the background to the task color
                if (e.Column.MappingName != "Selected")
                {
                    e.Style.BackColor = st.DrawColor;
                }
            }
        }
 private void dataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e)
 {
     //e.Style.BackgroundColor = Color.Black;
     //e.Style.ForegroundColor = Color.White;
     //e.Handled = true;
 }