I googled this and still can't get it working
I have a WPF app and want to start from Main.xaml which is located in a different assembly. Both assemblies are in the same location.
How can I do this? I took out the StartupUri from the XAML and tried with these and some slight variations:
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); StartupUri = new Uri("/CompanyName.VisualStudio.UI;CompanyName/VisualStudio/UI/DatabaseManager/Main.xaml", UriKind.Relative); //StartupUri = new Uri(@"pack://application:,,,/ CompanyName.VisualStudio.UI;CompanyName/VisualStudio/UI/DatabaseManager/Main.xaml"); }
The name of the assembly is "CompanyName.VisualStudio.UI" and the namespace is "CompanyName/VisualStudio/UI/DatabaseManager/Main.xaml"
Any ideas?
NavigationService is for browser navigation within WPF. What you are trying to do is change to a different window TrainingFrm . To go to a different window, you should do this: private void conditioningBtn_Click(object sender, RoutedEventArgs e) { var newForm = new TrainingFrm(); //create your new form.
It may indeed get phased out eventually “The WPF's goal in user interface and graphics rendering in the . NET Framework 3.0 release is to provide a windowing system for the desktop environment on Microsoft Windows.
WPF is still one of the most used app frameworks in use on Windows (right behind WinForms).
Window is the root control that must be used to hold/host other controls (e.g. Button) as container. Page is a control which can be hosted in other container controls like NavigationWindow or Frame. Page control has its own goal to serve like other controls (e.g. Button). Page is to create browser like applications.
This article gives a clean XAML-only solution.
StartupUri="pack://application:,,,/assembly_name;component/path/file_name.xaml"
Where:
Examples:
pack://application:,,,/UI;component/CalculatorView.xaml assembly - UI.dll path - none (file at project root) file_name - CalculatorView pack://application:,,,/MyApp.UI;component/Views/CalculatorView.xaml assembly - MyApp.UI.dll path - Views file_name - CalculatorView pack://application:,,,/UI;component/Views/External/CalculatorView.xaml assembly - UI.dll path - Views/External file_name - CalculatorView
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With