Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6688387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:23:57+00:00 2026-05-26T05:23:57+00:00

This might be a stupid question, but i’m stuck doing it :(. I have

  • 0

This might be a stupid question, but i’m stuck doing it :(. I have a grid and have 3 columns. I have a textbox and a listbox in each of these 3 columns as shown:

<Grid.ColumnDefinitions>
                <ColumnDefinition Width="130"></ColumnDefinition>
                <ColumnDefinition Width="380"></ColumnDefinition>
                <ColumnDefinition Width="146"></ColumnDefinition>
             </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="30"></RowDefinition>
            </Grid.RowDefinitions>
            <StackPanel Grid.Column="0" Grid.Row="0">
                <TextBox Text="File Name" Height="30"></TextBox>
            </StackPanel>
            <StackPanel Grid.Column="1" Grid.Row="0">
                <TextBox Text="File Path" Height="30"></TextBox>
            </StackPanel>
            <StackPanel Grid.Column="2" Grid.Row="0">
                <TextBox Text="File Size" Height="30"></TextBox>
            </StackPanel>

            <StackPanel Grid.Column="0">
                <ListBox Name="listbox_name" Margin="1,30" Height="276" />
             </StackPanel>
            <StackPanel Grid.Column="1">
                <ListBox Name="listbox_path" Margin="1,30" Height="276" />
            </StackPanel>
            <StackPanel Grid.Column="2">
                <ListBox Name="listbox_size" Margin="1,30" Height="276" />
            </StackPanel>

and the code behind it:

public Window1()
        {
        InitializeComponent();

        list.Add("D:\\a\\hy");
        list.Add("D:\\a\\hy1");
        list.Sort();           
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        listbox_name.ItemsSource = list;
        grid1.Visibility = Visibility.Hidden;
    }


    private void button1_Click(object sender, RoutedEventArgs e)
    {
        grid1.Visibility = Visibility.Visible;
    }

But on the click of the button, im not able to see the listboxes, with the list displayed. Please guide me as to where im going wrong. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:23:57+00:00Added an answer on May 26, 2026 at 5:23 am

    The reason is that your stackPanel is in Grid.Col="0" and it is very small. But ListBox is inside of your stackPanel. It has a margin and it goes down. Is you can’t see your listBox.

    enter image description here

    If you will do something like this:

    <StackPanel Margin="0,0,0,-279">
                <ListBox Name="listbox_name" Margin="1,30" Height="276" />
            </StackPanel>
    

    you will see your listBox and it will work.

    NOTE: this code is only example. You need to make a better layout for your window.

    Here is how i made a window loyout:

    <Window x:Class="WpfApplication2.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="678" Loaded="Window_Loaded">
        <Grid Name="grid1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="130"></ColumnDefinition>
                <ColumnDefinition Width="380"></ColumnDefinition>
                <ColumnDefinition Width="146"></ColumnDefinition>
            </Grid.ColumnDefinitions>
    
            <Grid.RowDefinitions>
                <RowDefinition Height="30"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
    
            <TextBlock Text="File Name"  Grid.Row="0" Grid.Column="0" Margin="5" />
            <TextBlock Text="File Path"  Grid.Row="0" Grid.Column="1" Margin="5" />
            <TextBlock Text="File Size" Grid.Row="0" Grid.Column="2" Margin="5" />
    
            <ListBox Name="listbox_name" Grid.Row="1" Grid.Column="0" BorderBrush="Black" />
            <ListBox Name="listbox_path" Grid.Row="1" Grid.Column="1" BorderBrush="Black" />
            <ListBox Name="listbox_size" Grid.Row="1" Grid.Column="2" BorderBrush="Black" />
        </Grid>
    </Window>
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might be a stupid question but I have spent 2 hours looking for
I realise that this might be a stupid question, but I have not come
This might be a stupid question, but I have a little problem with understanding
This might be a horrifically stupid question, but how would I go about doing
This might be a stupid question but if there's a better or proper way
This might be a stupid question but I just wanted to make sure... If
This might be a stupid question but I'm new at all this. I want
This might be a stupid question but I'll ask anyway, I was reading OOP
This might be a stupid question, but I can't for the life of me
This might be a stupid question, but I was wondering whether or not you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.