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

A Sample Silverlight 4 Application Using MEF, MVVM, and WCF RIA Services - Part 1

, 7 Jul 2011 CPOL
Part 1 of a series describing the creation of a Silverlight business application using MEF, MVVM Light, and WCF RIA Services.
IssueVisionforSilverlightSetup20110630.zip
IssueVision for Silverlight Setup
IssueVisionSetup.msi
setup.exe
IssueVision_for_Silverlight_setup.zip
IssueVisionSetup.msi
setup.exe
IssueVision_Silverlight20110630.zip
IssueVision.Silverlight
Assemblies
GalaSoft.MvvmLight.Extras.SL4.dll
GalaSoft.MvvmLight.SL4.dll
MenuControls.dll
System.Windows.Controls.DataVisualization.Toolkit.dll
System.Windows.Controls.Toolkit.dll
System.Windows.Controls.Toolkit.Internals.dll
System.Windows.Interactivity.dll
Database
IssueVision.Client
IssueVision.Client.csproj.user
Assets
Signin.png
Controls
Properties
Views
IssueVision.Common
IssueVision.Common.csproj.user
Controls
Helpers
Models
Properties
Resources
Themes
IssueVision.Data
IssueVision.Data.csproj.user
Properties
Web
Resources
IssueVision.Data.Web
IssueVision.edmx
Helpers
MetadataClasses
Properties
Resources
Services
IssueVision.Model
IssueVision.Model.csproj.user
Properties
IssueVision.Setup
IssueVisionSetup.vdproj
IssueVision.ViewModel
IssueVision.ViewModel.csproj.user
Properties
IssueVision.Web
IssueVision.Web.csproj.user
Properties
IssueVision_Silverlight_20110316.zip
GalaSoft.MvvmLight.Extras.SL4.dll
GalaSoft.MvvmLight.SL4.dll
MenuControls.dll
System.Windows.Controls.DataVisualization.Toolkit.dll
System.Windows.Controls.Toolkit.dll
System.Windows.Controls.Toolkit.Internals.dll
System.Windows.Interactivity.dll
IssueVision.Client.csproj.user
Signin.png
DataSources
IssueVision.Data.Web.IssueVisionContext.datasource
IssueVision.Data.Web.PasswordResetContext.datasource
IssueVision.Common.csproj.user
IssueVision.Data.csproj.user
IssueVision.edmx
DataTypes
IssueVision.Model.csproj.user
IssueVisionSetup.vdproj
IssueVision.ViewModel.csproj.user
IssueVision.Web.csproj.user
IssueVision_Silverlight_20110606.zip
GalaSoft.MvvmLight.Extras.SL4.dll
GalaSoft.MvvmLight.SL4.dll
MenuControls.dll
System.Windows.Controls.DataVisualization.Toolkit.dll
System.Windows.Controls.Toolkit.dll
System.Windows.Controls.Toolkit.Internals.dll
System.Windows.Interactivity.dll
IssueVision.Client.csproj.user
Signin.png
IssueVision.Common.csproj.user
IssueVision.Data.csproj.user
IssueVision.edmx
IssueVision.Model.csproj.user
IssueVisionSetup.vdproj
IssueVision.ViewModel.csproj.user
IssueVision.Web.csproj.user
IssueVision_Silverlight_Setup.zip
IssueVisionSetup.msi
setup.exe
<UserControl x:Class="IssueVision.Client.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:system="clr-namespace:System;assembly=mscorlib" 
    xmlns:local="clr-namespace:IssueVision.Client;assembly=IssueVision.Client"
    xmlns:common="clr-namespace:IssueVision.Common;assembly=IssueVision.Common"
    xmlns:menu="clr-namespace:System.Windows.Controls;assembly=MenuControls"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
    
    <UserControl.Resources>
        <common:NotOperatorValueConverter x:Key="notOperatorValueConverter"/>
        <common:BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter"/>
    </UserControl.Resources>

    <toolkit:BusyIndicator Style="{StaticResource BusyIndicatorStyle}" IsBusy="{Binding Path=IsBusy}">
        <common:MainPageControl x:Name="mainPageControl" IsLoggedIn="{Binding Path=IsLoggedIn}">
            <common:MainPageControl.TitleContent>
                <toolkit:DockPanel Style="{StaticResource MainPageTitleStyle}">
                    <TextBlock Text="ISSUEVISION" Style="{StaticResource MainPageTitleTextOneStyle}"/>
                    <TextBlock Text="for Silverlight" Style="{StaticResource MainPageTitleTextTwoStyle}"/>
                    <StackPanel Visibility="{Binding Path=IsLoggedIn, 
                                             Mode=OneWay, 
                                             Converter={StaticResource booleanToVisibilityConverter}}"
                                Style="{StaticResource LogoutPanelStyle}">
                        <TextBlock Text="{Binding Path=WelcomeText}"
                                   Style="{StaticResource WelcomeTextStyle}"/>
                        <TextBlock Text="|" Style="{StaticResource SpacerStyle}"/>
                        <TextBlock Text="{Binding Path=CurrentScreenText}"
                                   Style="{StaticResource CurrentScreenTextStyle}"/>
                        <TextBlock Text="|" Style="{StaticResource SpacerStyle}"/>
                        <HyperlinkButton x:Name="hyperlinkButton_Logout" Content="logout" 
                                         Style="{StaticResource LogoutButtonStyle}"
                                         Command="{Binding Path=LogoutCommand}"
                                         IsEnabled="{Binding Path=IsLoggedOut,
                                                     Mode=OneWay, 
                                                     Converter={StaticResource notOperatorValueConverter}}">
                            <HyperlinkButton.CommandParameter>
                                <system:Boolean>false</system:Boolean>
                            </HyperlinkButton.CommandParameter>
                        </HyperlinkButton>
                    </StackPanel>
                </toolkit:DockPanel>
            </common:MainPageControl.TitleContent>
            <common:MainPageControl.LoggedInMenuContent>
                <menu:Menu Style="{StaticResource LoggedInMenuStyle}">
                    <menu:MenuItem Header="Home"
                                   Command="{Binding Path=ChangeScreenCommand}"
                                   CommandParameter="Home"/>
                    <menu:MenuItem Header="Issues">
                        <menu:MenuItem Header="New Issue"
                                       Command="{Binding Path=ChangeScreenCommand}"
                                       CommandParameter="New Issue"/>
                        <menu:MenuItem Header="My Issues"
                                       Command="{Binding Path=ChangeScreenCommand}"
                                       CommandParameter="My Issues"/>
                        <menu:MenuItem Header="All Issues"
                                       Command="{Binding Path=ChangeScreenCommand}"
                                       CommandParameter="All Issues"/>
                    </menu:MenuItem>
                    <menu:MenuItem Header="Reports">
                        <menu:MenuItem Header="Bug Report"
                                       Command="{Binding Path=ChangeScreenCommand}"
                                       CommandParameter="Bug Report"/>
                    </menu:MenuItem>
                    <menu:MenuItem Header="Admin">
                        <menu:MenuItem Header="My Profile"
                                       Command="{Binding Path=ChangeScreenCommand}"
                                       CommandParameter="My Profile"/>
                        <menu:MenuItem Header="User Maintenance"
                                       Visibility="{Binding Path=IsAdmin, 
                                                    Mode=OneWay, 
                                                    Converter={StaticResource booleanToVisibilityConverter}}"
                                       Command="{Binding Path=ChangeScreenCommand}"
                                       CommandParameter="User Maintenance"/>
                    </menu:MenuItem>
                    <menu:MenuItem Header="Themes">
                        <menu:MenuItem Header="Bureau Blue"
                                       Command="{Binding Path=ChangeThemeCommand}"
                                       CommandParameter="BureauBlue.xaml"
                                       IsChecked="{Binding IsBureauBlueTheme}"/>
                        <menu:MenuItem Header="Expression Light"                                           
                                       Command="{Binding Path=ChangeThemeCommand}"
                                       CommandParameter="ExpressionLight.xaml"
                                       IsChecked="{Binding IsExpressionLightTheme}"/>
                        <menu:MenuItem Header="Shiny Blue"
                                       Command="{Binding Path=ChangeThemeCommand}"
                                       CommandParameter="ShinyBlue.xaml"
                                       IsChecked="{Binding IsShinyBlueTheme}"/>
                        <menu:MenuItem Header="Twilight Blue"
                                       Command="{Binding Path=ChangeThemeCommand}"
                                       CommandParameter="TwilightBlue.xaml"
                                       IsChecked="{Binding IsTwilightBlueTheme}"/>
                    </menu:MenuItem>
                </menu:Menu>
            </common:MainPageControl.LoggedInMenuContent>
            <common:MainPageControl.LoggedOutMenuContent>
                <menu:Menu Style="{StaticResource LoggedOutMenuStyle}">
                    <menu:MenuItem Header="Themes">
                        <menu:MenuItem Header="Bureau Blue"
                                       Command="{Binding Path=ChangeThemeCommand}"
                                       CommandParameter="BureauBlue.xaml"
                                       IsChecked="{Binding IsBureauBlueTheme}"/>
                        <menu:MenuItem Header="Expression Light"                                           
                                       Command="{Binding Path=ChangeThemeCommand}"
                                       CommandParameter="ExpressionLight.xaml"
                                       IsChecked="{Binding IsExpressionLightTheme}"/>
                        <menu:MenuItem Header="Shiny Blue"
                                       Command="{Binding Path=ChangeThemeCommand}"
                                       CommandParameter="ShinyBlue.xaml"
                                       IsChecked="{Binding IsShinyBlueTheme}"/>
                        <menu:MenuItem Header="Twilight Blue"
                                       Command="{Binding Path=ChangeThemeCommand}"
                                       CommandParameter="TwilightBlue.xaml"
                                       IsChecked="{Binding IsTwilightBlueTheme}"/>
                    </menu:MenuItem>
                </menu:Menu>
            </common:MainPageControl.LoggedOutMenuContent>
            <common:MainPageControl.LoginPageContent>
                <Grid Style="{StaticResource MainLoginPageStyle}">
                    <local:LoginForm HorizontalAlignment="Center" VerticalAlignment="Center" />
                </Grid>
            </common:MainPageControl.LoginPageContent>
            <common:MainPageControl.MainPageContent>
                <ContentControl x:Name="mainPageContent" Style="{StaticResource MainPageContentStyle}">
                    <local:Home/>
                </ContentControl>
            </common:MainPageControl.MainPageContent>
        </common:MainPageControl>
    </toolkit:BusyIndicator>
    
</UserControl>

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.

License

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

Share

About the Author

Weidong Shen
Software Developer (Senior)
United States United States
Weidong has been an information system professional since 1990. He has a Master's degree in Computer Science, and is currently a MCSD .NET

| Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 7 Jul 2011
Article Copyright 2010 by Weidong Shen
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid