SilverLight like Datagrid Paging in WPF? - wpf

Currently I am searching for the best way for paginating the records in WPF datagrid.
I have found one best article which provide best way for paginating records in Silverlight over here.
See it provides also a fabulous demo.
Here is one screen shot.
But when I have trying it to implement it in WPF I could not implement it?
I could not found PagedCollectionView class and also could not found the alternative XAML code of the Silverlight code shows is below screen shot.
Could any one provide or suggest the best way for paginating the records in WPF
as like Silverlight?

You can grab the PagedCollectionView source code from here and compile it into your WPF project. I've done this for a WPF project in the past and it works just fine. However, you won't have the supporting types like DataPager, but it's easy enough just to write your own or throw some buttons on your view that page through the collection.

WPF DataGrid doesn't come with pagination by default. You have to have your own custom implementation. Here is a sample. The sample implements First/Previous as ViewModel commands, however I would advise you to move these commands as part of the control and make a custom DataGrid control that you can reuse across application.

Related

MVVM architecture

I need to build our future business applications with WPF using MVVM.
My typical application consists of several windows/tab pages with grids and form style windows. Both edit windows and grid windows can be different depending on the logged in user, so most of them will be built datadriven.
And I'm trying to write as few code as possible, as not written code is the only one to be guaranteed error free .
So, now my question: how to structure the entire thing?
The View is clear to me - is is built using XAML or by code.
The ViewModel should contain the business logic and the validation rules and should let feed the View the data, and should contain the commands for the actions.
So, where to put the data? A select returns a DataTable. Should this datatable exposed through the ViewModel to the View for the grid windows?
And for the form windows? Should the single DataRow exposed trough the ViewModel to the View?
Are there other helper or intermediate classes needed?
Thank you for any useful suggestion!
Wolfgang
Its best way to go with WPF and MVVM,
I suggest before you start go thru the basics of MVVM. for your reference you can understand better here
The preferred UI paradigm in WPF is to have tab controls and grids in a single window, something like this:
You don't have to stop there, you can nest them as deeply as you need to for the sake of clarity.

WPF Multiple Instances of Windows and MVVM

How do I use multiple windows in an WPF MVVM app?
I have a Main Window with a menu control that needs to open up new instances of the window each time the item it is selected. I need to be able to show windows next to each other, it is a requirement and not page or usercontrol navigation.
Does anyone have an example of doing this?
I've read it is not recommended UI design but it is the requirement I have to implement.
Actually I have this working by using the WindowManager from Caliburn.Micro which seems like an very excellent framework for this type of application. I did look into prism but it seems over complicated and Caliburn is very easy to understand which did meet the requirements. I looked into MVVM Light but the documentation is horrible and lacks examples and I don't have time to figure it out.

Silveright User Control validation

I follow MVVM pattern in one of my silverlight pages.
I am trying to add validations for one of my usercontrols which should look like those which work with the Silverlight native controls. Is it possible for me to do that? Do I need to add special code to handle this?
if you could post your code then i might be able to help. But as per your question i think there are available user-validation controls for Silverlight that you can just drag and drop and then use.
They are available in most of the new IDE's.
Make sure your ViewModel implements IDataErrorInfo and then you can hook them up to the controls.
You can look at a good article here:
http://www.arrangeactassert.com/using-idataerrorinfo-for-validation-in-mvvm-with-silverlight-and-wpf/

Paging in a ListBox (Panaroma Control)

I'm using the default Panorama project in Windows Phone 7.1 and want to implement some kind of paging on the the first page's mvvm ListBox items. The sample project has 16 items, but I only want to show 4 at a time (and then buttons below showing next / previous). All of this in XAML.
I've looked around quite a bit and haven't discovered a way to make this happen. Does anyone know how this can be achieved?
Judging by your question the answer shouldn't have to be WP7 specific. Having said that you could pretty much get a listbox control with paging done in silverlight and add it inside of your Panorama page.
I did find this page which shows how to do paging in silverlight with the listbox control and two buttons like you mentioned. Sorry, it's in VB but it shouldn't be difficult to transfer the logic to C#.
But like I said it's not really phone dependent to add paging because it's all xaml. So you could probably search "Paging Listbox in Silverlight" and should find something.

Custom Wpf ListBox Control

I'm new to wpf and have just been given a project to create a set of custom controls which will be used to make a previous windows forms application more manageable and current. However I cannot seem to find much info with regards to customising the built in Listbox, this would involve preferably replacing the scroll bar and the +/- buttons with custom images etc..
Just wondered if anyone knows how to get at these ?
Thanks in advance.
Check here for the default control template of the listbox.You can customize the scrollviewer there to do what you are looking for.Check the below article to get started
Using Templates to Customize WPF Controls
Learn about WPF styling and templating. Other than that, the question is too generic for SO. Read the article (and perhaps google some more articles on the topic), try to style the listbox and come back with specific issues. WPF is not easy to get into, but it is definitely worth the time.

Resources