Silverlight custom controls - wpf

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

Related

dragable controls in runtime Similar to a toolbox in wpf

I want to create a project in WPF for designing a custom report.
For this, I need a library to add controls to a panel, canvas, etc. with drag and drop at runtime.
Controls should be resizable and moveable with the mouse. Finally I want to print this.
Telerik's WPF controls contain the Diagram Control which supports the features you mention out of the box. I use it for a very similar scenario as you describe and it works well. The might be a counterpart offered by Infragistics as well.
With .NET framework's built in features and/or free libraries you will able to cover the drag&drop part. You will have to implement the rest yourself which is possible but too much to ask for one question.
Late reply, but I came across this. Take a look at this
There are 4 parts that show how to do a toolbox with what you're looking for.

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.

WPF control and windows normal control

In a WinForms project there are a number of controls such as MenuStrip, OpenFileDialog, SaveFileDialog.
After a quick look, I can't seem to see the equivalents for these controls in the WPF toolbox.
Is there any way to gain access to these or do they exist in another form?
There are a number of different resources you can use for finding the type of control you need.
Have you looked in the WPF Toolkit?
Have you investigated any third party control vendors?
(Telerik, DevExpress, ComponentOne, Infragistics)
Here's an excellent link comparing the WinForms and WPF control equivalents.
You'd probably recieve a more detailed answer if you gave specifics as to which control you're looking for.
you can add a winforms host into the project but which controls are you after as the wpf does have a decent amount of controls and generally does more in the ui department (but pays in speed usually)

Visual Studios Controls

Is there a way to download more controls or anything, because I have seen a few things in other programs I don't think I've seen in the toolbox. Can you download new ones, or did the company somehow custom make a control? If it was custom made, are there any tutorials I can take a look at that tell how to make your own?
Some companies make third party controls for Winforms - Telerik is one I know of.
Personally, I prefer to make my own controls based on the existing WinForms ones, as I have more control over them - this prevents my products from having bugs which just can't be fixed. I can also tweak the controls to do exactly what I need, rather than choosing a closest match. Building custom controls is relatively easy if you have the experience.
There is a basic tutorial on CodeProject which shows how to create a fancy Button. After that you should be able to figure out how to customize more complex controls.
Side-note:
While it's reasonably easy to develop custom controls in WinForms if you have the time to practice, WPF is a much better framework for building custom controls. WPF controls are designed specifically for customization, so there is a lot more flexibility.

wpf vs winforms by means of customizeable UI

Which technology (WPF or Winforms) should be used if UI supposed to be highly customizable like controls layout/design could be change by user and such sort of UI customization.
Kindly mention best practices along to achieve that...
I just recently developed a designer in both WinForms (company req) and WPF (to see how much better it was). WPF has a definate edge, especially when it comes to nicer looking controls and control transparency.
This was my first actual WPF project, other than just messing around, so I was learning as I went. I found this series on creating a diagram designer very helpful. I didn't really do the same things that this article talks about, but more of a hybrid between that and my WinForms app.
I have to admit that the UI functionality was up and running much faster in the WPF version than with the WinForms version.
WPF I have found the easiest to create controls on a fly. Because I can just attach them as child controls to the parent, and the Grids, Dock Panels, just make life easier.
I found WinForms to be clunky to always work with. However I come from a Web background and Xaml makes sense to me.
WPF controls are design and lookless. That means you have a default view of them, but everything detail of a WPF control can be overridden. It's almost akin to using CSS. In the WPF world, you do not create custom controls like you do in WinForms. The main thing in WPF world is "styling" controls and defining a style for them. It just happens that the style also controls the layout and the form of the controls.
WPF is FAR superior for designing and style of UI. Check out these two top WPF companies and tell me if this stuff is easy to do in WinForms:
Cynergy Systems: http://www.cynergysystems.com/
Thirteen23: http://www.thirteen23.com/

Resources