c# - Why does the button size increases as the listbox size gets populated with data? -


I am a newbie for c # I have created a Windows program with buttons and listbox pops the list box log Because the script runs the application. However, as the listbox pops up with the log, the buttons and labels increase, which makes the stack panels very ugly?

Any help / advice will be appreciated. Below is my xaml code.

  & lt; Grid & gt; & Lt; Border borderbrush = "black" borderline = "2" margin = "0,11,0,5" cornerreadia = "5" background = "white" & gt; & Lt; StackPanel Orientation = "Horizontal" margin = "7,10,7,2" & gt; & Lt; StackPanel Orientation = "Vertical" & gt; & Lt; Text block text = "city" margin = "5" horizontal alignment = "center" & gt; & Lt; / Textblocks & gt; & Lt; Combo box name = "city" selected value = "Chicago" electoral method = "name" & gt; & Lt; ComboBox.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; TextBlock Text = "{Binding Path = Name, Mode = Requests}" & gt; & Lt; / TextBlock & gt; & Lt; / DataTemplate & gt; & Lt; /ComboBox.ItemTemplate> & Lt; / ComboBox & gt; & Lt; / StackPanel & gt; & Lt; Button name = "btnEnter" content = "enter" width = "200" margin = "4" padding = "6" click = "BTN EnterClick"> & Lt; / Button & gt; & Lt; Button name = "btnViewLog" content = "see log" width = "100" margin = "4" padding = "6" click = "btnLog_Click" & gt; & Lt; / Button & gt; & Lt; ListBox name = "lbLog" visibility = "abbreviated" & gt; & Lt; ListBox.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Text box text = "{binding description}" IsReadOnly = "True" BorderThickness = "0" background = "transparent" & gt; & Lt; / TextBox & gt; & Lt; / DataTemplate & gt; & Lt; /ListBox.ItemTemplate> & Lt; / ListBox & gt; & Lt; / StackPanel & gt;  

Thanks

Ash

Without difficulty with its Xaml, the problem is difficult to diagnose, so please try posting it with more questions. This sound is a horizontal stackpane, and these elements are next to each other.

If the orientation of your stackpanel is vertical, set the horizontal alignment in the left, right or center on the button. If the stackPanel orientation is horizontal, set the workspace tracing over the upper, bottom, or center buttons.

I am pretty sure that both settings are "stretch" by default, which means that they will try to fill all the available space instead of shaping their content.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -