在Windows Phone上使用按钮隐藏边框和文本块

本文关键字:边框 隐藏 文本 按钮 Windows Phone | 更新日期: 2023-09-27 18:36:34

我想在单击按钮时使边框和文本块消失,再次单击按钮时出现边框和文本块。

这是我的 xaml:

<Border x:Name="descbox" Background="#A6CFC9A8" Height="80" VerticalAlignment="Bottom" Visibility="Visible" Margin="0,-100,0,0">
    <ScrollViewer VerticalScrollMode="Auto" Height="auto" Margin="0,0,0.333,0" HorizontalScrollBarVisibility="Visible">
        <StackPanel Width="548">
            <TextBlock x:Name="desc" Text="{Binding Description}" FontFamily="verdana" FontSize="19" Foreground="#CC000000" TextWrapping="Wrap" Padding="0,10" TextAlignment="Justify" Margin="0,0,10.333,0"/>
        </StackPanel>
    </ScrollViewer>
</Border>
<Button Content="Button"/>

如何在Windows Phone 8.1中制作它?

在Windows Phone上使用按钮隐藏边框和文本块

XAML :

<Button Content="Button" Click="Button_Click"/>

法典:

private void Button_Click(object sender, RoutedEventArgs e)
{
    if (descbox.Visibility == Visibility.Visible)
        descbox.Visibility = Visibility.Collapsed;
    else
        descbox.Visibility = Visibility.Visible;
}