ReactiveUi how to use ICollectionView with the Getting started example - wpf

I'm learning ReactiveUi and trying the sample from here https://reactiveui.net/docs/getting-started/ This is a great examle, but now I would like to replace the List SearchResults with a ICollectionView to have more grouping / sorting capability.
The documentation contains a ReactiveCollectionViewSource here and but I'm unable to find a sample how to use it with the starting code. Is that the right track?

The ReactiveCollectionViewSource is for the iOS project only.
You should be able to use standard WPF ways of generating your CollectionView and use CollectionViewSource.GetDefault() etc.
You can then use WPF or ReactiveUI bindings to bind that to your controls.
One thing of note is that DynamicData is going to be in the near future the preferred solution for data management in RxUI projects. Worth seeing if it fits in your problem space. https://github.com/RolandPheasant/DynamicData - There is a DynamicData channel on the Reactive slack channel if you need help with the framework https://reactiveui.net/slack

Related

Using catel with 3rd party controls

I'm new to catel and mvvm. I 've successfully built a sample application the "catel" way and I like all the added features which I do need (thank you for the great tutorials). I've successfully run a sample app using typical mvvm and a 3rd party control printing reports. When I tried to use the 3rd party control in the catel application I had issues making it work, even with the information provided in catels' documentation. Even if I do manage it to work, I don't want to make custom base classes to add new controls, because most of my controls are special (3D). So, my question: can I use all of the catel features, including model and viewmodel capabilities, but use external windows and controls with the typical manual binding procedure? Do I need to know of any special concerns?
I learn catel since 2 weeks too, welcome into the Catel World :)
So, you can create custom window base class with IDataWindow and your window inherit Catel features. Need more coding but not a lot !
I suggest you to consult the excellent documentation here for Custom Window and here for Custom Control
Hope it's help !
Dams

Move data between windows?

I have been trying to move data from one WPF window to another while both are open without making a new instance.
This feels like it should be really easy but after hours of researching I cant get anything to work.
Here is what I have tried so far. This works, however, it creates another mainform.
Dim mainform As New MainWindow
mainform.TextBox3.Text = TextBox1.Text
mainform.Show()
if I try this without the word new it gives me an error.
I am totally puzzled by this.
Use MVVM pattern. Your ViewModel will contain all data that you need to be copied to the other window. Your Window class will have a constructor that accepts a ViewModel. Now just write a copy constructor for your ViewModel, create a new Window with that copy, and you're done.
I suggest you take a look at the MVVM concept, which will give you a great foundation for understanding how to setup your WPF application. It appears that you lack the basic understanding of WPF components necessary to achieve proper results. While there are many ways of developing WPF application, MVVM will provide that necessary base. Moreover, I suggest looking at MSDN and other websites that would provide beginner tutorials. By reading your question, I feel that you're trying to do something without really know what you're doing. I don't suggest that it's a bad thing in any way - I believe that the best way to learn is by doing, but you need to acquire some guidance in a manner of tutorials or perhaps a book.

Undo Redo using PostSharp for Nested property or collections

I am in midway implementing an UndoRedo container for a view model that contains nested properties and ObservableCollection. I am using PostSharp for Exception Handling in the application and thought of reusing it for implementing an undo-redo engine as stated in the article:
http://www.postsharp.net/aspects/examples/undoredo
Although the above article is for windowsForms which had binding limitations, I have made the engine to adopt the rich binding wpf platform and it is working nice for single properties.
I am wondering how to extend the UndoableAttribute to take care of Nested properties and collections. My tries and googling skills have proved futile till now. Any idea, or pointer to some article would be appreciated.
It really depends on what you are after. Providing undo functionality on object graphs can be quite complicated task. You would have to state more specifically what you want to achieve.
Generally you could instrument all nested objects and write some specialized collections to store all changes in some kind of global container.
We are working on providing such a functionality as part of future release of PostSharp.Patterns libraries – it should make to 3.1 or 3.2.

WPF DataGrid Operations

I'm currently working on a WPF project under VS2010 where I need to make some CRUD operations directly using a datagird, so I've found it easier to work on Binding WPF Controls to an Entity Data Model which allows a lot of additional features that made my work easier.
so I've followed this tutorial http://msdn.microsoft.com/en-us/library/dd465159(VS.100).aspx
and everything is working fine for me .
But the problem that I'm now facing is how to make Insert/Delete Operations using the same method. I've tried to google this problem a lot but I couldn't find the right answers, so I come to you guys hoping to find some help.

SilverLight like Datagrid Paging in 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.

Resources