Click here to Skip to main content
15,884,298 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: How to convert arrayclass into normal class object.. Pin
Pete O'Hanlon7-May-11 1:34
mvePete O'Hanlon7-May-11 1:34 
QuestionWPF samples Pin
arkiboys6-May-11 2:57
arkiboys6-May-11 2:57 
AnswerRe: WPF samples Pin
Ian Shlasko6-May-11 3:10
Ian Shlasko6-May-11 3:10 
AnswerRe: WPF samples Pin
Renat Khabibulin9-May-11 1:09
Renat Khabibulin9-May-11 1:09 
GeneralRe: WPF samples Pin
arkiboys9-May-11 1:11
arkiboys9-May-11 1:11 
GeneralRe: WPF samples Pin
Renat Khabibulin9-May-11 1:32
Renat Khabibulin9-May-11 1:32 
GeneralRe: WPF samples Pin
arkiboys9-May-11 1:42
arkiboys9-May-11 1:42 
QuestionMake two listboxes have the same width Pin
Jean-Louis Leroy6-May-11 2:43
Jean-Louis Leroy6-May-11 2:43 
Hello,

I have two listboxes arranged side by side in a Grid control.

<Grid>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="1*" />
    <ColumnDefinition Width="40" />
    <ColumnDefinition Width="1*" />
  </Grid.ColumnDefinitions>
  <ListBox Grid.Column="0" Name="supply" HorizontalAlignment="Stretch" />
  <!-- buttons -->
  <ListBox Grid.Column="2" Name="select" HorizontalAlignment="Stretch" />
</Grid>


I want both listboxes to have the same width, regardless of the (text) content of the listboxes.

Initially, the left listbox contains a list of strings. The right listbox is empty. If the maximum width of the items in the left listbox is smaller than (roughly) half of the size allocated to the entire grid, everything is ok. Otherwise, the left listbox occupies whatever width is needed to display the widest visible item, and the other list gets the rest.

I suppose that the grid "asks" each listbox what width it wants, and they in turn ask their items. I'd like to stop the process before the width of the items gets involved, IOW both listboxes should report minimal width, then the grid would have plenty of space on its hands, which it would split evenly between the two listboxes.

How can I achieve that ?

I've seen suggestions on the web, involving either SharedSizeGroup or disabling the listbox' horizontal scrollbar and setting HorizontalContentAlignment to "Stretch". They don't seem to work...I also tried binding the left listbox' MaximalWidth the the right listbox' Width, to no avail.
AnswerRe: Make two listboxes have the same width Pin
Ian Shlasko6-May-11 3:09
Ian Shlasko6-May-11 3:09 
GeneralRe: Make two listboxes have the same width Pin
Jean-Louis Leroy6-May-11 3:18
Jean-Louis Leroy6-May-11 3:18 
GeneralRe: Make two listboxes have the same width Pin
Ian Shlasko6-May-11 3:31
Ian Shlasko6-May-11 3:31 
GeneralRe: Make two listboxes have the same width Pin
Jean-Louis Leroy9-May-11 1:23
Jean-Louis Leroy9-May-11 1:23 
AnswerRe: Make two listboxes have the same width Pin
Renat Khabibulin9-May-11 1:26
Renat Khabibulin9-May-11 1:26 
Questionselect columns to load Pin
picasso25-May-11 18:49
picasso25-May-11 18:49 
QuestionHow to read the values from listbox Item source Pin
Rocky235-May-11 18:38
Rocky235-May-11 18:38 
AnswerRe: How to read the values from listbox Item source Pin
Thanigainathan.S6-May-11 0:38
Thanigainathan.S6-May-11 0:38 
AnswerRe: How to read the values from listbox Item source Pin
Pete O'Hanlon6-May-11 1:12
mvePete O'Hanlon6-May-11 1:12 
QuestionWPF 3d iges, catpart or step modeling Pin
rafaeltejera5-May-11 11:17
rafaeltejera5-May-11 11:17 
QuestionCustom Control & Binding woe Pin
Super Lloyd4-May-11 15:36
Super Lloyd4-May-11 15:36 
AnswerRe: Custom Control & Binding woe Pin
Super Lloyd4-May-11 15:53
Super Lloyd4-May-11 15:53 
AnswerRe: Custom Control & Binding woe Pin
Super Lloyd4-May-11 15:59
Super Lloyd4-May-11 15:59 
QuestionBest Way To Do This Pin
Kevin Marois4-May-11 12:57
professionalKevin Marois4-May-11 12:57 
AnswerRe: Best Way To Do This Pin
Pete O'Hanlon4-May-11 13:17
mvePete O'Hanlon4-May-11 13:17 
GeneralRe: Best Way To Do This Pin
Kevin Marois4-May-11 13:21
professionalKevin Marois4-May-11 13:21 
GeneralRe: Best Way To Do This Pin
SledgeHammer014-May-11 14:19
SledgeHammer014-May-11 14:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.