Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Model View Presenter with WPF and Unity Container

, 1 Jan 2009 CPOL
This article demonstrates using a model view presenter (MVP) pattern in a sample program.
<CustomerInfoObserver:BaseView x:Class="CustomerInfoObserver.CustomerView"
    x:TypeArguments="CustomerInfoObserver:ICustomerView, CustomerInfoObserver:CustomerPresenter"
    Title="Window1" Height="255" Width="341"
        <Label Height="28" HorizontalAlignment="Left" Margin="15,115,0,0" Name="lblCustomer" VerticalAlignment="Top" Width="64">Customer:</Label>
        <TextBox Height="23" Name="txtCustomerName" 
               VerticalAlignment="Top" Margin="86,117,11,0"                   
               Text="{Binding Path=CustomerName, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"/>       
        <Button Margin="15,155,11,0" Name="btnAddCustomer" Click="btnAddCustomer_Click" Height="28" VerticalAlignment="Top">Change Customer</Button>
        <Label Margin="15,43,-15,0" Height="28" VerticalAlignment="Top">Note: Data binding helps synchronise the content between</Label>
        <Label Height="25" Margin="15,63,-15,0" VerticalAlignment="Top"> UI screen and underlying data model.</Label>
        <Label Height="28" Margin="15,14,0,0" Name="label1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120">MVP Example</Label>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

suraj mehare

India India
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150414.1 | Last Updated 1 Jan 2009
Article Copyright 2009 by suraj mehare
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid