Styling the Selection Rectangle

4 posts, 0 answers
  1. Bryan
    Bryan avatar
    14 posts
    Member since:
    Jan 2015

    Posted 18 Sep 2015 Link to this post

    Hello, is it possible to style the selection rectangle for the RadSpreadsheet control? I can't seem to find where it is being applied.
  2. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 21 Sep 2015 Link to this post

    Hello Bryan,

    The selection rectangle is created and modified through the code of the SelectionUILayer and by the time being there is no public API that can be used to modify it except implementing new custom SelectionUILayer.
    Could you share with us what would you like to do with it? This way I will be able to try to find a workaround and add the feature request in our backlog.

    Regards,
    Nikolay Demirev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Bryan
    Bryan avatar
    14 posts
    Member since:
    Jan 2015

    Posted 21 Sep 2015 in reply to Nikolay Demirev Link to this post

    I did manage to trace it back to the SelectionUILayer.

     I am looking to use the RadSpreadsheet as a customizable display, but this issue and the one mentioned here

    http://www.telerik.com/forums/updating-a-named-range-programmatically#vFMKWJz6QkKWSlRvXpDY8g

    are the major roadblocks.

     

    Essentially, the user configures the sheet with some parameters that update in the background and the display reflects the current values. In display mode I want to hide the selection rectangle.

  5. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 23 Sep 2015 Link to this post

    Hello,

    To be able to hide the selection rectangle you can remove the SelectionUILayer. This can be achieved creating a custom UI layers builder. You could use the following code:
    public class CustomWorksheetUILayersBuilder : WorksheetUILayersBuilder
    {
        public override void BuildUILayers(Telerik.Windows.Controls.Spreadsheet.Layers.UILayerStack<WorksheetUILayerBase> uiLayers)
        {
            base.BuildUILayers(uiLayers);
     
            uiLayers.Remove(WorksheetPredefinedUILayers.Selection);
        }
    }

    In the constructor of your control you can use the following line:
    this.radSpreadsheet.WorksheetUILayersBuilder = new CustomWorksheetUILayersBuilder();

    If you want to remove it on some event this can be achieved little hacky. First you have to set the custom builder and then to change the active worksheet to another one and then return the previous active worksheet, this way you will force the layers to be build.

    Regards,
    Nikolay Demirev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top