0

У меня есть стиль

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="TextBox" x:Key="AuthTextBox">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontWeight" Value="Medium"/>
        <Setter Property="Margin" Value="8"/>
    &lt;Setter Property=&quot;Template&quot;&gt;
        &lt;Setter.Value&gt;
            &lt;ControlTemplate&gt;
                &lt;Border CornerRadius=&quot;8&quot;
                        Background=&quot;#3e4147&quot;&gt;
                    &lt;Grid&gt;
                        &lt;TextBlock IsHitTestVisible=&quot;False&quot;
                                   VerticalAlignment=&quot;Center&quot;
                                   HorizontalAlignment=&quot;Left&quot;
                                   Margin=&quot;10,0,0,0&quot;
                                   x:Name=&quot;txt&quot;
                                   FontSize=&quot;14&quot;
                                   Foreground=&quot;DarkGray&quot;&gt;
                            &lt;TextBlock.Style&gt;
                                &lt;Style TargetType=&quot;TextBlock&quot;&gt;
                                    &lt;Setter Property=&quot;Visibility&quot; Value=&quot;Collapsed&quot;/&gt;
                                    &lt;Style.Triggers&gt;
                                        &lt;DataTrigger Binding=&quot;{Binding Text, ElementName=MessageBox}&quot; Value=&quot;&quot;&gt;
                                            &lt;Setter Property=&quot;Visibility&quot; Value=&quot;Visible&quot;/&gt;
                                        &lt;/DataTrigger&gt;
                                    &lt;/Style.Triggers&gt;
                                &lt;/Style&gt;
                            &lt;/TextBlock.Style&gt;
                        &lt;/TextBlock&gt;
                    &lt;/Grid&gt;
                &lt;/Border&gt;
            &lt;/ControlTemplate&gt;
        &lt;/Setter.Value&gt;
    &lt;/Setter&gt;
&lt;/Style&gt;

</ResourceDictionary>

И в моем xaml документе есть

 <TextBox Grid.Row="1"
        Height="30"
        Width="230"
        HorizontalAlignment="Center"
        Style="{StaticResource AuthTextBox}"
        Text="Login">
 </TextBox>

Свойство Text в TextBox не работает и мой текст не выводится. Как мне написать в xaml, чтобы оно вывело текст?

  • 1
    Перед тем как что-либо менять, стоит зайти в документацию и увидеть там то, как устроен тот или иной компонент. Сделав это, вы увидите элемент с именем PART_ContentHost, который отвечает за отображение текста, собственно, где он у вас? – EvgeniyZ Oct 11 '21 at 19:08
  • Это оставлю просто тут, на всякий... – EvgeniyZ Oct 11 '21 at 19:15

0 Answers0