萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> asp.net編程 >> 高仿Windows Phone QQ登錄界面實例代碼

高仿Windows Phone QQ登錄界面實例代碼

 這篇文章主要介紹了高仿Windows Phone QQ登錄界面實例代碼,有需要的朋友可以參考一下

給 TextBox文本框前添加圖片   擴展PhoneTextBox:添加一個類“ExtentPhoneTextBox”繼承 PhoneTextBox ,在“ExtentPhoneTextBox”類中添加屬性項:     代碼如下: public class ExtentPhoneTextBox : PhoneTextBox     {         /// <summary>         /// 文本框圖片屬性         /// </summary>         public static readonly DependencyProperty TextHeadImageProperty =             DependencyProperty.Register("TextHeadImage", typeof(ImageSource), typeof(ExtentPhoneTextBox), new PropertyMetadata(null)             );           /// <summary>         /// 文本框頭圖片         /// </summary>         public ImageSource TextHeadImage         {             get { return base.GetValue(TextHeadImageProperty) as ImageSource; }             set { base.SetValue(TextHeadImageProperty, value); }         }           /// <summary>         /// 文本圖片寬度         /// </summary>         public double TextHeadImageWidth         {             get { return (double)GetValue(TextHeadImageWidthProperty); }             set { SetValue(TextHeadImageWidthProperty, value); }         }           // Using a DependencyProperty as the backing store for TextHeadImageWidth.  This enables animation, styling, binding, etc...         public static readonly DependencyProperty TextHeadImageWidthProperty =             DependencyProperty.Register("TextHeadImageWidth", typeof(double), typeof(ExtentPhoneTextBox), new PropertyMetadata(null));           /// <summary>         /// 文本圖片高度         /// </summary>         public double TextHeadImageHeight         {             get { return (double)GetValue(TextHeadImageHeightProperty); }             set { SetValue(TextHeadImageHeightProperty, value); }         }           // Using a DependencyProperty as the backing store for TextHeadImageHeight.  This enables animation, styling, binding, etc...         public static readonly DependencyProperty TextHeadImageHeightProperty =             DependencyProperty.Register("TextHeadImageHeight", typeof(double), typeof(ExtentPhoneTextBox), new PropertyMetadata(null));     } }     全部樣式如下:     復制代碼 代碼如下: <DataTemplate x:Key="ControlHeaderTemplate">             <TextBlock FontSize="{StaticResource PhoneFontSizeNormal}" FontFamily="{StaticResource PhoneFontFamilyNormal}" LineStackingStrategy="BlockLineHeight" LineHeight="23.333" Margin="0,-9,0,0" TextWrapping="Wrap" Text="{Binding}">                 <TextBlock.RenderTransform>                     <TranslateTransform X="-1" Y="4"/>                 </TextBlock.RenderTransform>             </TextBlock>         </DataTemplate>         <toolkit:SingleDataTemplateSelector x:Key="ControlHeaderTemplateSelector" Template="{StaticResource ControlHeaderTemplate}"/>         <Style x:Key="ExtentPhoneTextBoxStyle" TargetType="ExtentCtrs:ExtentPhoneTextBox">             <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>             <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>             <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>             <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>             <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"/>             <Setter Property="SelectionBackground" Value="{StaticResource PhoneAccentBrush}"/>             <Setter Property="SelectionForeground" Value="{StaticResource PhoneTextBoxSelectionForegroundBrush}"/>             <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>             <Setter Property="Padding" Value="6,0,6,4"/>             <Setter Property="HorizontalContentAlignment" Value="Left"/>             <Setter Property="Template">                 <Setter.Value>                     <ControlTemplate TargetType="ExtentCtrs:ExtentPhoneTextBox">                         <Grid x:Name="RootGrid" Background="Transparent">                             <Grid.RowDefinitions>                                 <RowDefinition Height="Auto"/>                                 <RowDefinition/>                             </Grid.RowDefinitions>                             <VisualStateManager.VisualStateGroups>                                 <VisualStateGroup x:Name="CommonStates">                                     <VisualState x:Name="Normal"/>                                     <VisualState x:Name="Disabled">                                         <Storyboard>                                             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Header">      
copyright © 萬盛學電腦網 all rights reserved