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);
                }
            }
        }
Example #2
0
        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);
                //}
            }
        }
Example #3
0
        private void radListView1_CellCreating(object sender, ListViewCellElementCreatingEventArgs e)
        {
            DetailListViewDataCellElement cell = e.CellElement as DetailListViewDataCellElement;

            if (cell != null && cell.Data.Name == "title")
            {
                // cell.Padding = new Padding(50, 50, 50, 50);
                cell.BackColor = Color.Red;
                e.CellElement  = new CustomDetailListViewDataCellElement(cell.RowElement, e.CellElement.Data);
            }
        }
Example #4
0
        private void radListViewClientList_CellCreating(object sender, ListViewCellElementCreatingEventArgs e)
        {
            DetailListViewDataCellElement cell = e.CellElement as DetailListViewDataCellElement;

            if (cell != null && cell.Data.Name == "Operation")
            {
                e.CellElement = new CustomWaiverProcessListViewCellElementProcess(cell.RowElement, e.CellElement.Data);
            }
            else if (cell != null && cell.Data.Name == "Reference")
            {
                e.CellElement = new CustomWaiverProcessListViewCellElementReference(cell.RowElement, 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);
            }
        }
Example #6
0
        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;
                    }
                }
            }
        }