2015-01-06 90 views
0

當我點擊按鈕時,我想讓邊框和文本塊消失,當再次單擊按鈕時出現邊框和文本塊。用windows phone上的按鈕隱藏邊框和文本塊

這是我的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?

+0

添加'OnClick'event你的按鈕,並添加代碼顯示/隱藏邊框和文本塊此事件。 – Sybren

回答

0

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; 
} 
+0

謝謝你的工作... – user3431268

+0

很高興我可以幫助,隨時選擇這個作爲你的問題的答案,並投票它,如果它是幫助你。 –

+0

對不起,我沒有足夠的聲望來投票你的答案... – user3431268