简体   繁体   中英

Visibile/collapsed button on a grid view in C# WP8 Development

Guyes I am new in windows phone 8 dev. I have issue to control Grid view visibilty and visibilty on that buttons which are located on that grid.. Here is my xaml view snapshot..

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

here is my Xaml view...I have a grid view at left side and buttons on it.(1,2,3,4,5)...Visibilty of these buttons is collapsed...when trade button is clicked II like to all the buttons visible..But There are 2,3 errors shows in my screen..

Here is My xaml.cs code..

  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.
    }

Here is my xaml code..

     <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>

The error which comes out is this "Error: 'System.Windows.RoutedEventArgs' does not contain a definition for 'Visibility' and no extension method 'Visibility' accepting a first argument of type 'System.Windows.RoutedEventArgs' could be found (are you missing a using directive or an assembly reference?)"

Kindly help me out for my problem... I just wanna get visibility of that buttons after clicking Trade button...!!

Your event handler Grid_View_Btn_1_Click has a parameter "e". When referencing "e", the handler will use the parameter "e", not the control "e". Rename the handlers parameter to "e2" or similar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM