Extended DataGrid in Silverlight - silverlight

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.

Related

Using AdControl to display ads in a WPF application packaged for UWP

I (appear to) have successfully created a UWP package for my WPF application using the following guide:
https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net
Now I would like to take advantage of the AdControl class to display banner ads in my project, as detailed here:
https://learn.microsoft.com/en-us/windows/uwp/monetize/adcontrol-in-xaml-and--net
Is this possible? I don't see the "Universal Windows" section under References for my WPF project, which I can guess is because it’s not an original Universal Windows project. I do see it under References for the UWP package wrapper project I created using the guide above, but that doesn't help me show ads in the WPF project.
Any help appreciated.
You can add Universal Windows reference and use the API in your project as described here but you cannot use AdControl since XAML/UI in WPF is not the same as XAML in UWP and the AdControl is a UWP XAML control:
As mentioned above, there are exceptions to the rule that Windows 10
APIs are accessible from PC software. The first big exception concerns
XAML UI APIs. The XAML framework in UWP is different from the one in
WPF and you really don’t want to be mixing them up, anyways.

WPF Toolkit doesn't get displayed in the toolbox

I installed the wpftoolkit.msi and added a reference to it, but it doesn't get dipslayed in the toolbox, is there anything else that needs to be done? I followed the instructions from the code plex site, I can access some of the controls from code, only a few, I added WPFToolkit as a reference, does any other reference need to be added for the chart controls and so that they can be accessed from the toolbox?
EDIT: I added all dlls in the folder and still cannot access the chart control.
Answer: I provided an answer bellow you neeed to include a different namespace for the charts the default one from the codeplex site doesn't include all controls.
I believe this is the answer if you want to add the charting controls to your toolbox.
If you just add a reference to what the codeplex site says you won't get all controls.
using Microsoft.Windows.Controls doesn't work you need to include the reference name, if you click on properties for the reference name you can copy name, for charting it is: System.Windows.Controls.DataVisualization.Toolkit
For the toolbox:
Go to your toolbox, right click create a new tab. In the new tab right click choose items add all the controls from the System.Windows.Controls.DataVisualization.Toolkit namespace. You should have all of them in the toolbox.
Here it is http://wpf.codeplex.com/releases/view/40535
Installation and Usage Instructions
Please note: The WPF Toolkit is dependent on .NET Framework 3.5 SP1. You must install .NET Framework 3.5 SP1 in order to use any features in the Toolkit.
Instructions for using the WPF Toolkit binaries:
Install .NET Framework 3.5 SP1
If you have a previous version of WPF Toolkit installed, uninstall it through the Remove Programs dialog on the Control Panel (look for "WPF Toolkit October 2008" or "WPF Toolkit January 2009" or "WPF Toolkit March 2009" or "WPF Toolkit June 2009")
Download the WPFToolkit_Binaries or WPFToolkit_BinariesAndSource
Run the WPFToolkit.msi to install the WPFToolkit.dll and WPF Toolkit design time binaries to your Program Files folder
Reference the binaries in your project:
Reference WPFToolkit.dll in your project
Add a using statement ("using Microsoft.Windows.Controls;") to the top of .cs files
Add a new xmlns (for example, xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit") to the top of XAML files
Remember to use the namespace prefix (in the above example, ) in the body of your XAML

Silverlight Toolkit - Where is the AutoCompleteBox?

I just added the Silverlight 4 toolkit to my project via NuGet. (NuGet package "Silverlight Toolkit - All")
I can't find the AutoCompleteBox anywhere in the dlls added to my project. Where is it?
Things I've tried:
I cracked open all the dlls it added
to my project, and I don't see
AutoCompleteBox in any of them.
Looking at the Silverlight Toolkit
discussions, I don't see anyone mentioning its removal.
Looking at the Silverlight Toolkit
changeset history, I don't see it
being mentioned as removed.
I browsed the source, and I do see AutoCompleteBox in there, but it get compiled into a dll System.Windows.Controls.Input.dll, but when I add the project in via NuGet, I don't get that dll, instead I get System.Windows.Controls.Input.Toolkit.dll
Where is the AutoCompleteBox in the Silverlight Toolkit?
Its not in the Silveright Toolkit any more. As of Silverlight 4 it moved to the SDK. You should be able to drag the AutoCompleteBox from you toolbar to the designer and VS will add the reference to System.Windows.Controls.Input.dll for you.

Errors when referencing Silverlight class library from WPF application

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.

Exception when add Silverlight dll in WPF application

When i added the silverlight dll in the wpf application , i got the following exception.
Could not load file or assembly "System.Core, Version=2.0.5.0". The located assembly's manifest definition does not match the
assembly reference.
This is happening only in VS 2010 professional Beta 2.
You cannot use Silverlight directly in a WPF application, as they do not use the same version of the .NET Framework, thus the error message
Could you give some more details on your scenario ?
If you have a WPF app, you have more than what Silverlight can give to you.
If you are building a solution with multiple products, and one is WPF for the desktop, one is Silverlight for the Web, you need to create 2 different projects in VS.
Take a look at the source tree here:
http://expressionblend.codeplex.com/
Specifically, the Expression.Samples.Interactivity.Design branch.
This shows a few examples of how to put in property editors for use with Blend. I'm not sure if the same concept is transportable to the Cider design surface, but heck, Blend is nicer for pure XAML editing anyways. :)

Resources