Silverlight 代水印的查询文本框 Style

image

 

<TextBox x:Name="TextBoxFilter" Margin="6,0,6,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" ToolTipService.ToolTip="Enter search text to filter services" TextChanged="TextBox_TextChanged">
                                <TextBox.Template>
                                    <ControlTemplate TargetType="TextBox">
                                        <Grid>
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup x:Name="CommonStates">
                                                    <VisualState x:Name="Normal"/>
                                                    <VisualState x:Name="MouseOver"/>
                                                    <VisualState x:Name="Disabled"/>
                                                    <VisualState x:Name="ReadOnly"/>
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="ValidationStates">
                                                    <VisualState x:Name="InvalidUnfocused"/>
                                                    <VisualState x:Name="Valid"/>
                                                    <VisualState x:Name="InvalidFocused"/>
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="FocusStates">
                                                    <VisualState x:Name="Unfocused"/>
                                                    <VisualState x:Name="Focused">
                                                        <Storyboard>
                                                            <DoubleAnimation
                                                                BeginTime="00:00:00"
                                                                Duration="00:00:00.1"
                                                                Storyboard.TargetName="borderHighlight"
                                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                To="1"
                                                                />
                                                        </Storyboard>
                                                    </VisualState>
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>
                                            <Grid>
                                                <Border x:Name="border" Height="24" BorderThickness="1,1,1,1" CornerRadius="12" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
                                                    <Border.BorderBrush>
                                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                                            <GradientStop Offset="0.0" Color="#A7A7A7"/>
                                                            <GradientStop Offset="1.0" Color="#C3C3C3"/>
                                                        </LinearGradientBrush>
                                                    </Border.BorderBrush>
                                                    <Border.Background>
                                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                                            <GradientStop Offset="0.00" Color="#DDDDDD"/>
                                                            <GradientStop Offset="0.25" Color="#FFFFFF"/>
                                                            <GradientStop Offset="1.00" Color="#FFFFFF"/>
                                                        </LinearGradientBrush>
                                                    </Border.Background>
                                                    <Border.Effect>
                                                        <DropShadowEffect Color="White" ShadowDepth="1" Direction="315" BlurRadius="0" Opacity="1" />
                                                    </Border.Effect>
                                                    <Grid>
                                                        <Image Margin="0,0,12,0" Source="Resources/search.png" Stretch="None" HorizontalAlignment="Right" VerticalAlignment="Center"/>
                                                        <TextBlock Text="Filter..." Foreground="LightGray" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Visibility="{Binding ElementName=TextBoxFilter, Path=Text, Mode=OneWay, Converter={StaticResource IsEmptyStringConverter}}"/>
                                                        <ScrollViewer x:Name="ContentElement" Margin="8,0,25,0" BorderThickness="0" IsTabStop="False" VerticalAlignment="Center"/>
                                                    </Grid>
                                                </Border>
                                                <Border x:Name="borderHighlight" Opacity="0" BorderBrush="Green" Height="24" BorderThickness="2,2,2,2" CornerRadius="12" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"/>
                                            </Grid>
                                        </Grid>
                                    </ControlTemplate>
                                </TextBox.Template>
                            </TextBox>
posted @ 2012-12-12 17:47  阳光追梦  阅读(1189)  评论(1编辑  收藏  举报
/*快速评论*/ #div_digg { position: fixed; bottom: 10px; right: 15px; border: 2px solid #ECD7B1; padding: 10px; width: 140px; background-color: #fff; border-radius: 5px 5px 5px 5px !important; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); } /** 不知道为什么页面加载完成时还读不到div_digg。可能也是动态生成的。 所以这里只能用定时器 不断的读取,当读取到了再给它动态添加快捷按钮 **/ //自定义 定时器[当元素加载完成是执行回调函数] function customTimer(inpId,fn) { if ($(inpId).length) { fn(); } else { var intervalId = setInterval(function () { if ($(inpId).length) { //如果存在了 clearInterval(intervalId); // 则关闭定时器 customTimer(inpId,fn); //执行自身 } }, 100); } } //页面加载完成是执行 $(function () { customTimer("#div_digg", function () { var div_html = "
\ 关注\  | \ 顶部\  | \ 评论\
"; $("#div_digg").append(div_html); //tbCommentBody }); });