Possible to disable Tab for RadSpreadSheet cells?

4 posts, 1 answers
  1. Dexter
    Dexter avatar
    34 posts
    Member since:
    Dec 2012

    Posted 19 Sep 2014 Link to this post

    Hi, I would like to enquire on an issue as per title. For other telerik controls like RadGridView, I can disable tabbing within the cells with IsTabStop = false. But this doesn't work for RadSpreadSheet. I've tried Focusable=false on it and IsTabStop = false on application level as well, but to no avail.
  2. Anna
    Admin
    Anna avatar
    99 posts

    Posted 23 Sep 2014 Link to this post

    Hello,

    What you can do to achieve this result is to replace the key binding which is responsible for tabbing with an empty one. The following code snippet contains an example of how this can be done.

    DelegateCommand emptyDelegateCommand = new DelegateCommand((parameter) => { });
    this.radSpreadsheet.ActiveWorksheetEditor.KeyBindings.RegisterCommand(emptyDelegateCommand, Key.Tab, ModifierKeys.None);
    this.radSpreadsheet.ActiveWorksheetEditor.KeyBindings.RegisterCommand(emptyDelegateCommand, Key.Tab, ModifierKeys.Shift);


    I hope this helps.

    Regards,
    Anna
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dexter
    Dexter avatar
    34 posts
    Member since:
    Dec 2012

    Posted 23 Sep 2014 in reply to Anna Link to this post

    Hi Anna, thanks for your assistance. I'm getting a null reference exception though when trying to set it after InitializeComponents();
    Setting it to a button works, but I need this to go in effect right after loading the application.

    This is my codes currently:
    webClient.OpenReadCompleted += (senders, eventArgs) =>
                {
                    var formatProvider = new XlsxFormatProvider();
                    sheet1211.Workbook = formatProvider.Import(eventArgs.Result);
                    foreach (Worksheet worksheet in sheet1211.Workbook.Worksheets)
                    {
                        worksheets.Add(worksheet);
                    }
                    PrepareWorksheet(currWSIndex);
                    sheet1211.ActiveWorksheet = worksheets[0]; //this line is not needed, just testing if this helps, but it didn't
                    var emptyDelegateCommand = new DelegateCommand(parameter => { });
                    sheet1211.ActiveWorksheetEditor.KeyBindings.RegisterCommand(emptyDelegateCommand, Key.Tab);
                    sheet1211.ActiveWorksheetEditor.KeyBindings.RegisterCommand(emptyDelegateCommand, Key.Tab, ModifierKeys.Shift);
                };
                webClient.OpenReadAsync(new Uri(filePath));
                sheet1211.VisibleSize = new SizeI(13, 45);

    I also tried setting it outside, with no avail:
    webClient.OpenReadCompleted += (senders, eventArgs) =>
                {
                    var formatProvider = new XlsxFormatProvider();
                    sheet1211.Workbook = formatProvider.Import(eventArgs.Result);
                    foreach (Worksheet worksheet in sheet1211.Workbook.Worksheets)
                    {
                        worksheets.Add(worksheet);
                    }
                    PrepareWorksheet(currWSIndex);
                    sheet1211.ActiveWorksheet = worksheets[0]; //this line is not needed, just testing if this helps, but it didn't
                };
                webClient.OpenReadAsync(new Uri(filePath));
                sheet1211.VisibleSize = new SizeI(13, 45);
                var emptyDelegateCommand = new DelegateCommand(parameter => { });
                sheet1211.ActiveWorksheetEditor.KeyBindings.RegisterCommand(emptyDelegateCommand, Key.Tab);
                sheet1211.ActiveWorksheetEditor.KeyBindings.RegisterCommand(emptyDelegateCommand, Key.Tab, ModifierKeys.Shift);

  5. Answer
    Anna
    Admin
    Anna avatar
    99 posts

    Posted 24 Sep 2014 Link to this post

    Hi Dexter,

    In this case the most suitable moment to set the key bindings would be on the RadSpreadsheet Loaded event.

    Please, let me know if you encounter further difficulties.

    Regards,
    Anna
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top