如何在WPF项目的.cs文件中使用文本框的控件



当我尝试使用TextBox控件时,会出现错误。为什么我不能直接使用该控件来直接使用该控件,如何解决错误?

<TextBox  x:Name="receiveTextBox"  Foreground="White" Background="Black" TextWrapping="Wrap"  TextAlignment="Left"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="15" />
        </StackPanel>
    </Grid>
</Window>
         receiveTextBox.Text(" hello  ");  // <------- this's error part !

文本不是方法 - 它是属性。

receiveTextBox.Text = " hello  ";

将来,请确保您还告诉我们您正在看到的错误消息(以及格式化代码(。

最新更新