It's almost a week I've been trying to find a way to implement a Navigation Menu in WPF using MvvmCross 7 with no success. I had no luck even doing a research with similar solution, my impression is MvvmCross is mainly used with Xamarin and that WPF is not used at all. At this point I'm suffering a deep loneliness.
The idea is simple: show a view inside a main view in order to change it dinamically. The main view is the menu with all the buttons and the child view is the content of the button pressed.
I' ve been able to achive it using this https://www.codeproject.com/Articles/5275552/WPF-Compact-Navigation-Menu but I won't feel good until a find the correct way using MvvmCross.
Can you give me a starting point or some hints?
Related
I'm new to using MVVM Cross and I'm trying to get the basics. My confusion comes in with seeing my view. I have a main view that is a menu bar with a few menu items with a different color background. That is my main view. I've watched a few videos online and study the tip calculator example, but none of those really point to how the view "shows" when the application runs. It seems a bit magical. So I know I'm missing something.
Now what I did figure out is if I use the ViewPresenter attributes, I can get my main view to display over the main window. But, without those attributes, all I get is the main window. The tip calculator example does not show any attributes so again I think I'm missing something. Any help would greatly be appreciated.
Thanks.
MvxApplication.RegisterAppStart<TViewModel>() in the Core project is telling MvvmCross the ViewModel to start with. MvvmCross can use convention to find the view for the ViewModel, or the more modern approach would be to use the view presenter attributes. TipCalc was written before the view presenter attributes and has not been upgraded to use them.
There is general documentation about view presenters here. Each platform has specifics.
For example, Android has activity + fragments. Activity is like a window. Fragment is like a user control. MvvmCross would automatically create the host activity for your fragment as needed when you use the IMvxNavigationService to navigate to your fragment ViewModel. There is more information avaiable in the MvvmCross documentation.
I'm trying out MVVM with a simple project using WPF and I've got the grips on mostly how the pattern works and their intentions. However, one of my problem now is how navigation is done in MVVM. For example, when I have a navigation pane and I need to show a UserControl on the right-side of a window based on what item is clicked on the navigation pane. Or showing a new window.
How is this done in MVVM? I've browsed the internet but all implementations I see uses IoC containers. I want to implement the application without these frameworks as I want to understand how it works. Some have mentioned using controllers for navigation but I can't seem to find a simple and short example.
Basically, I need a short and simple example of how it navigation is done in WPF MVVM.
I am new to WPF and I am facing a problem here. In one of our application, few dialogs responsible for similar kind of work. All dialogs have OK and APPLY buttons. But in our new UI Design, these will be displayed on a side bar which is a panel(Yet to decide control). I thought of having a Base Usercontrol which will have OK and APPLY button with few methods. And my other dialogs(which are Usercontrols now in new UI) are derived from this Base User Control.
I downloaded few code samples from internet, but problem didn't solve.
If you have any idea/code sample please share.
Thanks in advance.
WPF (also WinForm to some extent) doesn't play well with inheritance. You could create the UI in C# code and get inheritance working but I don't think designer play well so you'll be stuck in design mode and in Blend.
To work around it you could create piece of functionality that you want to reuse and use composition instead of inheritance, which is considered a better approach anyway.
Here is my problem: I am migrating an application from Windows Forms to WPF, but I am totally new in WPF technology.
I have been lucky creating a ribbon also have been able to add some elements to it, but right now I am struggling to create a modal dialog.
How can I achieve this? I have already created all the design of the dialog, but I cannot get it open as a modal window.
Besides, since this application has to be developed under MVVM pattern, where could I place that code? According to what I've read, that code has to be place in the view class, am I right?.
Thank you in advance.
You show a WPF Window modally using Window.ShowDialog. Also this WPF Window Overview will help.
Besides, since this application has to be developed under MVVM
pattern, where could I place that code?
Look under the Related questions to your right, there are many answers to this question in there. For example:
Open dialog in WPF MVVM
I'm new to wpf and have just been given a project to create a set of custom controls which will be used to make a previous windows forms application more manageable and current. However I cannot seem to find much info with regards to customising the built in Listbox, this would involve preferably replacing the scroll bar and the +/- buttons with custom images etc..
Just wondered if anyone knows how to get at these ?
Thanks in advance.
Check here for the default control template of the listbox.You can customize the scrollviewer there to do what you are looking for.Check the below article to get started
Using Templates to Customize WPF Controls
Learn about WPF styling and templating. Other than that, the question is too generic for SO. Read the article (and perhaps google some more articles on the topic), try to style the listbox and come back with specific issues. WPF is not easy to get into, but it is definitely worth the time.