Note that there are some explanatory texts on larger screens.

plurals
  1. POdisplaying listbox in grid
    text
    copied!<p>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:</p> <pre><code>&lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="130"&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition Width="380"&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition Width="146"&gt;&lt;/ColumnDefinition&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="30"&gt;&lt;/RowDefinition&gt; &lt;/Grid.RowDefinitions&gt; &lt;StackPanel Grid.Column="0" Grid.Row="0"&gt; &lt;TextBox Text="File Name" Height="30"&gt;&lt;/TextBox&gt; &lt;/StackPanel&gt; &lt;StackPanel Grid.Column="1" Grid.Row="0"&gt; &lt;TextBox Text="File Path" Height="30"&gt;&lt;/TextBox&gt; &lt;/StackPanel&gt; &lt;StackPanel Grid.Column="2" Grid.Row="0"&gt; &lt;TextBox Text="File Size" Height="30"&gt;&lt;/TextBox&gt; &lt;/StackPanel&gt; &lt;StackPanel Grid.Column="0"&gt; &lt;ListBox Name="listbox_name" Margin="1,30" Height="276" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Grid.Column="1"&gt; &lt;ListBox Name="listbox_path" Margin="1,30" Height="276" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Grid.Column="2"&gt; &lt;ListBox Name="listbox_size" Margin="1,30" Height="276" /&gt; &lt;/StackPanel&gt; </code></pre> <p>and the code behind it:</p> <pre><code>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; } </code></pre> <p>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!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload