Problem using two sfSideBar

Hello

I used two SfSideBars:

1- Currently, both sidebars are displayed by default. How to hide SfSideBarProfile by default and show it only when the user clicks the "Show Profile" button?

2- When SfSideBarProfile is hidden. If the user resizes his browser, SfSideBarProfile will be displayed. How to prevent this?

The related file is attached.

.net 8 , syncfusion version: 25.1.35


Attachment: MainLayout_377d41fa.rar

3 Replies

JA Jafar Ali Shahulhameed Syncfusion Team May 28, 2024 03:05 PM UTC

Hi Sarah,


Greetings from Syncfusion,


[Query: 1 – Hiding the profile sidebar]


We have achieved your requirement by making use of the Created event and prevent the opening of Sidebar in initial rendering. Refer the code changes below,


[MainLayout.razor]

 

<SfSidebar EnableGestures="false" Width="280px" Position="SidebarPosition.Right"

            ShowBackdrop="false" MediaQuery="(min-width:600px)" Target=".main-content" @ref="sfSidebarProfile"

            IsOpen="SidebarToggleProfile" CloseOnDocumentClick="false" Animate="true" Type="SidebarType.Over" Created="OnCreated" OnOpen="OnOpen">

</SfSidebar>

 

public void OnCreated()

{

    sfSidebarProfile.IsOpen = false;

}



[Query: 2 – Preventing the hiding of Sidebar during window resize]


We can prevent the hiding of sidebar during window resize by making use of the OnOpen event. Refer the code changes below,


[MainLayout.razor]

 

<SfSidebar EnableGestures="false" Width="280px" Position="SidebarPosition.Right"

            ShowBackdrop="false" MediaQuery="(min-width:600px)" Target=".main-content" @ref="sfSidebarProfile"

            IsOpen="SidebarToggleProfile" CloseOnDocumentClick="false" Animate="true" Type="SidebarType.Over" Created="OnCreated" OnOpen="OnOpen">

</SfSidebar>



We have attached the sample for your reference,


Sample: Attached as zip file.


Kindly try out the shared details and get back to us if you need further assistance.


Regards,

Jafar


Attachment: Blazor_Sidebar_1b8df5c6.zip


SA Sarah May 29, 2024 11:24 AM UTC

Hi ,

Thank you very much for your response. I want to close the sfSidebarProfile automatically when the user clicks somewhere else outside the sfSidebarProfile . I used CloseOnDocumentClick="true" and didn't get results.



JA Jafar Ali Shahulhameed Syncfusion Team May 30, 2024 01:00 PM UTC

Hi Sarah,


On validated your query we found that the Sidebar is closing while clicking anywhere on the page and we regret to inform you that we cannot be able to replicate the issue from our end.


We kindly suggest you to provide some additional details such as issue replication steps, issue replicating sample or try to replicate the issue in the attached sample this will help us to provide you a prompt solution.


We have attached the sample for your reference,


Sample: Attached as zip file


Kindly try out the shared details and get back to us if you need further assistance.


Regards,

Jafar


Attachment: Blazor_Sidebar_1_e0de0305.zip

Loader.
Up arrow icon