“Textbox Placeholder WPF” Ответ

Заполнитель WPF

<TextBox
                        x:Name="tbxSeach"
                        Grid.Row="0"
                        Grid.Column="0"
                        Height="25"
                        Margin="10,0,10,0"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Bottom"
                        VerticalContentAlignment="Center"
                        Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                        TextAlignment="Left">
                        <TextBox.Resources>
                            <VisualBrush
                                x:Key="hinttext"
                                AlignmentX="Left"
                                Stretch="None"
                                TileMode="None">
                                <VisualBrush.Visual>
                                    <TextBlock
                                        FontStyle="Italic"
                                        Foreground="#959595"
                                        Text="Search..." />
                                </VisualBrush.Visual>
                            </VisualBrush>
                        </TextBox.Resources>
                        <TextBox.Style>
                            <Style BasedOn="{StaticResource TextBoxBase}" TargetType="TextBox">
                                <Setter Property="VerticalAlignment" Value="Center" />
                                <Setter Property="FontSize" Value="12" />
                                <Setter Property="Background" Value="Transparent" />
                                <Style.Triggers>
                                    <Trigger Property="Text" Value="">
                                        <Setter Property="Background" Value="{StaticResource hinttext}" />
                                    </Trigger>

                                    <Trigger Property="Text" Value="{x:Null}">
                                        <Setter Property="Background" Value="{StaticResource hinttext}" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </TextBox.Style>
                    </TextBox>
Sore Stork

Textbox Placeholder WPF

 <Grid Background="White" HorizontalAlignment="Right" VerticalAlignment="Top"  >
        <!-- overlay with hint text -->
        <TextBlock Margin="5,2" MinWidth="50" Text="Suche..." 
                   Foreground="LightSteelBlue" Visibility="{Binding ElementName=txtSearchBox, Path=Text.IsEmpty, Converter={StaticResource MyBoolToVisibilityConverter}}" IsHitTestVisible="False"/>
        <!-- enter term here -->
        <TextBox MinWidth="50" Name="txtSearchBox" Background="Transparent" />
    </Grid>
Sore Stork

Ответы похожие на “Textbox Placeholder WPF”

Вопросы похожие на “Textbox Placeholder WPF”

Больше похожих ответов на “Textbox Placeholder WPF” по HTML

Смотреть популярные ответы по языку

Смотреть другие языки программирования