How to save end-user customization

7 posts, 1 answers
  1. Franco
    Franco avatar
    27 posts
    Member since:
    Apr 2010

    Posted 23 Nov 2010 Link to this post

    Good evening.
        I want to know if there's a way to save the end-user customization of a CommandBar Control. If the user removes a button, or change the disposition of the strips... when he closes the application, next time he wants to find the layout as it was. I didn't find a method to do this.

    Thank you.
    Franco
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 23 Nov 2010 Link to this post

    Hello Franco,

    I haven't tried this feature yet, but it looks very useful. The RadCommandBar has a CommandBarElement, and from this, just like the RadGridView you can save and load a layout to a file.

    For exmaple:
    Me.RadCommandBar1.CommandBarElement.LoadLayout("FileName")
    Me.RadCommandBar1.CommandBarElement.SaveLayout("FileName")

    LoadLayout Documentation

    hope this helps, but please let me know if you need further information

    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 23 Nov 2010 Link to this post

    Hello again,

    i've just tried this and it works very well.
    Private Sub Form1_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load
        If My.Computer.FileSystem.FileExists("C:\Users\Richard\MyCommandBar.xml") Then
            Me.RadCommandBar1.CommandBarElement.LoadLayout("C:\Users\Richard\MyCommandBar.xml")
        End If
    End Sub

    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        Me.RadCommandBar1.CommandBarElement.SaveLayout("C:\Users\Richard\MyCommandBar.xml")
    End Sub

    Hope this helps
    Richard
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 24 Nov 2010 Link to this post

    Hi Franco,

    How did you get on with this? If it helped, please mark as answer so others can find the solution too.
    Regards,
    Richard
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 30 Nov 2010 Link to this post

    Hi guys, 

    Thank you for writing.

    Richard's suggestion is the correct way of achieving the desired scenario. However, pretty soon we are going to upload a help article regarding this topic. 

    Thank you Richard for your cooperation. If you guys need any additional assistance, do not hesitate to contact me.
     
    Regards,
    Stefan
    the Telerik team
    Get started with RadControls for WinForms with numerous videos and detailed documentation.
  7. Gabriele
    Gabriele avatar
    14 posts
    Member since:
    Oct 2010

    Posted 07 Jul 2011 Link to this post

    Hi,

    I have the same issue and aftger triying to use the SaveLayout and LoadLayour methods, the commandbar is always in the default state, any change in the position of the commandbarrows is not memorized in the XML file.

    Any suggestions?

    Thanks,

    -Gabriele
  8. Gabriele
    Gabriele avatar
    14 posts
    Member since:
    Oct 2010

    Posted 07 Jul 2011 Link to this post

    Sorry, never mynd.

    I did a mistake, not it works.

    -Gabriele
Back to Top
UI for WinForms is Visual Studio 2017 Ready