Silverlight DataGrid vertical scrollbar issue - silverlight

I have a DataGrid in my silverlight application and I'm wondering how to get the same behavior for the vertical scrolling as the horizontal scrolling. When I resize the browser horizontally, The app will bunch up all the controls and the horizontal scrollbar will appear, however when I resize it vertially, the controls at the bottom of the app just move out of view. Does anyone know any tricks to handle something like this?

My problem is StackPanels. Don't use them, they are evil and don't resize.

I couldn't get the scrollbar to show up at all with the datagrid. Removing the datagrid from a stackpanel and using a grid instead also solved my problem.
Good call!

In my case the Height of the rowdefinition where I have the datagrid was set to "Auto" and it had a rowdefinition below with height set to *. I switched the values and it worked.

Yes stack panels causes some unknown errors in Silverlight, I Had also experienced problems with regards to stack panels like nesting data fields inside stack panels which are also inside data forms.

Related

Resize Silverlight application to fit window

I have created a silverlight application that has been placed on an entity form and currently it has been set to a fixed width. What i'm after is for the application, including the datagrid and pagers that are in it, to stretch to the width of the window.
So far i've been unable to find anything that works so I was hoping that someone would be able to help me with it?
Thanks
You Should Try To Column width And Row Hight "Auto" And Also You Should Try StackPanal To Fix This Problem
Try use Stackpanel in your silverlight page and place all of controls in stackpanel and set it's width to "Auto".

silverlight scrollviewer height and width setup

I am having problem understanding the scrollviewer in silverlight webpage. There are the usercontrol and grid "layoutRoot". My scrollviewer is set before the "Layoutroot" grid. It never worked properly. Even though I have other items at the bottom of the page, I could not scroll to them and could not see them. I have been playing with UserControl MinHeight, DesignHeight and minHeight of both LayoutRoot and Scrollviwer. Just have a hard time figuring out what is the best way to set it up.....
You need to remove min height and max heigh from all of the control because Silverlight takes care of all those things. What you need is to set VerticalScrollBarVisiblity to auto. By default it is disabled and you will be able to achieve what you want.
Cheers!
Vinod
If the MinHeight properties are set too large then it will not be viewable on the screen and will be cut off. If you remove the MinHeight properties on both the UserControl and ScrollViewer then it should work fine.
Or if that doesn't work post your code so we can have a look.

WPF Animation on scrollviewer children clipped by scrollviewer

Hey folks, I'm hoping I have a fairly simple problem that can be fixed easily as it seems like I'm just missing something basic from the WPF world. I have a scrollviewer wrapping a stackpanel which contains several images, these images have animations to increasing in size when the mouse passes over them. All works fine without the scrollviewer, now I've added the scrollviewer, the animation works but only inside the scrollviewer; the increasing size isn't being allowed to overlap the scrollviewer.
Is there a way to fix this?
Thanks,
Becky
It's the way ScrollViewer works. Basically it always clips to bounds even if you set ClipToBounds="False" on it.
To make it work and continue using ScrollViewer you'll have to animate images on top of it, not inside.

Is there a way to automagically make a canvas scroll on overflow in WPF?

Been checking the web and this site, but couldn't come up with any descent results.
Is there a way to make a canvas in WPF show scrollbars on overflow ? Been trying the scrollviewer, but can't get it to work :(
Thanks in advance..
The problem you're running into is that Canvas, unlike many WPF panels and containers, does not size to contents. That means if you add an element which goes outside the canvas boundaries it will not update it's size. Hence embedding a Canvas in a ScrollViewer will do no good unless you manually update the size of the Canvas.
It sounds like what you want is a Canvas which supports size to contents. This blog entry has exactly that control.
http://themechanicalbride.blogspot.com/2008/11/auto-sizing-canvas-for-silverlight-and.html
I took a different approach and abandoned the Canvas for Grid. The Canvas is more performant but for my purposes at least I haven't noticed a difference. The grid can mimic the behavior of canvas by doing the following.
Create a single row,single column grid.
Set the HorizontalAlignment to Left
Set the VerticalAlignment to Top
Use Margin "x,y,0,0" to set the position.
Bam..works just like canvas and it works great in a Scrollviewer.

Auto-size controls in .NET CF to avoid horizontal scrolling?

I am developing a form in .NET Compact Framework, which hosts a variable number of controls. Every control should have the same width as the form. When there are only a few controls, no vertical scrollbar appears. When there are more controls than they can fit in one form, a vertical scrollbar appears. The width of the controls should then be modified, so that no horizontal scrollbar appears.
What is the best way to achieve this? I am interested in a solution that will work in all platforms/screen sizes and that can support screen orientation changes.
If I get this right, at one point, both a vertical and horizontal scrollbar appear, and you want only the vertical scrollbar? Doesn't setting the Anchor of each control to "Top|Left|Right" solve this problem automatically?
If every control is to be the same width as the form, why not just Dock every control to Top (or Bottom)? It'll take care of the resizing for you then. It might not look very attractive however, so I suggest adding in some empty Panels (docked the same way) to be used as vertical spacers.
I did some quick testing, and it seems, when you add controls, the panel raises the resize event when the added control tiggers the scollbars to go visible. The annoying part is here that the resize event is triggered a couple of times during startup :(
But knowing the compact framework, this might be your best shot at handling this.
Normally on the full framework you could if the DisplayRectangle is bigger than the size of the panel, but no such thing exists on the cf.
Hope this is of some help, I'll see if I can find anything more in the morning.

Resources