This is a migrated thread and some comments may be shown as answers.

Change style of focus rectangle

2 Answers 56 Views
ListView
This is a migrated thread and some comments may be shown as answers.
KKL
Top achievements
Rank 1
KKL asked on 02 Jul 2017, 09:49 AM
I have a ListView in Details view, with FullRowSelect set to true. When a cell is clicked, a faint focus rectangle appears around the selected cell. I am assuming I can change the BorderColor of this DetailListViewDataCellElement in the CellFormatting event, but how can I tell if the cell (not the row) is selected?

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 03 Jul 2017, 08:44 AM
Hello Kevin,

The following snippet shows how you can achieve this:
private void RadListView1_CellFormatting(object sender, ListViewCellFormattingEventArgs e)
{
    var item = e.CellElement as DetailListViewDataCellElement;
    if (item != null)
    {
        var currentRow =  (bool)item.GetValue(DetailListViewDataCellElement.CurrentRowProperty);
        var currentColumn = item.Data.Current;
        if (currentRow && currentColumn)
        {
            item.BorderColor = Color.Green;
        }
        else
        {
            item.ResetValue(LightVisualElement.BorderColorProperty, Telerik.WinControls.ValueResetFlags.Local);
        }
    }
     
         
}

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
KKL
Top achievements
Rank 1
answered on 03 Jul 2017, 09:32 AM
Perfect - thanks once more!
Tags
ListView
Asked by
KKL
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
KKL
Top achievements
Rank 1
Share this question
or