Step by step - how to create beautiful sliding menu using transition control - Bunifu Framework | Empowering software developers craft great user experiences in less time. Productivity tools for C# & VB.NET UX/UI design

Step by step – how to create beautiful sliding menu using transition control

beautiful animated material user interface design using C# Winforms
How to create beautiful animated material user interface design using C# Winforms
April 24, 2017
Step by step – How to create a modern Sign In / Sign Up form
April 28, 2017
Show all

Step by step – how to create beautiful sliding menu using transition control

Animated sliding menu - modern flat

In this article we’ll see how can we do a sliding menu using Bunifu Transition control. Let’s see it working!

First of all, create a new Windows Forms application and drag a Bunifu Ellipse on the main form. We’ll see the following window:

Now just drag a new panel on the form and dock it to the left (set the Dock property to the value Left). After doing that, set the back color to the value 37, 46, 59 and you’ll have to reach that layout:

Now add a new panel and set it’s Dock property to Top. You’ll reach that layout:

We want that third panel to be similar to a top bar (we’ll add a styled text on it) so we have to make it on top on all the other panels. In order to do that, just right click on it and click on “Send To Back” and you’ll get that result:

Now let’s adjust the color scheme: set the back color of the side panel (panel 1) to 26, 32, 40 and the back color of the top panel to 0, 102, 204 and you should get the following result:

Now add a new picture box to the panel 1 and insert the Bunifu Logo into it (you can download it from the official website by just right clicking on it and then clicking on “Save Image As”) or you can use any logo you like 🙂  Just place it and adjust it’s size:

Next, let’s add a material-like button we’ll use to slide the menu:

Now let’s add drag to our form. In order to do that, just drop a Bunifu Drag Control on our form and set it’s “Target Control” property to the header panel (the panel on the top). Test it and see it working! (It’s a pretty straight forward configuration).

Let’s design the top panel also:

(The font is Century Gothic and the icons have been taken from this website).

Now add 6 Bunifu Flat Buttons on the first panel and arrange them like that:

Put their background color identical with the underlying panel and attach an icon to each image. You may get a result similar to this one:

 

Now check the current width of the panel and write it down somewhere. Next, drag the panel to the left in order to see just the icons of the buttons, like that:

 

Check that width and write it down too. This is the state where the panel is slided. Notice that we need to hide the logo before doing that minimizing step.

In order to do the animation, we need to use the Bunifu Transition control. Drop it on the form and let’s add the following code to make it work:

<br />
private void pictureBox2_Click(object sender, EventArgs e)<br />
{<br />
   /* This is the width of the expanded panel */<br />
   if(panel1.Width == 223)<br />
   {<br />
      panel1.Visible = false;</p>
<p>      /* Hide the logo */<br />
      pictureBox1.Visible = false;</p>
<p>      panel1.Width = 68;<br />
      bunifuTransition1.ShowSync(panel1);<br />
   }<br />
   else<br />
   {<br />
      panel1.Visible = false;<br />
      panel1.Width = 223;</p>
<p>      /* Show the logo */<br />
      pictureBox1.Visible = true;<br />
      bunifuTransition1.ShowSync(panel1);<br />
   }<br />
}<br />

Panel 1 is our sliding panel, pictureBox1 is the logo (that we need to show / hide depending on the sliding direction) and pictureBox2 is our sliding button (the button that we press to slide the menu).

You can check it now and see that it really works!

For a video demo on how we did it, check out the video below:

I hope you will find this useful. Leave us some comments and share 🙂

Kim Too Flex (MVP)
Kim Too Flex (MVP)
CTO and Lead software engineer Bunifu Framework

2 Comments

  1. Hyeonseok Yoon says:

    Hello. I have something to ask. I want to animate the slide menu. inserting bunifuImageButton1 inside the panel. But https://youtu.be/teqYKcj62VA the buttons are hidden from the panel without moving. How did you do that?

  2. Please make use of anchors, I suggest you also watch the video step by step, reduce the speed – all the details are covered there. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *