I'm setting ToolboxItem(false) attribute on couple of classes in my control library to prevent the from being added to Toolbox. This attribute works perfectly well with ASP.NET designer but with WPF designer it seems to have no effect.
Is there some other way to achieve this with WPF or is just unsupported?
Found the answer myself. You should use ToolboxBrowsable(false) attribute from Microsoft.Windows.Design namespace rather than ToolboxItem(false) from System.ComponentModel.
Related
we have several applications in FULL MVVM using the Ribbon from Microsoft. And it works fine, it's a great and flexible component :)
I was surprised to have to build my own templates and bindings to be able to use the ribbon in MVVM (I didn't find those files anywhere).
We are still using the Ribbon DLL from Microsoft (released around 2010 ) and can't switch to the ribbon existing in the Framework because it doesn't work with our Templates/bindings. Nothing happens/appears. Using the XAML description, everything is fine. I'm probably missing something. Does someone use it in full MVVM and which approach did you use to get it working ? Does the Framework contains the Templates and bindings hided somewhere ?
To summarize, how to use the ribbon included in the 4.5 Framework in FULL MVVM ?
Thanks for your help guys :)
If you target .NET Framework 4.5 or later you could add a reference to System.Windows.Controls.Ribbon.dll and use the built-in RibbonControl as-is:
<Ribbon />
You should be able to use this one more or less the exact same way as you use your current version. The templating of a control has nothing to do with MVVM. And of course the control comes with a default template.
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.
I have to use VisualStateManager class in my WPF window, but as I have referenced the assemblies of both WPF Toolkit and PresentationFramework.dll in my project, C# is not able to resolve the VisualStateManager class and gives the compile error like -
"The type exists in both 'PresentationFramework.dll' and 'WPFToolkit.dll'" and I am not able to proceed.
How to tell C# compiler to use VisualStateManager class from either of the assemblies and get the project to compile successfully?
Since the .NET4.0, the WPF Toolkit has been included in the framework. You should be able to remove WPF Toolkit, update some namespaces and the application still compile.
This is an approach we have taken in a project where we recently upgraded from .NET3.5 to .NET 4.0
Best regards,
I had a similar problem, not to do with the VisualStateManager but with the TemplateVisualStateAttribute I was using for one of my custom classes.
Changing the WPFToolkit project reference alias fixed this for me, as per this question
I ran into the same problem, I can not remove the ToolKit because I need the AutoCompleteBox control, and I don not want to include and modify the toolkit source code; so the solution I used was using an extern alias for the toolkit reference.
To do this in Visual Studio right click on the WPFToolkit reference and select properties >> then change the "alias" field to WpfToolKit or any alias of your choice.
In my WPF Project I have a WPF Window. I want to use Sticky Windows Solution in my WPF Project. The library wants only one parameter: the System.Windows.Forms.Form object.
Does it exist any way to obtain a Form object starting from a WPF Window object?
No, it's not possible. A WPF Window has no inheritance relation with a Windows Forms Form. However it would probably be possible to adapt the code from the library to mentioned so that it works with WPF...
The approach others have mentioned of refactoring Sticky Windows Solution to support WPF forms sounds like your best option. If you really want to treat a WPF form as a Windows Form, maybe the below will help:
Would this work?
Host your WPF form in an ElementHost
control. (ElementHost enables a WPF element to be treated as a Windows Form control.)
Create a simple Windows Form
containing only this ElementHost
control.
Use a reference to this Windows Form in
your Sticky Windows Solution.
While it's not possible, the article and code does present enough information for you to create a WPF version.
Does anyone know about a Docking Control like Visual Studio for WPF, where Databinding for the Panes is supported?
I tried the DockManager from Infragistics and from Actipro, but they lack this support.
For example, the Panes for the content need to be bound through Databinding, so removing the Entity on the other side of the binding would also remove it from the DocumentHost.
Any Idea? Or a lightweight workaround for any control?
Full databinding support from every control is crucial for my project.
Thanks in advance.
You might consider AvalonDock on Codeplex. If it doesn't have the functionality you are looking for you can add it yourself since you get full source code!
I know this won't help the original poster but in case someone else comes across this with a similar question, there is a blog post with a sample using an attached property to implement binding support in the Infragistics XamDockManager.