“Placeholder TextBox WPF” Kode Jawaban

Placeholder 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

Placeholder TextBox 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

Jawaban yang mirip dengan “Placeholder TextBox WPF”

Pertanyaan yang mirip dengan “Placeholder TextBox WPF”

Lebih banyak jawaban terkait untuk “Placeholder TextBox WPF” di HTML

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya