<Page x:Class="WeichenSteuerung_neu.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WeichenSteuerung_neu"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converter="using:WeichenSteuerung_neu"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button x:Name="button" Content="WeichenAbzweig
" HorizontalAlignment="Left" Margin="121,156,0,0" VerticalAlignment="Top" Click="WeicheAbzweig_Click" Width="133" Visibility="Visible" Grid.Column="1" Grid.Row="1"/>
<Button x:Name="button1" Content="WeichenGerade
" HorizontalAlignment="Left" Margin="121,213,0,0" VerticalAlignment="Top" Width="133" Click="WeicheGerade_Click" Visibility="Visible" Grid.Column="1" Grid.Row="1"/>
</Grid>
</Page>
我正在为#Ar;远程Arduino&#34;编写测试程序。与UWP。
我添加了两个按钮来切换铁路的指针,但如果我启动程序,我的Button
不会显示在窗口中。
只有一个空白的白色窗口!
那么我需要添加什么?
我尝试将Visibilty
设置为Visible
,但这两项都不起作用。
设计时间
运行
答案 0 :(得分:0)
IMHO Margins在运行时不是控件的最佳朋友。我看到你设置的边距改变了你的网格,如下所示。
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button x:Name="button" Content="WeichenAbzweig
" Width="133" Click="WeicheAbzweig_Click" Grid.Row="0" Margin="10"/>
<Button x:Name="button1" Content="WeichenGerade
" Width="133" Click="WeicheGerade_Click" Grid.Row="1" Margin="10"/>
</Grid>
</Grid>