Change style of focus rectangle

3 posts, 0 answers
  1. KKL
    KKL avatar
    17 posts
    Member since:
    Nov 2016

    Posted 02 Jul 2017 Link to this post

    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. Dimitar
    Admin
    Dimitar avatar
    2841 posts

    Posted 03 Jul 2017 Link to this post

    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.
  3. KKL
    KKL avatar
    17 posts
    Member since:
    Nov 2016

    Posted 03 Jul 2017 in reply to Dimitar Link to this post

    Perfect - thanks once more!
Back to Top