private void radListView1_CellFormatting(object sender, ListViewCellFormattingEventArgs e) { DetailListViewDataCellElement cell = e.CellElement as DetailListViewDataCellElement; if (cell != null) { if (cell.Text != string.Empty) { decimal price = 0; if (decimal.TryParse(cell.Text, out price)) { cell.Text = new string(' ', 5) + string.Format("{0:C2}", price); } else { cell.Text = new string(' ', 2) + string.Format("{0}", cell.Text); } e.CellElement.BorderGradientStyle = Telerik.WinControls.GradientStyles.Solid; } else { e.CellElement.ResetValue(LightVisualElement.BorderGradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local); } } }
private void radListView1_CellFormatting(object sender, ListViewCellFormattingEventArgs e) { DetailListViewDataCellElement cell = e.CellElement as DetailListViewDataCellElement; if (cell != null) { cell.BackColor = Color.White; cell.GradientStyle = Telerik.WinControls.GradientStyles.Solid; // cell.Margin = new Padding(0, 10, 0, 10); cell.BorderColor = Color.White; // DataRowView productRowView = cell.Row.DataBoundItem as DataRowView; //if (productRowView != null && (bool)productRowView.Row["title"] == true) //{ // e.CellElement.BackColor = Color.Yellow; // e.CellElement.ForeColor = Color.Red; // e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid; // //e.CellElement.Font = newFont; //} //else //{ // e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local); // e.CellElement.ResetValue(LightVisualElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local); // e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local); // e.CellElement.ResetValue(LightVisualElement.FontProperty, Telerik.WinControls.ValueResetFlags.Local); //} } }
private void lstImpresionDiagnostica_CellFormatting(object sender, ListViewCellFormattingEventArgs e) { if (e.CellElement is DetailListViewHeaderCellElement) { e.CellElement.BackColor = Color.FromArgb(17, 105, 133); e.CellElement.ForeColor = Color.FromArgb(191, 219, 255); e.CellElement.BorderColor = Color.FromArgb(17, 105, 133); e.CellElement.Font = new Font(e.CellElement.Font.FontFamily.Name, 14); e.CellElement.NumberOfColors = 1; } else { e.CellElement.ResetValue(LightVisualElement.BackColorProperty); } }
/// <summary> /// /// </summary> private static void listView_CellFormatting(object sender, ListViewCellFormattingEventArgs e) { var cell = e.CellElement as DetailListViewDataCellElement; if (cell == null) { return; } foreach (var value in columnFormats) { if (!ReferenceEquals(sender, value.listView.ListViewElement)) { continue; } if (e.CellElement.Data.FieldName == value.column) { e.CellElement.Text = string.Format(value.format, cell.Row[e.CellElement.Data]); } } }
private void radListView2_CellFormatting(object sender, ListViewCellFormattingEventArgs e) { this.radListView1_CellFormatting(sender, e); DetailListViewDataCellElement cell = e.CellElement as DetailListViewDataCellElement; if (cell != null && cell.Text != string.Empty) { decimal price = 0; if (decimal.TryParse(cell.Text.Substring(3), out price)) { Color color = Color.FromArgb(255, 104, 20, 6); if (TelerikHelper.IsDarkTheme(this.radListView1.ThemeName)) { color = Color.FromArgb(255, 255, 255, 255); } int indent = 4; if (price >= 10) { indent = 3; } cell.Text = new string(' ', indent) + string.Format("{0:C2}", price); e.CellElement.ForeColor = color; } else { e.CellElement.ResetValue(LightVisualElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local); } e.CellElement.Font = new Font("Segoe UI", 9f, FontStyle.Bold); } else { e.CellElement.ResetValue(LightVisualElement.FontProperty, Telerik.WinControls.ValueResetFlags.Local); e.CellElement.ResetValue(LightVisualElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local); } }
void radListView1_CellFormatting(object sender, ListViewCellFormattingEventArgs e) { if (e.CellElement is DetailListViewHeaderCellElement) { return; } if (e.CellElement.Data.HeaderText == "Picture") { ((DetailListViewDataCellElement)e.CellElement).Image = ((DetailListViewDataCellElement)e.CellElement).Row.Image; e.CellElement.Text = ""; e.CellElement.ImageAlignment = ContentAlignment.MiddleCenter; e.CellElement.TextImageRelation = TextImageRelation.Overlay; } else { e.CellElement.Image = null; } if (e.CellElement.Data.HeaderText == "Make" || e.CellElement.Data.HeaderText == "Model") { e.CellElement.Text = "<html><span style=\"color:#161112;font-size:11.5pt;\">" + e.CellElement.Text + "</span>"; } else if (this.features.Contains(e.CellElement.Data.FieldName)) { bool containsFeature = this.ContainsFeature(((DetailListViewDataCellElement)e.CellElement).Row, e.CellElement.Data.FieldName); string color = (containsFeature) ? "#050F70" : "#B52822"; e.CellElement.ForeColor = (Color)(new ColorConverter().ConvertFromString(color)); e.CellElement.Font = new Font(e.CellElement.Font.FontFamily, 10, GraphicsUnit.Point); e.CellElement.Text = (containsFeature) ? "YES" : "NO"; } else if (e.CellElement.Data.HeaderText != "Picture") { e.CellElement.ForeColor = (Color)(new ColorConverter().ConvertFromString("#050F70")); e.CellElement.Font = new Font(e.CellElement.Font.FontFamily, 10, GraphicsUnit.Point); e.CellElement.Text = e.CellElement.Text; } }
private void radListViewClientList_CellFormatting(object sender, ListViewCellFormattingEventArgs e) { if ((e.CellElement).Data.HeaderText == "Time") { if ((e.CellElement is DetailListViewDataCellElement)) { e.CellElement.TextAlignment = ContentAlignment.MiddleCenter; } } if ((e.CellElement).Data.HeaderText == "Operation") { if ((e.CellElement is DetailListViewDataCellElement)) { e.CellElement.TextAlignment = ContentAlignment.MiddleCenter; DetailListViewDataCellElement dCellElm = e.CellElement as DetailListViewDataCellElement; if (((ClientActionType)((DataRowView)dCellElm.Row.DataBoundItem).Row["Data"]).StartType == ClientActionType.ClientStartType.NONE) { e.CellElement.DrawFill = true; e.CellElement.BackColor = Color.Coral; e.CellElement.BackColor2 = Color.Coral; } else { e.CellElement.DrawFill = false; } } } if ((e.CellElement).Data.HeaderText == "Client Name") { if ((e.CellElement is DetailListViewDataCellElement)) { e.CellElement.TextAlignment = ContentAlignment.MiddleCenter; } } if ((e.CellElement).Data.HeaderText == "Age") { if ((e.CellElement is DetailListViewDataCellElement)) { e.CellElement.TextAlignment = ContentAlignment.MiddleCenter; } } if ((e.CellElement).Data.HeaderText == "Session Start Time") { if ((e.CellElement is DetailListViewDataCellElement)) { e.CellElement.TextAlignment = ContentAlignment.MiddleCenter; DateTime dsStartTime = DateTime.MinValue; DetailListViewDataCellElement dCellElm = e.CellElement as DetailListViewDataCellElement; string ssStartTime = ((DataRowView)dCellElm.Row.DataBoundItem).Row["SessionStartTime"].ToString(); DateTime.TryParse(ssStartTime, out dsStartTime); if (dsStartTime != DateTime.MinValue && DateTime.Now.Subtract(dsStartTime).TotalMinutes < -60) { e.CellElement.DrawFill = true; e.CellElement.BackColor = Color.Coral; e.CellElement.BackColor2 = Color.Coral; } else if (dsStartTime != DateTime.MinValue && DateTime.Now.Subtract(dsStartTime).TotalMinutes > 0) { e.CellElement.DrawFill = true; e.CellElement.BackColor = Color.Red; e.CellElement.BackColor2 = Color.Red; } else { e.CellElement.DrawFill = false; } } } }
/// <summary> /// Handles the CellFormatting event of the lvParts control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ListViewCellFormattingEventArgs" /> instance containing the event data.</param> private void lvParts_CellFormatting(object sender, ListViewCellFormattingEventArgs e) { e.CellElement.TextWrap = true; }
private void lstImpresionDiagnostica_CellFormatting(object sender, ListViewCellFormattingEventArgs e) { }