WorkbookContentChanged event issue?

11 posts, 2 answers
  1. Anthony
    Anthony avatar
    58 posts
    Member since:
    Aug 2011

    Posted 13 Jul 2014 Link to this post

    Hi,

    I am using the RadSpreadsheet to manipulate a workbook which I exported and stored in a database.

    Once imported back from the database I allow the user to modify the workbook. I am detecting when the user makes a change to the content using the WorkbookContentChanged event. If a change is detected I enable my apps save button to allow the user to save the workbook back to the database.

    My issue occurs when I try to do things such as rename a worksheet or freeze panes. The WorkbookContentChanged event is not fired and therefore the user will not be given the option by my app to save the workbook back to the database.

    Is there another event I can hook up to or is this a bug with the WorkbookContentChanged not firing for some changes?

    Thanks
    Anthony
  2. Answer
    Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 14 Jul 2014 Link to this post

    Hi Anthiny,

    Than you for reporting this issue. We have managed to fix it and the fix will be available for download with the LIB that will be released next week.

    You can use the WorkbookContentChnaged event for all changes that are applied on the workbook. As Freeze Panes is considered as UI feature, the WorkbookContentChange do not respect it. To be able to track Freeze Panes changes we have introduced FreezePanesChanged event. Here is a code snippet showing how you can use it:
    this.radSpreadsheet.ActiveSheetEditorChanged += this.RadSpreadsheet_ActiveSheetEditorChanged;
     
    RadWorksheetEditor worksheetEditor;
    private void RadSpreadsheet_ActiveSheetEditorChanged(object sender, EventArgs e)
    {
        if (this.worksheetEditor != null)
        {
            this.worksheetEditor.ActivePresenterChanged -= this.WorksheetEditor_ActivePresenterChanged;
        }
     
        this.worksheetEditor = this.radSpreadsheet.ActiveWorksheetEditor;
     
        if (this.worksheetEditor != null)
        {
            this.worksheetEditor.ActivePresenterChanged += this.WorksheetEditor_ActivePresenterChanged;
        }
    }
     
    NormalWorksheetEditorPresenter activePresenter;
    private void WorksheetEditor_ActivePresenterChanged(object sender, EventArgs e)
    {
        if (this.activePresenter != null)
        {
            this.activePresenter.FreezePanesChanged -= this.ActivePresenter_FreezePanesChanged;
        }
     
        this.activePresenter = this.worksheetEditor.ActivePresenter as NormalWorksheetEditorPresenter;
     
        if (this.activePresenter != null)
        {
            this.activePresenter.FreezePanesChanged += this.ActivePresenter_FreezePanesChanged;
        }
    }
     
    private void ActivePresenter_FreezePanesChanged(object sender, EventArgs e)
    {
    }

    As a token of our appreciation for reporting this I am updating your Telerik points.

    Please, do not hesitate to let us know if you encounter any further issues regarding this or any other matter.


    Regards,
    Nikolay Demirev
    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. Anthony
    Anthony avatar
    58 posts
    Member since:
    Aug 2011

    Posted 17 Jul 2014 in reply to Nikolay Demirev Link to this post

    Hi,

    Thanks for the reply.

    I am also having the same issue with the zoom control on the RadSpreadsheetStatusBar. Is there any way to determine when the user changes the zoom level of the sheet?

    Thanks
    Anthony
  5. Answer
    Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 17 Jul 2014 Link to this post

    Hi Anthony,

    The RadWorksheetEditor exposes ScaleFactorChanged event. You can use it to track if the scale factor is changed. The change of the scale factor is also considered as UI feature and that is why the WorkbookContetnChanged event is not raised.

    If you need any further assistance, please do not hesitate to contact us again.

    Regards,
    Nikolay Demirev
    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.
     
  6. Anthony
    Anthony avatar
    58 posts
    Member since:
    Aug 2011

    Posted 18 Jul 2014 in reply to Nikolay Demirev Link to this post

    Thanks, that worked.

    Anthony
  7. Anthony
    Anthony avatar
    58 posts
    Member since:
    Aug 2011

    Posted 31 Jul 2014 in reply to Nikolay Demirev Link to this post

    Hi,

    I tested this with the latest build and it works as expected now.

    Thanks
    Anthony
  8. Anthony
    Anthony avatar
    58 posts
    Member since:
    Aug 2011

    Posted 04 Dec 2014 in reply to Nikolay Demirev Link to this post

    Hi,

    This code was all working fine, however the ActivePresenterChanged event is now no longer firing.

    Did something change in the latest release?

    Thanks
    Anthony
  9. Anthony
    Anthony avatar
    58 posts
    Member since:
    Aug 2011

    Posted 04 Dec 2014 in reply to Anthony Link to this post

    Hi,

    Just an update on what I have found with some more testing. It does fire on the first Active Sheet, but if you change to another sheet it no longer fires.

    I am using the exact code from the answer above to handle the ActiveSheetEditorChanged event.

    Thanks
    Anthony
  10. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 05 Dec 2014 Link to this post

    Hi Anthony,

    The active presenter is changed when the control initializes and when the RadWorksheetEditor which owns the presenter changes its owner. The editor never changes its owner and that is why the event is triggered only once after the initialization of the control.

    Are you facing any issues related to this behaviour?

    Regards,
    Nikolay Demirev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  11. Anthony
    Anthony avatar
    58 posts
    Member since:
    Aug 2011

    Posted 05 Dec 2014 in reply to Nikolay Demirev Link to this post

    Hi Nikolay,

    The issue is that once I move to a new worksheet I can no longer detect if the user Freezes Panes. The reason for this is seen in the code you initially supplied in this post. The FreezePanesChanged event is hooked up when the ActivePresenterChanged event is fired, which you have just pointed out only fires once, not after each worksheet change.

    The ActivePresenter has definitely changed when the worksheet changes, so I believe this event should really be fired again, otherwise the event is incorrectly named and should be renamed to ActivePresenterChangedFirstTime.

    I have managed to work around the issue by testing if the ActivePresenter has changed in the ActiveSheetEditorChanged event.

    Thanks
    Anthony

  12. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 05 Dec 2014 Link to this post

    Hi Anthony,

    Indeed there was a bug which I have just fixed. The fix will be released with the next LIB, which will be available for download next week.

    As a token of our appreciation for reporting this I am updating your Telerik points.

    Regards,
    Nikolay Demirev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready