wp中TextBox介绍

<!-- 自定义样式 -->
    <phone:PhoneApplicationPage.Resources>
        <ResourceDictionary>
            <Style x:Key="TextBoxStyle1" TargetType="TextBox">
                <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"></Setter>
                <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"></Setter>
                <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"></Setter>
                <Setter Property="Foreground" Value="Blue"></Setter>
                <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"></Setter>
                <Setter Property="SelectionBackground" Value="{StaticResource PhoneAccentBrush}"></Setter>
                <Setter Property="SelectionForeground" Value="{StaticResource PhoneTextBoxSelectionForegroundBrush}"></Setter>
                <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"></Setter>
                <Setter Property="Padding" Value="2"></Setter>
            </Style>
        </ResourceDictionary>
    </phone:PhoneApplicationPage.Resources>

  

<TextBox Style="{StaticResource TextBoxStyle1}" Margin="12,31,22,473" Name="TextBox1" TextWrapping="Wrap" HorizontalScrollBarVisibility="Disabled" AcceptsReturn="True" TextChanged="TextBox1_TextChanged"></TextBox>
            <TextBlock Height="60" HorizontalAlignment="Left" Margin="12,221,0,0" Name="TextBlock1" Text="" VerticalAlignment="Top" Width="364"></TextBlock>
            <TextBlock Height="43" HorizontalAlignment="Left" Margin="12,172,0,0" Name="TextBlock2" Text="获取TextBox的输入:" VerticalAlignment="Top" Width="186"></TextBlock>

  为TextBox自定义了样式,然后TextBox就可以使用自己定义的样式资源。

posted on 2013-06-19 22:27  wp456  阅读(231)  评论(0)    收藏  举报

导航