WPF based treeview with Hierarchy with Virtualization - wpf

I've following requirement while designing UI for application.
We have hierarchy as shown below
Level1
Level2.1
Level3
1000Thumbnails..... (inside Wrap Panel which is inside ListBox)
Level2.2
Level3
1000Thumbnails..... (inside Wrap Panel which is inside ListBox)
We would like to enable virtualization for thumbnails as amount of controls can go beyond 1000.
However, for virtualization to work, we need to restrict the size of ListBox within TreeView. With this limitation we end up having two scroll bars as shown in the image above.
Is there anyway we can avoid scroll viewer in ListBox but still have virtualization and scrolling (using mouse) thumbnails possible using ScrollViewer of TreeView control?
Kindly let me know if you need more information.
Thanks in advance for help!

You could just hide the Scrollbar, as described in this nice article.

Related

How to add ScrollViewer to UserControl

I am building an application based on MVVM approach shown in an article by josh smith. One of my user control has many controls (3 data grids and other controls) due to which its size has gone past the size of normal window. I tried adding a scrollviewer to the user control so that the user can scroll to see the hidden controls but the scrollviewer is not working. it is shown as disabled and during runtime the usercontrol only shows the controls visible in normal window size. The other controls are truncated. Can anyone please let me know how to add scrollviewer to workaspaces so that it can work effectively.
I am loading the workspaces suggested by Josh Smith in his article.

Making a custom(/templated) ScrollViewer or ListBox that understands which item to bring to view

I am trying to make a panorama-like control in WPF c# that scrolls to/brings into view only one grid from a horizontal set of grids. I need to expose the command which allows me to scroll forward/backward from various controls (which using an InteractionTrigger would suffice) on any of the grids in the ScrollViewer or ListBox.
I want each of the internal grids to size to the actual height/width of the usercontrol they live in (like tiled pages), won't need any scrollbars, and will eventually be applying easing effects/states to each of the scroll positions.
If this is too vague/convoluted, please let me know.
Thanks in advance! :)
Easy Solution:
PathListBox. Downloaded the PathListBox toolkit (for the PathListBoxScrollBehavior), set the capacity to 1, and used the templated InteractionTriggers to bind various source objects on my grids to the InvokeCommandAction Increment/Decrement Commands. Then I added easing effects/GoToStateActions.
I realize this is sort of a cheat, but am still going to search for the "real" way to do this with custom control templates deriving from ListBox and/or ScrollViewer.

WPF ListBox Template/Style (ScrollBar and InnerShadow)

Hy.
Could you help me create the fallowing control style/template?
What do I need:
A (Vertical and Horizontal) ScollBar Style like that. (Without the two arrow button)
Inner shadow on the top and bottom of the "ScrollViewer area".
That's all I need, I can create the rest parts of the control. (Selected Item's color etc)
Thank you.
The scrollbar control in WPF can be thought of as collection of the two repeatbuttons and the track part. You can change the template of the scrollbar and remove the repeatbutton.
For the shadow part, you need to provide the the Zorder index. Refer to the following link - WPF shadow on stackpanel controls
I know is too late for an answer but Style is very easy to get if you understand basic templating. Here you will find a Scrollbar that emulate the one you want, hope you like it.

Is it possible for WinForm controls (Panel,etc.) to grow like a webform control?

I'm converting an app from ASP.NET WebForms to WinForms. There is one asp.net page which contains a ListView/Repeater that contains several custom controls, which in turn contain a ListView with other custom controls. Basically the layout looks like a TreeView, but on each node/leaf there are few controls like comboboxes, etc.
When this is in ASP.NET, the page automatically lays itself out, so it is several screens tall - if I add 20 buttons into a Panel, it will grow and the browser will get scrollbars.
I'd like to do the same thing in a WinForms application - so I'll have a user control that will contain a lot of controls in a some variation of Panel (Flow, Table layout), and the controls might have another controls inside them, etc.
The problem is, that when I make winforms app, each control has specific height in the design time. I'd like some user controls to be able to grow with their contents - so they'll add up. In the main Form, there should be a vertical scrollbar, just like in the web browser when the generated page is taller than the screen.
I'd just like to get some general pointers in the right direction. Thanks.
Use Anchor and Dock container properties.
Yes, to expound on Anchor and Dock...try this
-Place a Panel on an empty form, and set its dock property to Top
-place a textbox in the panel, and Dock it to Full...it should fill the whole top panel
-Place a splitter on the form, and if not already docked correctly, set its dock to top
-place another panel below the splitter, and set its Dock to Fill
-place another textbox inside the lower panel and fill it as as well
Now you have a form with two resiable textboxes and will resize when the form does.
*you may have to set the textbox MultiLine property to true but not sure.
Hope this helps.
Anchor the controls to the parent. Anchoring all four sides will cause it to stretch.
If the Anchoring and Docking answers don't work for you, there is another option. It's not pretty, but you can access a control's properties and change them dynamically during runtime. You'd do something like: if(listBox.Items.Count > [yourVal]) listBox.height = [yourFormula] or something.
It's been a while since I've done a Win Form (and I don't have my IDE fired up at the moment) but I'm pretty sure there's even a ScrollPanel or other scrolling control that you can set on your form.
That said, when you're working with WinForms, the less scrolling you can make your users do, the better.

WPF page layout control selection

I have an imagebrush of a soccer field as the page background and I want to be able create a line up by dragging players off the bench and positioning them on the field accordingly. I don't know what control to use for the background that allows the PlayerCard control to reside where it is dragged. Any help as to how to begin would be appreciated.
You can get the idea here.
What control to use?
I believe you want the Canvas container control. It lets you arbitrarily place child controls with a Left and Top attached property, similar to the way Windows Forms does it.

Resources