Answers for "wpf placeholder text"

C#
0

wpf placeholder text

/*In xaml*/
<!-- Place holder text  -->
        <TextBlock IsHitTestVisible="False" Text="Change text" VerticalAlignment="Top" HorizontalAlignment="Left" TextAlignment="Left" Margin="454,352,0,0" FontSize="40" Foreground="DarkGray" Width="352" Height="47">
            <TextBlock.Style>
                <Style TargetType="{x:Type TextBlock}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Text,ElementName=/*Enter the text box to bind to*/}" Value="">
                            <Setter Property="Visibility" Value="Visible" />
                        </DataTrigger>
                    </Style.Triggers>
                    <Setter Property="Visibility" Value="Hidden" />
                </Style>
            </TextBlock.Style>
        </TextBlock>
        <!-- Place holder text end  -->
Posted by: Guest on September-03-2021

C# Answers by Framework

Browse Popular Code Answers by Language