按钮不可见
The button is not visible
我有一个 UWP 应用程序,我添加了一个按钮,但是当我调试该应用程序时,我看不到该按钮。如果我添加一个 texblock 或 textBox 我可以看到它们,但看不到按钮。
我已将 IsEnabled 设置为 true 并将 visibility 设置为 visible,但我无法解决问题。
我也尝试点击应该是按钮的地方,但没有任何反应。
当我在本地机器上调试和在 windows phone 10.
的模拟器中调试时会发生这种情况
非常感谢。
编辑:axml 代码
<Page
x:Class="SqliteEF7UWP.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SqliteEF7UWP"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="Transparent">
<Button x:Name="GetVideos" IsEnabled="True" Visibility="Visible" Background="Aquamarine" Content="Buscar Videos" HorizontalAlignment="Left" Margin="120,98,0,510" VerticalAlignment="Stretch" Click="button_Click"/>
<TextBlock x:Name="textBlock" Foreground="BlueViolet" HorizontalAlignment="Left" Margin="101,59,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="34" Width="132"/>
<TextBox x:Name="textBox" HorizontalAlignment="Left" Margin="213,59,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top"/>
</Grid>
</Page>
您为按钮设置的边距太激进了。该对象现在是 "squeezed"。例如,将边距设置为“120,98,0,200”(或简称为“120,98”)而不是“120,98,0,510”,它应该是可见的。
顺便说一句,使用硬编码边距来设置用户界面可能不是一个好主意。例如,使用带有列和行而不是边距的网格。
我有一个 UWP 应用程序,我添加了一个按钮,但是当我调试该应用程序时,我看不到该按钮。如果我添加一个 texblock 或 textBox 我可以看到它们,但看不到按钮。
我已将 IsEnabled 设置为 true 并将 visibility 设置为 visible,但我无法解决问题。
我也尝试点击应该是按钮的地方,但没有任何反应。
当我在本地机器上调试和在 windows phone 10.
的模拟器中调试时会发生这种情况非常感谢。
编辑:axml 代码
<Page
x:Class="SqliteEF7UWP.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SqliteEF7UWP"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="Transparent">
<Button x:Name="GetVideos" IsEnabled="True" Visibility="Visible" Background="Aquamarine" Content="Buscar Videos" HorizontalAlignment="Left" Margin="120,98,0,510" VerticalAlignment="Stretch" Click="button_Click"/>
<TextBlock x:Name="textBlock" Foreground="BlueViolet" HorizontalAlignment="Left" Margin="101,59,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="34" Width="132"/>
<TextBox x:Name="textBox" HorizontalAlignment="Left" Margin="213,59,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top"/>
</Grid>
</Page>
您为按钮设置的边距太激进了。该对象现在是 "squeezed"。例如,将边距设置为“120,98,0,200”(或简称为“120,98”)而不是“120,98,0,510”,它应该是可见的。
顺便说一句,使用硬编码边距来设置用户界面可能不是一个好主意。例如,使用带有列和行而不是边距的网格。