C#WP8开发中网格视图上的可见/折叠按钮

时间:2013-12-12 08:51:38

标签: c# xaml windows-phone-8

Guyes我是windows phone 8 dev的新手。 我有问题来控制位于该网格上的按钮上的网格视图visibilty和visibilty .. 这是我的xaml视图快照..

http://www.4shared.com/photo/Hu1FVCdn/wp8.html

这是我的Xaml视图......我在左侧有一个网格视图,上面有按钮。(1,2,3,4,5)......这些按钮的可见性被折叠...当交易按钮时点击II喜欢所有按钮可见..但我的屏幕上显示2,3个错误..

这是我的xaml.cs代码..

  public main()
    {
        InitializeComponent();

    }
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
    }
    private void Grid_View_Btn_1_Click(object sender, System.Windows.RoutedEventArgs e)
    {

       // a.Visible = !a.Visible;
         a.Visibility = Visibility.Visible; //Also possible to Collapse (hide). 
      b.Visibility = Visibility.Visible; //Also possible to Collapse (hide).
      c.Visibility = Visibility.Visible; //Also possible to Collapse (hide).
       d.Visibility = Visibility.Visible; //Also possible to Collapse (hide).
      e.Visibility = Visibility.Visible; //Also possible to Collapse (hide).

        // TODO: Add event handler implementation here.
    }

这是我的xaml代码..

     <Grid x:Name="grid" Height="618" Margin="6,147,0,0" Width="112" HorizontalAlignment="Left" VerticalAlignment="Top">
            <Grid.Background>
                <ImageBrush Stretch="Fill" ImageSource="pannel.png"/>
            </Grid.Background>
            <Button x:Name="a" Content="1" HorizontalAlignment="Left" Margin="-7,-11,-11,563" VerticalAlignment="Bottom" Width="130" RenderTransformOrigin="0.636,0.638" Height="66" BorderThickness="0" d:IsHidden="True">
                <Button.Background>
                    <ImageBrush Stretch="Fill" ImageSource="pannel_btn_unselected.png"/>
                </Button.Background>
            </Button>
            <Button x:Name="b" Content="2" HorizontalAlignment="Left" Margin="-7,0,-11,519" VerticalAlignment="Bottom" Width="130" RenderTransformOrigin="0.636,0.638" Height="66" BorderThickness="0" d:IsHidden="True">
                <Button.Background>
                    <ImageBrush Stretch="Fill" ImageSource="pannel_btn_unselected.png"/>
                </Button.Background>
            </Button>
            <Button x:Name="c" Content="3" HorizontalAlignment="Left" Margin="-7,0,-11,475" VerticalAlignment="Bottom" Width="130" RenderTransformOrigin="0.636,0.638" Height="66" BorderThickness="0" d:IsHidden="True">
                <Button.Background>
                    <ImageBrush Stretch="Fill" ImageSource="pannel_btn_unselected.png"/>
                </Button.Background>
            </Button>
            <Button x:Name="d" Content="4" HorizontalAlignment="Left" Margin="-7,0,-11,431" VerticalAlignment="Bottom" Width="130" RenderTransformOrigin="0.636,0.638" Height="66" BorderThickness="0" d:IsHidden="True">
                <Button.Background>
                    <ImageBrush Stretch="Fill" ImageSource="pannel_btn_unselected.png"/>
                </Button.Background>
            </Button>
            <Button x:Name="e" Content="5" HorizontalAlignment="Left" Margin="-7,0,-11,387" VerticalAlignment="Bottom" Width="130" RenderTransformOrigin="0.636,0.638" Height="66" BorderThickness="0" d:IsHidden="True">
                <Button.Background>
                    <ImageBrush Stretch="Fill" ImageSource="pannel_btn_unselected.png"/>
                </Button.Background>
            </Button>
        </Grid>

出现的错误是“错误:'System.Windows.RoutedEventArgs'不包含'Visibility'的定义,也没有扩展方法'Visibility'接受'System.Windows类型的第一个参数。可以找到RoutedEventArgs'(您是否缺少using指令或程序集引用?)“

请帮我解决我的问题...... 我只想在点击Trade按钮后看到这些按钮...... !!

1 个答案:

答案 0 :(得分:3)

您的事件处理程序Grid_View_Btn_1_Click具有参数“e”。当引用“e”时,处理程序将使用参数“e”,而不是控件“e”。将处理程序参数重命名为“e2”或类似名称。