Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Dynamically displaying UserControls On window and Sending Response to Parent Window ?

$
0
0

Hi

                                                                                             I am trying to Load user controls on Window dynamically and using MVVM architecture for this.To load the user control i am using a property of View model of Window and binding it to ContentControl in Window's Xaml like this :

<ContentControl HorizontalAlignment="Center" VerticalAlignment="Center" Content="{Binding UserControlViewModel}"/>

 Now suppose i have a lo-gin user control to which i am displaying first time in Window's ContentControl, by this user control i am checking authentication, means username and password is correct or not if it is correct, then

   1. I want to unload the current lo-gin user control from this view means from ContentControl and want to display

       some other User Control or view. so how can i achieve this because authentication is going to be on the click of a

       button inside lo-gin user control so from there(means user control's button click) if authentication is correct how can i

       change the view model property of window because i think for changing the view of Window inside ContentControl i

       have to make changes  in the property of Window's View model.

   2. If authentication is fail means username or password is not correct, then i want to show some notification in Window

       means in Window there is a Text Block to show error message,. So on the click of lo-gin user control's button how can

       i send a message or information regarding authentication fail to Parent window. To display on that Text Block.

Thanks

Ashutosh

        




Ashutosh Tiwari


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>