简体   繁体   中英

Is it possible to use a silverlight reference in wpf?

This might be a very stupid question but from what i understand quite a substantial amount of SILVERLIGHT is a subset of WPF. I've also made a side to side comparison of the references in a new SILVERLIGHT application and WPF application. Judging by the names, many can be applied to the other.

But there's a particular reference I'm looking for to place in my 'PF app that's not present in the list of available references but is there in the SILVERLIGHT NAVIGATION APPLICATION' references.

System.Windows.Controls.Navigation

This should allow me to (In theory anyways) change a source page on the main window by button click which is (from what I've researched) only available by default in a SILVERLIGHT NAVIGATION APPLICATION'. eg click button 1; MainWindow shows page A. Click button 2; MainWindow shows Page B.

So my question is it it possible to add this reference to WPF like so many others seem to be? Or am I misleading myself by assuming that just because they're named the same they're the same thing? Knowledge much appreciated.

Silverlight uses a different CLR than WPF. The CLR used by Silverlight is much smaller and lacks many features that WPF enjoy. Occasionally it also has some features that the main .net framework does not have.

Due to this difference any DLL cannot be directly interchangeable between Silverlight and WPF unless they are created as so. By default the following libraries are interchangeable ...

Mscorlib
System
System.Core
System.ComponentModel.Composition
Microsoft.VisualBasic 

In your case it might not be possible to reference that dll from WPF

More information

As Tanmoy says, the actual assemblies to reference even for features common to both WPF and Silverlight may differ.

That being said it is my understanding that WPF and Silverlight share many of the navigation concepts and you can even write a WPF browser application that would behave and look like a Silverlight application in a similar way.

The entry point for reading on this subject for WPF is here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM