# HG changeset patch # User stevenh7776 stevenhollidge@hotmail.com # Date 1331723196 -25200 # Node ID 8049f7c58c2bf8891f6b4cec78b923331c9c0c07 # Parent 7721a12703638e729c84fb525e31d700d550be98 Login form 75% there diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf.Xaml/Controls/PlayerControl.xaml --- a/MetroWpf/MetroWpf.Xaml/Controls/PlayerControl.xaml Wed Mar 14 01:23:57 2012 +0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - - - - - diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf.Xaml/Controls/PlayerControl.xaml.cs --- a/MetroWpf/MetroWpf.Xaml/Controls/PlayerControl.xaml.cs Wed Mar 14 01:23:57 2012 +0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -using System.ComponentModel; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -namespace MetroWpf.Xaml.Controls -{ - - /// - /// Interaction logic for PlayerControl.xaml - /// - public partial class PlayerControl : UserControl - { - #region Dependency Properties - - public static readonly DependencyProperty ShirtNumberProperty - = DependencyProperty.Register("ShirtNumber", - typeof(int), - typeof(PlayerControl), - new PropertyMetadata(0)); - - [Bindable(true)] - public int ShirtNumber - { - get { return (int)this.GetValue(ShirtNumberProperty); } - set { this.SetValue(ShirtNumberProperty, value); } - } - - public static readonly DependencyProperty KitColorProperty - = DependencyProperty.Register("KitColor", - typeof(Brush), - typeof(PlayerControl), - new PropertyMetadata(new SolidColorBrush(Color.FromArgb(0,0,0,0)))); - - [Bindable(true)] - public Brush KitColor - { - get { return (Brush)this.GetValue(KitColorProperty); } - set { this.SetValue(KitColorProperty, value); } - } - - public static readonly DependencyProperty SurnameProperty - = DependencyProperty.Register("Surname", - typeof(string), - typeof(PlayerControl), - new PropertyMetadata("Not set")); - - [Bindable(true)] - public string Surname - { - get { return (string)this.GetValue(SurnameProperty); } - set { this.SetValue(SurnameProperty, value); } - } - - public static readonly DependencyProperty PositionProperty - = DependencyProperty.Register("Position", - typeof(string), - typeof(PlayerControl), - new PropertyMetadata("Not set")); - - [Bindable(true)] - public string Position - { - get { return (string)this.GetValue(PositionProperty); } - set { this.SetValue(PositionProperty, value); } - } - - #endregion - - public PlayerControl() - { - InitializeComponent(); - } - } -} diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf.Xaml/Controls/WatermarkTextBox.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Controls/WatermarkTextBox.cs Wed Mar 14 18:06:36 2012 +0700 @@ -0,0 +1,79 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Microsoft.Windows.Controls +{ + public class WatermarkTextBox : TextBox + { + #region Properties + + #region SelectAllOnGotFocus + + public static readonly DependencyProperty SelectAllOnGotFocusProperty = DependencyProperty.Register("SelectAllOnGotFocus", typeof(bool), typeof(WatermarkTextBox), new PropertyMetadata(false)); + public bool SelectAllOnGotFocus + { + get { return (bool)GetValue(SelectAllOnGotFocusProperty); } + set { SetValue(SelectAllOnGotFocusProperty, value); } + } + + #endregion //SelectAllOnGotFocus + + #region Watermark + + public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register("Watermark", typeof(object), typeof(WatermarkTextBox), new UIPropertyMetadata(null)); + public object Watermark + { + get { return (object)GetValue(WatermarkProperty); } + set { SetValue(WatermarkProperty, value); } + } + + #endregion //Watermark + + #region WatermarkTemplate + + public static readonly DependencyProperty WatermarkTemplateProperty = DependencyProperty.Register("WatermarkTemplate", typeof(DataTemplate), typeof(WatermarkTextBox), new UIPropertyMetadata(null)); + public DataTemplate WatermarkTemplate + { + get { return (DataTemplate)GetValue(WatermarkTemplateProperty); } + set { SetValue(WatermarkTemplateProperty, value); } + } + + #endregion //WatermarkTemplate + + #endregion //Properties + + #region Constructors + + static WatermarkTextBox() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(WatermarkTextBox), new FrameworkPropertyMetadata(typeof(WatermarkTextBox))); + } + + #endregion //Constructors + + #region Base Class Overrides + + protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e) + { + if (SelectAllOnGotFocus) + SelectAll(); + + base.OnGotKeyboardFocus(e); + } + + protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) + { + if (!IsKeyboardFocused) + { + e.Handled = true; + Focus(); + } + + base.OnPreviewMouseLeftButtonDown(e); + } + + #endregion //Base Class Overrides + } +} diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf.Xaml/Converters/BoolVisibilityConverter.cs --- a/MetroWpf/MetroWpf.Xaml/Converters/BoolVisibilityConverter.cs Wed Mar 14 01:23:57 2012 +0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -// http://drwpf.com/blog/2009/03/17/tips-and-tricks-making-value-converters-more-accessible-in-markup/ -// to use in xaml: - -using System; -using System.Windows; -using System.Windows.Data; -using System.Windows.Markup; - -namespace MetroWpf.Xaml.Converters -{ - public class BoolVisibilityConverter : MarkupExtension, IValueConverter - { - private static BoolVisibilityConverter _boolVisibilityConverter = null; - - public override object ProvideValue(IServiceProvider serviceProvider) - { - if (null == _boolVisibilityConverter) - _boolVisibilityConverter = new BoolVisibilityConverter(); - - return _boolVisibilityConverter; - } - - #region IValueConverter Members - - public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - return (bool)value ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - throw new NotImplementedException(); - } - - #endregion - } -} diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf.Xaml/Converters/BooleanToVisibilityConverter.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Converters/BooleanToVisibilityConverter.cs Wed Mar 14 18:06:36 2012 +0700 @@ -0,0 +1,49 @@ +// http://drwpf.com/blog/2009/03/17/tips-and-tricks-making-value-converters-more-accessible-in-markup/ +// to use in xaml: + +using System; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using System.Globalization; + +namespace MetroWpf.Xaml.Converters +{ + public class BooleanToVisibilityConverter : MarkupExtension, IValueConverter + { + private static BooleanToVisibilityConverter booleanToVisibilityConverter = null; + + public override object ProvideValue(IServiceProvider serviceProvider) + { + if (null == booleanToVisibilityConverter) + booleanToVisibilityConverter = new BooleanToVisibilityConverter(); + + return booleanToVisibilityConverter; + } + + public bool IsReversed { get; set; } + public bool UseHidden { get; set; } + + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var val = System.Convert.ToBoolean(value, CultureInfo.InvariantCulture); + if (this.IsReversed) + { + val = !val; + } + if (val) + { + return Visibility.Visible; + } + return this.UseHidden ? Visibility.Hidden : Visibility.Collapsed; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +} diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf.Xaml/MetroWpf.Xaml.csproj --- a/MetroWpf/MetroWpf.Xaml/MetroWpf.Xaml.csproj Wed Mar 14 01:23:57 2012 +0700 +++ b/MetroWpf/MetroWpf.Xaml/MetroWpf.Xaml.csproj Wed Mar 14 18:06:36 2012 +0700 @@ -50,13 +50,11 @@ - - PlayerControl.xaml - + - + @@ -80,7 +78,7 @@ - + MSBuild:Compile Designer diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf.Xaml/Styles/Controls.WatermarkTextBox.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Styles/Controls.WatermarkTextBox.xaml Wed Mar 14 18:06:36 2012 +0700 @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf/Presentation/Login/LoginView.xaml --- a/MetroWpf/MetroWpf/Presentation/Login/LoginView.xaml Wed Mar 14 01:23:57 2012 +0700 +++ b/MetroWpf/MetroWpf/Presentation/Login/LoginView.xaml Wed Mar 14 18:06:36 2012 +0700 @@ -4,9 +4,14 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" - DataContext="{Binding LoginViewModel, Source={StaticResource Locator}}" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="292" d:DesignWidth="392"> + xmlns:converters="clr-namespace:MetroWpf.Xaml.Converters;assembly=MetroWpf.Xaml" + xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=MetroWpf.Xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d" + DataContext="{Binding LoginViewModel, Source={StaticResource Locator}}"> - + @@ -14,17 +19,32 @@ + + + - + + + WELCOME + + + + @@ -38,30 +58,29 @@ - - - + - + Width="220" MaxLength="50" Margin="3.5" /> - @@ -80,27 +99,31 @@ - - - diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf/Presentation/Menu/MenuView.xaml --- a/MetroWpf/MetroWpf/Presentation/Menu/MenuView.xaml Wed Mar 14 01:23:57 2012 +0700 +++ b/MetroWpf/MetroWpf/Presentation/Menu/MenuView.xaml Wed Mar 14 18:06:36 2012 +0700 @@ -13,44 +13,44 @@ - + - + - + - + - + - + - + diff -r 7721a1270363 -r 8049f7c58c2b MetroWpf/MetroWpf/Presentation/Shell/MainWindow.xaml --- a/MetroWpf/MetroWpf/Presentation/Shell/MainWindow.xaml Wed Mar 14 01:23:57 2012 +0700 +++ b/MetroWpf/MetroWpf/Presentation/Shell/MainWindow.xaml Wed Mar 14 18:06:36 2012 +0700 @@ -28,6 +28,7 @@ + @@ -42,7 +43,7 @@ VerticalAlignment="Top" Margin="0,4,0,0" Orientation="Horizontal" - Visibility="{Binding ShowTopRightOptions, Converter={converters:BoolVisibilityConverter}}"> + Visibility="{Binding ShowTopRightOptions, Converter={converters:BooleanToVisibilityConverter}}">