WPF | Sidebar , Multi Window Navigation

Поделиться
HTML-код
  • Опубликовано: 23 июл 2022
  • How to Create a sidebar in WPF?
    How to Create a Navigation bar in WPF?
    How to host multiple windows in Mainwindow?
    How to click a button from child window?
    How to navigate multiple windows?
    #wpf
    #sidebar
    #navigation bar
    #multiple window navigation

Комментарии • 22

  • @Nephinae_
    @Nephinae_ 9 месяцев назад +3

    Thanks for the simple explanation and relatively short video! This is what I was looking for!

  • @charlesgantz5865
    @charlesgantz5865 Год назад +5

    This is a good example of calling UserControls from the main window. If you had more RadioButtons, you can shorten things by using the same Checked event for all the RadioButtons, then use a Switch statement. Like this:
    private void rbtn_Checked(object sender, RoutedEventArgs e)
    {
    string senderName = (sender as RadioButton).Name;
    switch (senderName)
    {
    case "rbtn1": CC.Content = new UserControl1(); break;
    case "rbtn2": CC.Content = new UserControl3(); break;
    case "rbtn3": CC.Content = new UserControl3(); break;
    default:
    break;
    }
    }
    For more complicated cases you can also use Reflection to determine the UserControl name from the RadioButton name, then instantiate and call the correct UserControl. This is done like this:
    private void rbtnWitnReflection_Checked(object sender, RoutedEventArgs e)
    {
    string senderName = (sender as RadioButton).Name;
    string assemName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
    string ucFullName = assemName + "." + senderName.Replace("rbtn", "UserControl");
    object uc = Activator.CreateInstance(Type.GetType(ucFullName));
    CC.Content = uc;
    }

  • @standman007
    @standman007 3 месяца назад

    Thanks very much. Just what I wanted to get my project started

  • @timoshaht8499
    @timoshaht8499 Год назад +1

    Bro, you just helped me so much, i can't thank you enough

  • @denis_sechin
    @denis_sechin Год назад +2

    I tried to make something “cool”, but explanations were too complicated. This video is as simple simple as cool) Everything ingenious is simple) Thank you so much)

  • @VuNguyen-kk1lk
    @VuNguyen-kk1lk Год назад +2

    You just made my day!! Thank you so much!

  • @Jalex-xu5ci
    @Jalex-xu5ci Год назад +2

    Nice mm

  • @saibaba7306
    @saibaba7306 3 месяца назад

    Thank you for the explanation

  • @fathimanidhanidhak8460
    @fathimanidhanidhak8460 Год назад +1

    Can we give another user control inside main user control for submenu so that we can have navigation for submenu also

  • @Catchfish201
    @Catchfish201 10 месяцев назад +1

    thanks much appreciated

  • @ivankovachev8835
    @ivankovachev8835 3 месяца назад

    How about when using the MVVM pattern?

  • @sohailsc1921
    @sohailsc1921 Год назад +2

    how to join UserControl2 and UserControl3 under a category and continue using radio buttons

  • @Kumar-ml8ox
    @Kumar-ml8ox 6 месяцев назад

    CC return null what to do

  • @fooballers7883
    @fooballers7883 8 месяцев назад +1

    Thank you....