Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - 2 questions about a ListBox/ListView

 
 
Old 02-16-2006   #1 (permalink)
Jason Dolinger


 
 

2 questions about a ListBox/ListView

Hi all,

2 questions about ListBox/ListView:

1. When using a GridView to display tabular data, is there any way to
ensure that each column header is expanded enough so that the header is
not truncated (given allowable space on the screen of course).
Everytime my grid gets rendered, the columns are very narrow, cutting
off the header, even though there is plenty of screen real estate off to
the right to use. I'm not using the simple
GridViewColumn.DisplayMemberPath, I'm using a DataTemplate to create the
visual tree for each grid cell, and setting it to the GridView column's
CellTemplate.

Please take a look at this attachment. I just wanted to see if anyone
knew of a simple API method that I was missing before I start digging
into the visual tree and the grips, etc...

2. Is there any reason why a ListView's scrollbars would stop showing
up? I'm developing a component that includes two different ListView's
layered on top of each other. To make this as reusable as possible, I'm
encapsulating these in an ItemsControl (the component really is the
composite of these two). As soon as you move a ListView inside an
ItemsControl, it loses its scrollbars. The ScrollViewer is still
present in the window's visual tree (here is an excerpt of the tree) :

Lab49.WPF.Controls.DataGrid, Name: sampleGrid
System.Windows.Controls.Border, Name:
System.Windows.Controls.ItemsPresenter, Name:
System.Windows.Controls.StackPanel, Name:
System.Windows.Controls.Grid, Name:
System.Windows.Controls.ListView, Name: dataList
System.Windows.Controls.Border, Name:
System.Windows.Controls.ScrollViewer, Name: Scroller
System.Windows.Controls.Grid, Name:
System.Windows.Controls.DockPanel, Name:
System.Windows.Controls.Border, Name:
System.Windows.Controls.ScrollViewer, Name:
System.Windows.Controls.Grid, Name:
System.Windows.Controls.ScrollContentPresenter, Name:
System.Windows.Controls.GridViewHeaderRowPresenter, Name:


Can anyone suggest what may be happening, or have some ideas about where
to start digging (like checking the VerticalScrollBarVisibility
properties of those ScrollBars)?

Thanks a million,
Jason





My System SpecsSystem Spec
Old 02-18-2006   #2 (permalink)
Jason Dolinger


 
 

Re: 2 questions about a ListBox/ListView

Thanks Jason,

Do you mean setting the Width for each Grid.ColumnDefinition to "*"?
The only problem is that I'm not controlling the creation of those
Grids. I'm using a GridViewColumns to specify the visual tree for each
cell. The WPF framework creates all of the objects (include the grid
that handles each cell). Also, how do you specify "*" in C# rather than
XAML?

Thanks!
Jason

Jason [Mobiform] wrote:
> For number one, try making your grid column definitions star value type,
> still use the actual pixel value just change the type. That way they will
> keep the relative sizes to each and will scale.
>
> As for 2 I have not idea, maybe post some XAML.
>
> Jason
>
>
> "Jason Dolinger" <jdolinger@lab49.com> wrote in message
> news:43F4FD6E.7050703@lab49.com...
>
>>Hi all,
>>
>>2 questions about ListBox/ListView:
>>
>>1. When using a GridView to display tabular data, is there any way to
>>ensure that each column header is expanded enough so that the header is
>>not truncated (given allowable space on the screen of course).
>>Everytime my grid gets rendered, the columns are very narrow, cutting
>>off the header, even though there is plenty of screen real estate off to
>>the right to use. I'm not using the simple
>>GridViewColumn.DisplayMemberPath, I'm using a DataTemplate to create the
>>visual tree for each grid cell, and setting it to the GridView column's
>>CellTemplate.
>>
>>Please take a look at this attachment. I just wanted to see if anyone
>>knew of a simple API method that I was missing before I start digging
>>into the visual tree and the grips, etc...
>>
>>2. Is there any reason why a ListView's scrollbars would stop showing
>>up? I'm developing a component that includes two different ListView's
>>layered on top of each other. To make this as reusable as possible, I'm
>>encapsulating these in an ItemsControl (the component really is the
>>composite of these two). As soon as you move a ListView inside an
>>ItemsControl, it loses its scrollbars. The ScrollViewer is still
>>present in the window's visual tree (here is an excerpt of the tree) :
>>
>> Lab49.WPF.Controls.DataGrid, Name: sampleGrid
>> System.Windows.Controls.Border, Name:
>> System.Windows.Controls.ItemsPresenter, Name:
>> System.Windows.Controls.StackPanel, Name:
>>System.Windows.Controls.Grid, Name:
>> System.Windows.Controls.ListView, Name: dataList
>> System.Windows.Controls.Border, Name:
>> System.Windows.Controls.ScrollViewer, Name: Scroller
>> System.Windows.Controls.Grid, Name:
>>System.Windows.Controls.DockPanel, Name:
>> System.Windows.Controls.Border, Name:
>>System.Windows.Controls.ScrollViewer, Name:
>>System.Windows.Controls.Grid, Name:
>> System.Windows.Controls.ScrollContentPresenter, Name:
>> System.Windows.Controls.GridViewHeaderRowPresenter, Name:
>>
>>
>>Can anyone suggest what may be happening, or have some ideas about where
>>to start digging (like checking the VerticalScrollBarVisibility
>>properties of those ScrollBars)?
>>
>>Thanks a million,
>>Jason
>>
>>
>>
>>

>
>
>
> --------------------------------------------------------------------------------
>
>
>
>
>

My System SpecsSystem Spec
Old 02-21-2006   #3 (permalink)
Grant Zhang


 
 

RE: 2 questions about a ListBox/ListView

Can you give me more detais about visual tree of the control in your 2nd
question?

For example:
Button
|-Border
|-ContentPresenter

So I can know there is a border inside a button, and a ContentPresenter
inside Border.
My System SpecsSystem Spec
Old 02-21-2006   #4 (permalink)
Jason Dolinger


 
 

Re: 2 questions about a ListBox/ListView

Grant Zhang wrote:
> Can you give me more detais about visual tree of the control in your 2nd
> question?
>
> For example:
> Button
> |-Border
> |-ContentPresenter
>
> So I can know there is a border inside a button, and a ContentPresenter
> inside Border.


Thanks for the feedback guys. I was able to get the scrollbars back.
The problem was that I had my control (containing the ListView with the
absent scrollbars) positioned in a grid row that had it's
RowDefinition.Height set to "Auto." Once I removed the auto part, the
scrollbars came back, and it seems that WPF is doing fine laying the
control out with the proper dimensions on it's own (the rows around it
still need the auto so that their layout is properly sized).

Thanks,
Jason
My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
ListBox vs. ListView .NET General
Easy to get handle from listbox. How to get listbox from handle? .NET General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46