In our login view example, we have our button and that one does not have any click handler, but we
will change that now.
So let's say click, let's add a new event handler.
I don't want to do it that way.
I don't want to set a new event.
I want to do it manually.
I want to say login button and then clicked.
I want to hit enter.
I want to save it that way.
And now since the button is defined in our login view example, the login button clicked event handler
right here will also be defined in its correlated code behind file, which will then be login view dot
CSS.
So I will copy the name and then switch to the login view HTML CSS and then I will set it up from scratch.
So private void login button clicked object sender routed event args and we're good to go already.
So that works quite nice.
Now login button clicked in that moment when we click on our login button, we for sure want to switch
from our login view to our second view, which we haven't created yet.
Keep that just for a second.
So we prepared it and we will implement it just well as our next step.
Now, as I already said, when we start our application, it is empty.
But now we have created our login view and we want to display it here, right?
Because our login view should be the first thing that the user can see.
So therefore we can now go to our main window, HTML, CSS and you know that this is our starting point
right here, right?
So the main window or the initialized component, this is what will get called when we start our application.
So in our main window from our first lesson on this topic, we have created our content control.
So I'm in the main window.
Xaml here is our content control.
We can access it using its name property called Main Content.
So go to the code behind file of the main window and let's say main content dot content.
We already did this in the very first lesson.
On the second lesson of this chapter, we simply take our login view.
So we say new login view, and this is an absolute valid statement which will result in the fact that
when we start our application we will see that our login view will get displayed as the content inside
of our main window.
So we manually set the user control that we have created.
Our login view right here, a user control, a reusable component.
You can use that everywhere later on, right?
We set it as the content of our content control and we did that in the main window.
So this is why we can see our login screen right here.
So when we click on login, nothing will happen for sure.
We just shut down the application.
Okay.
So if you want to set the content of a content control, you can use its well content property and then
simply assign an instance.
So this is why we say new.
We create a new instance of our login view.
And please understand that our user controls are reusable components, right?
Later on we could well implement this user control our login view anywhere.
Right?
We can use it here in our main window, but we could use it anywhere else in our application.
It's kind of like a building block reusable component.
So now when we start our application, our main window shows our login view, which is amazing.
Now we need to move on because in our login view Xaml, we have our button defined and when we click
on our login button, it does not do anything.
Even though we have registered the handler right here, login button clicked and our login view, we
now need to set up our second user control for displaying any kind of data.
And just for example, we will show invoice data.
So we will call it invoice view.
One small thing I want to adjust is I want to go to the login view example and then go to the we got
that here.
Our label, it says login and I want to change it and say please login so that it's kind of differs
from the button text.
It's a little bit, well it looks a little bit nicer.
Awesome.
So let's create another item.
So our second user control, our invoice view and then we will see how we can change the content one
more time.
But this time in a slightly more advanced approach, which is absolutely required right here.