Click here to Skip to main content
11,631,340 members (73,728 online)
Click here to Skip to main content
Add your own
alternative version

Exploring a Model-View-ViewModel Application; WPF Password Manager, Cipher Text

, 28 Dec 2008 CPOL 305.5K 7.6K 244
An article exploring Model-View-ViewModel (MVVM) WPF UI Design Pattern as leveraged in a WPF Password Manager. Password Manager allows user to modify the shape and behavior of a record at run-time.
CipherText-Release-v1.zip
CipherText.exe
CipherText-Release.zip
CipherText.exe
CipherText-Source-v1.zip
CipherText
CipherText
bin
Debug
Release
CipherText.csi
CipherText.vbproj.user
Class Diagram
CommandViewClassDiagram.cd
FieldEditorClassDiagram.cd
RelayCommandClassDiagram.cd
Command
Converter
DataTemplateSelector
Deep Copy
EventArgs
Fonts
OCRAEXT.TTF
Model
My Project
MyExtensions
Settings.settings
Random Password
Resources
Images
add.png
allRecords.png
bank.png
creditCards.png
delete.png
edit.png
email.png
engineer.png
firewall.png
hardware.png
key.png
keyPad.png
LockedUser.ico
server.png
softwareLicense.png
visa.png
vpn.png
webSite.png
String Formatting
SubsetFont.targets
SubsetFontTask.dll
Validation Rules - Helper
View
ViewModel
XAML Shield
CipherText.sln.cache
CipherText.suo
CipherText-Source.zip
CipherText.csi
CipherText.vbproj.user
CommandViewClassDiagram.cd
FieldEditorClassDiagram.cd
RelayCommandClassDiagram.cd
OCRAEXT.TTF
Settings.settings
obj
add.png
allRecords.png
bank.png
creditCards.png
delete.png
edit.png
email.png
engineer.png
firewall.png
hardware.png
key.png
keyPad.png
LockedUser.ico
server.png
softwareLicense.png
visa.png
vpn.png
webSite.png
SubsetFont.targets
SubsetFontTask.dll
CipherText.sln.cache
CipherText.suo
<Window x:Class="ModifyCaseCorrectionView" WindowStyle="ToolWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:CipherText" Title="Modify Casing Rules" MaxWidth="340" Height="500" Width="340">

    <Window.Resources>
        <DataTemplate DataType="{x:Type local:CharacterCasingCheckViewModel}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="50" />
                </Grid.ColumnDefinitions>

                <TextBox Grid.Column="0" Width="80" Text="{Binding Path=CharacterCasingCheck.LookFor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" />
                <TextBox Grid.Column="1" Width="80" Text="{Binding Path=CharacterCasingCheck.ReplaceWith, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" />
                <Button HorizontalAlignment="Center" Grid.Column="2" IsTabStop="False" Command="{Binding Path=DeleteCharacterCasingCheckCommand}" CommandParameter="{Binding}" ToolTip="Click to delete this casing rule." Height="14" Width="14" Style="{StaticResource gridButtonStyle}">
                    <Image Source="{StaticResource deleteImage}" Stretch="UniformToFill" />
                </Button>

            </Grid>
        </DataTemplate>
    </Window.Resources>

    <Grid Background="#FF3A3A3A">

        <Grid.OpacityMask>
            <LinearGradientBrush EndPoint="0.995,0.982" StartPoint="0.028,0.035">
                <GradientStop Color="#FF000000" Offset="0.129" />
                <GradientStop Color="#DDFFFFFF" Offset="1" />
            </LinearGradientBrush>
        </Grid.OpacityMask>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <TextBlock Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Top" FontFamily="./../Fonts/#OCR A" FontSize="18" FontWeight="Bold" Foreground="#FFFFFFFF" Text="Modify Casing Rules" Margin="7">
    		<TextBlock.Effect>
    			<DropShadowEffect />
    		</TextBlock.Effect>
        </TextBlock>
        
        <TextBlock Grid.Row="1" Margin="11,0,0,0" Foreground="WhiteSmoke" Text="Please view 'How To' video before using this feature." />

        <Border Background="{StaticResource editingFormBackgroundBrush}" Margin="11,11,11,20" Grid.Row="2" BorderBrush="LightGray" BorderThickness="2" CornerRadius="7,0,7,7" Padding="10">

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Border Padding="2" Background="#FFB3B3B3" BorderThickness="1" CornerRadius="4,0,4,4" BorderBrush="#FF000000">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100" />
                            <ColumnDefinition Width="100" />
                            <ColumnDefinition Width="50" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="Look For" />
                        <TextBlock Text="Replace With" Grid.Column="1" />
                        <TextBlock Text="Del" Grid.Column="2" HorizontalAlignment="Center" />
                    </Grid>
                </Border>

                <ScrollViewer Margin="0,3,0,0" x:Name="svCharacterCasingCheckViewModels" Grid.Row="1" Style="{StaticResource FavsScrollViewer}" VerticalScrollBarVisibility="Visible">
                    <ItemsControl ItemsSource="{Binding Path=CharacterCasingCheckViewModels}" FocusVisualStyle="{x:Null}" IsTabStop="False" />
                </ScrollViewer>

                <Button Margin="11,11,44,11" Focusable="False" Grid.Row="2" HorizontalAlignment="Right" IsTabStop="False" Command="{Binding Path=AddCharacterCasingCheckCommand}" ToolTip="Click to add a casing rule." Height="18" Width="18" Style="{StaticResource gridButtonStyle}">
                    <Image Source="{StaticResource addImage}" Stretch="UniformToFill" />
                </Button>
            </Grid>

        </Border>

        <Border Grid.Row="2" Background="{StaticResource formAndButtonBarsBrush}" Margin="20,0,20,8" VerticalAlignment="Bottom" Padding="3.5" BorderBrush="Black" BorderThickness="1" CornerRadius="7,0,7,7" HorizontalAlignment="Stretch">
            <StackPanel HorizontalAlignment="Center" Margin="3.5" Orientation="Horizontal">
                <TextBlock Margin="11,0" FontSize="12"><Hyperlink Command="{Binding Path=SaveCommand}" ToolTip="Click to save changes and close."><Run Text="Save" /></Hyperlink></TextBlock>
                <TextBlock Margin="11,0" FontSize="12"><Hyperlink Command="{Binding Path=CancelCommand}" ToolTip="Click to cancel."><Run Text="Cancel" /></Hyperlink></TextBlock>
                <Button Visibility="Visible" IsTabStop="False" Focusable="False" Height="1" Width="1" IsCancel="True" Command="{Binding Path=CancelCommand}" />
            </StackPanel>
        </Border>

    </Grid>

</Window>
		

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

Karl Shifflett
Architect Gayle Manufacturing Company
United States United States
Karl loves .NET, WPF, WCF, ASP.NET, VB.NET and C#.

Awards:

  • December 2008 VB.NET Code Project Article Award
  • 2009 Code Project MVP
  • 2008 Code Project MVP
  • 2008 Microsoft MVP - Client App Dev
  • December 2007 VB.NET Code Project Article Award
  • Gold Medal Winner at IBM's 1998 PROIV Programming Contest in Las Vegas
Click here to check out my Blog

Click here to learn about Mole 2010 debugging tool for Visual Studio 2010

Click here to read about XAML Power Toys

Just a grain of sand on the worlds beaches.


You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150723.1 | Last Updated 29 Dec 2008
Article Copyright 2008 by Karl Shifflett
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid