Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 基于VB变量的XAML按钮内容更改_Vb.net_Xaml_Button - Fatal编程技术网

Vb.net 基于VB变量的XAML按钮内容更改

Vb.net 基于VB变量的XAML按钮内容更改,vb.net,xaml,button,Vb.net,Xaml,Button,我是初学者。我想在XAML中创建一个按钮,其中包含基于VB中变量的文本。我在VB中用 Dim按钮名称1=“测试” 我需要做什么才能使按钮内容显示ButtonName1?这真的很容易。您的按钮有一个Name属性,您可以使用它在代码隐藏中引用它,注意在本例中它是Button1,您只需要将字符串分配给按钮的Content属性 Xaml <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="10,10,0,0

我是初学者。我想在XAML中创建一个按钮,其中包含基于VB中变量的文本。我在VB中用

Dim按钮名称1=“测试”


我需要做什么才能使按钮内容显示ButtonName1?

这真的很容易。您的按钮有一个Name属性,您可以使用它在代码隐藏中引用它,注意在本例中它是
Button1
,您只需要将字符串分配给按钮的Content属性

Xaml

<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Button1" VerticalAlignment="Top" Width="75" />
Dim ButtonName1 = "Test"
Button1.Content = ButtonName1