Is it possible to create a WPF control in C++/CLI, like in WinForms? If so, is there a sample/doc somewhere going through the process, since there is no such project type in vs2010.
Thanks
Yes, it's possible, but you will have to write code to create all your subcontrols and set their properties, because C++/CLI and XAML don't work together. It's very similar to writing a WinForms UI without the aid of the Forms Designer.
Start just by subclassing one of the WPF controls, perhaps Panel.
Related
I want to make lists in a WinForms project like this one:
Is there an easy way to do it? or I have to code it by my self??
Would depend on whether or not you re using WinForms or WPF. In WPF, you could use list box templates:
http://msdn.microsoft.com/en-us/library/cc189093(v=vs.95).aspx. I think it would be harder in WinForms and I'm not aware of any controls that match the appearance you are looking for although you might check out the Telerik and DevExpress WinForm controls.
I would like to create an application using WPF and MVVM Light but i don't know how to organize my application layout for a MVVM application. The idea is to have something similar to Visual Studio:
A main Window with tabs, toolbox and menu that can be docked and moved to different locations. I had been able to easily create this layout using Telerik WPF controls and their sample but all in a simple XAML file with it's code behind, I have no idea how to transform it into a MVVM application.
I would like each pane/window/toolbox to be a different view with its own View Model. I checked tutorials but I didn't find how to have one single application displaying simultaneously multiple views/viewmodels in the same "main window".
Have I do define each view in a specific user control? Have I to use ContentControl to organize my layout? Should I use data template? How to handle binding on multiple view/viewmodels within the same window ?
Thanks a lot for your help!
Doots
look at using http://avalondock.codeplex.com to get a layout like visual studio. Then you could put usercontrols in the LayoutPanes for your views, and have those binded to your viewmodels.
Thanks for your replies! Now i understand, I think I was searching way too far and made it more complex than it should...
Avalon seems a very nice solution, but I have a Telerik licence then I will go for it. If anybody is having the same issue, just take a look at this answer from Laurent Bugnon: http://mvvmlight.codeplex.com/discussions/252035
Thx
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
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/
I have an existing WinForms application for which I'm now designing new bits in WPF. Things are going reasonably well and I have run into my first need for a dialog.
I'd like to do the dialog in WPF. It appears as though I'm going to need to do a UserControl for the actual content and then host that content via a WinForms form with an ElementHost (since UserControl has no ShowDialog() method).
And that's where my question is. How does that work? Best I can tell, the WPF UserControl doesn't even have a DialogResult property (which makes sense given that it has no ShowDialog() method) - it looks to me like I'd need a WPF Window control - and I don't think I can use that in this case.
Struggling with the basic flow and setup of things here. Can someone shine a light?
Is this even possible?
You can open a WPF window from a WinForms application.
Just create the window and call ShowDialog(). The CLR will load the WPF framework and open the window.
If you want your interop application to work mostly like a WinForms app, then the approach you describe works fine -- I've pretty much the same thing in my interop cases.
WPF supports MessageBoxes (albeit a slightly different version than WinForms), and you could put something together using WPF Windows (extending it by adding something similar to DialogResult). However, the provided WPF controls suggest that they're trying to change UX interactions to minimize dialogs, particularly modal ones.
To make your life easier though, I would create a WinForms Form/ElementHost subclass specifically for dealing w/hosting WPF content, and depending on how clean you like your "using" declarations, wrapping your own DialogResult-like enumeration so you don't have to include the System.Windows.Forms namespace which can make your WPF code-behinds more cumbersome.