Replacing the WPF rendering pipeline - wpf

WPF doesn't appear to convey visibility information during rendering so it does no culling and, consequently, performance can be awful. So I'm interested in the idea of circumventing WPF's normal rendering pipeline in order to replace it with a more efficient one.
For example, given a scroll viewer containing a grid of controls I'd like to precalculate the locations of the controls in the grid in order to render only potentially visible controls given the visible region within the scroll viewer. So I'd replace the scroll viewer's renderer with one that passes that visibility information and then replace the grid's renderer with one that uses that visibility information to cull controls that lie completely outside the visible region.
Is this possible and, if so, how might it be accomplished?

Related

What is default autoscrolling interval and step?

I'm writing custom tree control from scratch and I've yet implemented most of default behaviors of Windows control. My last change involved adding so called autoscroll feature: if you start making a rectangular selection and drag mouse below or above control, it starts to scroll automatically, such that you can select more elements than are currently visible.
I would like my control to behave as similar to other Windows controls as possible, so my question is: is the automatic scroll interval and scroll step (eg. pixels to be scrolled) defined somewhere in the WinAPI? Are there different scrolling speeds for different distances from the control bounds and if so, are they defined somewhere as well?

Wpf panel layout - one child, several positions

I am working on a WPF panel derivative with custom layout logic and sometimes it might be that component should be visible in two places, when following that layouting logic. Both instances of the same component will be partially cropped. Is it possible to do this - lay out a child component in two different places during the arrange pass?
I think that the panels behaviors are for arrange items in a view, and not for copy the items. I think this is not possible. If you copy a visual element then it will not be the same. If you want get this effect you may use a VisualBrush and paint some region with that, and set to the brush the control that you may want to copy. Using VisualBursh you will see a control copy, but you will not be able to modify it. The other way is using a custom control for making this effect. Other way could be using two different custom panels, both with the same items source (in the case that be the ItemsPanel for some collection).
Hope this answer helps to you...

WPF ensure transformed content is visible

Does WPF provide a control that automatically transforms contained content to be visible?
I can compute things manually, but I'd rather work with existing Dependency Properties.
I'd like to add content to this hypothetical control, rotate the content, and have the parent perform additional transformation to make sure the entire content is visible.
(Similar to Smallest possible bounding box for a rotated image)
Put the whole content into a Viewbox.

WPF Performance Degradation During UI Render

I have the following components in a WPF application:
(1) Window
(2) ContentPresenter in the Window that is bound to a property in the underlying ViewModel. This Property references another ViewModel.
(3) A DataTemplate for the ViewModel that will be bound to the ContentPresenter referenced above. This data template instantiates a third-party grid that displays some data.
Whenever the ContentPresenter renders the data from the DataTemplate, it takes approximately three to four seconds for the UI to render. This causes the UI to hang for the duration of the time that it takes to render the content. Since I have little to no control over how the third-party control renders itself - my question involves whether or not it is possible to render content in a way that the UI will not hang.
Please advise.
Thanks.
Chris
How many rows is the grid displaying? And how many of those rows are visible on screen?
I'm asking because it's possible that you've got a UI layout that defeats virtualization. Usually, controls that show a scrollable list of data will perform virtualization. (The built-in ListBox does this, and any 3rd party grid of tolerable quality should do the same.) This is critical for performance, because it means your UI only needs to instantiate those items that are actually visible, rather than everything in your list.
But it's relatively easy to defeat this virtualization by accident. One way is to wrap the list or grid control in a ScrollViewer. You need virtualizing controls to be able to manage their own scrolling for virtualization to work, so the scrolling needs to happen on the inside. Wrapping a control in a ScrollViewer prevents it from doing its own scrolling. Another way it can go wrong is if you plug in a different ItemsPanel. A third possibility is that your list/grid control actually needs to be told to use virtualization.
But if you're using a control that simply takes a long time to render just the stuff you need to show on screen, then there's not much you can do - you'd need to contact the control vendor, or consider using a different vendor...

Silverlight control layout update in runtime

I have a silverlight control that has a few element such as: Image, TextBox and a TextBlock.
The application shows a list of the same control and the controls are placed in a specific layout, in grid with rows and cols.
Now,
I would like to be able to modify all the controls layout and arrange the element differently (preferred animatedly) without reloading the control.
Does anyone know how to do so?
Thanks,
Ronny
Use the States pane in
Expression Blend 3 to define different
layouts.
Use the GoToStateAction for the objects/events that you want to trigger the change or call VisualStateManager:GoToState(this, "NewState", true) from your code behind to switch layouts.
Use FluidLayout (the wave-shaped first button first for the State Group) to animate the change from one grid col/row to another.

Resources