728x90
반응형

테스트박스가 비어있을 때 특정한 텍스트를 표시 하고 싶을때 사용합니다

("조회할 값을 입력해 주세요" 등..)

<Window x:Class="PlaceHolder.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

        mc:Ignorable="d"

        Title="MainWindow" Height="86.638" Width="227.155">

    <StackPanel>

        <Grid>

            <TextBox Name="searchTextBox" Margin="10"  Text="" Width="180" Height="32" HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center"/>

            <TextBlock Text="Search Name.." IsHitTestVisible="False" VerticalAlignment="Center" Margin="15,10,10,10" HorizontalAlignment="Left">

                <TextBlock.Style>

                    <Style TargetType="TextBlock">

                        <Setter Property="Visibility" Value="Hidden"/>

                        <Setter Property="Foreground" Value="Gray"/>

                        <Style.Triggers>

                            <DataTrigger Binding="{Binding Text, ElementName=searchTextBox}" Value="">

                                <Setter Property="Visibility" Value="Visible"/>

                            </DataTrigger>

                        </Style.Triggers>

                    </Style>

                </TextBlock.Style>

            </TextBlock>

        </Grid>

    </StackPanel>

</Window>



728x90
반응형

+ Recent posts