Silveright User Control validation - silverlight

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/

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

WPF Usercontrol Inheritance

I am new to WPF and I am facing a problem here. In one of our application, few dialogs responsible for similar kind of work. All dialogs have OK and APPLY buttons. But in our new UI Design, these will be displayed on a side bar which is a panel(Yet to decide control). I thought of having a Base Usercontrol which will have OK and APPLY button with few methods. And my other dialogs(which are Usercontrols now in new UI) are derived from this Base User Control.
I downloaded few code samples from internet, but problem didn't solve.
If you have any idea/code sample please share.
Thanks in advance.
WPF (also WinForm to some extent) doesn't play well with inheritance. You could create the UI in C# code and get inheritance working but I don't think designer play well so you'll be stuck in design mode and in Blend.
To work around it you could create piece of functionality that you want to reuse and use composition instead of inheritance, which is considered a better approach anyway.

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.

Silverlight custom controls

are there good books on developing custom controls for silverlight?
What I want is to create a grid-control that can also act as TreeList-control. Can you tell me what is a good base-class for such a control?
And another question: If I develop a control in Silverlight, how can I reuse my code for the same controls as WPF?
Do have to duplicate the code? I hope not...
Bye
Matthias
What I want is to create a grid-control that can also act as TreeList-control. Can you tell me what is a good base-class for such a control?
Basically, it depends on several factor and you have more options. In my opinion, I would choose to go with Panel, incase if I need more control during layout and arrange process.
Or else, you could simply extend from the ItemsControl and write you own control. But if you are planning for much bigger implementation, then I would highly suggest you to read the implementation of GridControl available in the WPF Toolkit.
Tree List Control On Code Project
And another question: If I develop a control in Silverlight, how can I reuse my code for the same controls as WPF?
Sharing Code Between WPF and Silverlight From MSDN

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