Im trying to convert my WPF project, written in MVVM template into a silverlight project.
However, i am running into some problems.
There is a class in the ViewModel folder (WPF) called BaseViewModel, that uses System.Windows.UIElement and System.Windows.Application.
But I can not find reference to these classes. Is there a workaround?
Both of these classes are in Silverlight's System.Windows namespace and are supported in SL 3 and 4.
Try installing the Silverlight 4 Tools for Visual Studio from here. When creating a new Silverlight project in VS2010, the reference should be added automatically. For reference, my path to the reference was:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Windows.dll
Related
How do I create a WPF UserControl using .Net Core 3.1 in Visual Studio 2019?
I looked through the default templates available in "Add .. New .. Dialog," but I don't seem to see it.
Am I missing something?
Do I need to add it from a the command line?
I've got the DevExpress WPF/.Net Core packages installed and can add a DevExpress flavoured UserControl.
I'm able to create/add one of those from the installed templates.
How do I do so in vanilla .NetCore/WPF
Thanks,JohhB
Same as WinForms...compile your code, open Toolbox, drag it from there onto either your designer page or into the XAML code directly.
How can I add this (ExtendedDataGrid) to my Silverlight project ?
Here is the link to the project I am referring to
http://wpfextendeddatagrid.codeplex.com
Error is:
You can't add a reference to ExtendedGrid.dll as it was not built
against the Silvelright runtime. Silverlight projects will only work
with Silverlight assemblies.
That project was built for WPF and not Silverlight.
This is extended version of WPF toolkit DataGrid control.
Please note: As code of wpf datatgrid in wpftoolkit is moved inside
ExtendedDataGrid project , kindly update Microsoft.Windows.Controls
namespace to ExtendedGrid.Microsoft.Windows.Controls to use existing
objects.
The error message you included in your post states as much.
Silvelright projects will only work with Silvelright assemblies
Remember Silverlight is a stripped down version of .Net used for the browser plugin, and as such will not work with full version of .Net.
Unless you actually go into the source code of that project and try to port it to silverlight then there is currently no other way for you to add that project to your Silverlight project.
I would advise looking into the Silvelright toolkit and it's datagrid. It may not be as full featured as the one you are trying to reference but it covers the basic requirements for a datagrid in silverlight. There are also some open sourced versions that have been extended for silvelright.
I must be brain dead. I have tried for six hours now (with Google) and can not solve this very very simple problem.
In Visual Studio 2010, I created a project. (right-click on solution, Add new project...).
Inside the new project, I created a new folder of name Helpers. To the folder I added a class for a converter.
Inside the project, I added a new XAML window (in WPF). The Target Framework is .Net Framework 4.0
Everything has been built (multiple times) without compilation errors. The platform target build for the project is X86.
The problem: Intellisense does not see the namespace for the class under the Helpers folder and so the Visual Designer fails. The namespace in the Helpers folder is:
Chaos.UI.Helpers
and trying to reference this namespace in the XAML like:
xmlns:converters="clr-namespace:Chaos.UI.Helpers"
ofcourse results in the dreaded:
Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'Chaos.UI.Helpers' that is not included in the assembly.
These are clean files in the same project. The only added code is in the converter class contained in the Chaos.UI.Helpers namespace.
How do I fix this? (I need the designer to work).
Anybody, Plz help
Try use assembly
xmlns:converters="clr-namespace:Chaos.UI.Helpers;assembly=Chaos.UI"
I have a WPF Prism application that I'm building. The application is to the point where I want to be able to add EventTriggers to controls so I can call commands on the underlying view model. However, I can't seem to reference the correct DLLs to make the project run. Currently, I'm referencing Microsoft.Expression.Interactions and System.Windows.Interactivity from the C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries directory.
When I run the module, I get this error:
Could not load file or assembly 'System.Windows.Interactivity,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
The system cannot find the file specified.
I checked the System.Windows.Interactivity assembly in reflector and can see that it references:
mscorlib
PresentationCore
PresentationFramework
System
System.Core
System.Xaml
WindowsBase
All the references point to the 4.0 framework. I've referenced each from the .NET reference tab, making sure that each one is the 4.0 version. All these references are being loaded from the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 directory.
Is there another download I need for the System.Windows.Interactivity and Microsoft.Expression.Interactions assemblies to work in my environment?
For some reason that I still cannot fathom, Prism includes it's own version of the Blend SDK assemblies. So you should reference Microsoft.Expression.Interactions.dll and System.Windows.Interactivity.dll from the Lib\Desktop folder of the Prism distribution (assuming you're using Prism v4) rather than from the Blend SDK installation.
For people landing on this page experiencing this problem but where the above given solution isn't working, you might have a look at: Prism assembly reference failure: System.Windows.Interactivity
I have a WPF application and a Silverlight application. They are both used to display a map and share some of the same functionality.
I have created a Silverlight class library project in order to stay DRY. I'm referencing this from both Silverlight and WPF. It contains some utility methods that are useful in both projects. For example, I have this method:
public static void CenterText(TextBlock name, Polygon poly)
The silverlight project has no problem with this. However, I get the following error when calling this from my WPF application:
The type 'System.Windows.Shapes.Polygon' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
However, I have this line at the top of the file:
using System.Windows.Shapes;
so WPF can see the Polygon class perfectly fine.
My guess is that the silverlight class library uses a version of the framework which is not compatible with the version that the WPF project is using.
So the question is, am I stuck rewriting exactly the same code in my WPF application or is there some way I can share between the two?
Thanks!
You are right, Silverlight uses a completely separate version of the framework. It's much, much smaller than event the .NET client runtime.
This means you can't mix WPF and Silverlight assemblies in the same application.
I ran into this error because I had downloaded the Expression Blend SDK for Silverlight instead of what I SHOULD have downloaded: Microsoft Expression Blend Software Development Kit (SDK) for .NET 4. It can be found on MSFT's website, here:
http://www.microsoft.com/en-us/download/details.aspx?id=10801
As soon as I downloaded the Expression Blend SDK for .Net, removed all of the Blend SDK for Silverlight references, and added those same references as Blend for .Net, I was up and running.
In Silverlight the class is in System.Windows.dll while in WPF it is in PresentationFramework.dll the library tries to get a hold of the Silverlight assembly which is not referenced by default in a WPF application.