Sidebar toggle to hide sidebar by default

Hi,
I have tried a few things from other posts but cannot successfully hide the sidebar on load and allow the toggle to show the sidebar (the opposite of the normal layout sidebar functionality).

Radzen programatically toggle sidebar menu shows what I want to achieve regardless of device/browser but the github link is broken and just adding

sidebarExpanded = false;
bodyExpanded = true;

at layout load does not work.

There must be a simple answer, I just cannot see it.

I've updated the link. Here is it:

Thanks. How do I do this using the Radzen desktop app builder?

There is a partial class for every page/layout, you can add your custom code there or you can set Expanded properties in the Radzen designer.

It seems far too complex to hide the sidebar by default would it possible to add this option as a feature of the toggle in a future release?

Not sure how we can simplify this - all you need is to set Expanded properties to desired values.

I hear what you're saying but cannot seem to do this simple task, sorry. Can you show me a screenshot as to where the expanded properties are please?

Define a boolean property at page load
image

Then add custom to sidebar component
image
and then to body component
image

Now you can set values flgToggle variable in your code to expand/collapse sidebar as required

1 Like

Thanks @Vinod_Pillai
Doing this is successful to a point, I still have to add more code to the toggle button to be successful. I would have liked to do similar but with the property that is toggled by the default layout toggle. I still have to add more code to the toggle button to be successful.

@enchev I still feel that an option to set the default state on the toggle button properties would be easier. Especially when the toggle has not editable event tab.

image