last day (15 days later) » 

01:24
0
Q: How to link two usercontrols? WPF

Baldeep SahdraI have a main window that links to a usercontrol with two buttons depending on the one selected I want these buttons to display another usercontrol. Below is the code for the button - the second usercontrol does not display but the first was hidden. private void Button_Click(object sender, Routed...

what is the class that Button_Click event handler in?
ExistingModelOrNew
Is that the code behind of the main window or what?
thats the name of the class sorry all this class has is a button even handler.
the stackpanel code is part of the main window code
Please explain, does the buttons also exist on the MainWindow?
01:24
There is a main window with a button in the menu that says add truck. Once this is clicked the usercontrol existingmodelornew appears in the stackpanel. This usercontrol has two buttons which both should open a new usercontrol. The code above is for the first button on this usercontrol.
Hi, I want to help you solving your proplem but I am a but confused
private void Button_Click(object sender, RoutedEventArgs e)
{
AddNewTruckUC addNewTruckUC = new AddNewTruckUC();
this.Visibility = Visibility.Hidden;
addNewTruckUC.Visibility = Visibility.Visible;
}
where this code belong? what is the class? can you provide the whole class?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TruckStockManagement.Views
{
/// <summary>
/// Interaction logic for ExistingModelOrNew.xaml
/// </summary>
ExistingModelOrNew is a user control that has a button to display a AddNewTruckUC and hide it self?
I am I correct?
01:28
yes
i believe the way i am making it visible is the error
Where the user control is intended to be displayed
You are right but tell me where you want it to be displayed
In the stack pannel?
Ok wait a minute I will write a full answer
01:47
@BaldeepSahdra the answer is posted

last day (15 days later) »