Could not load GestureEventArgs from System.Windows.Input - windows-phone-7

I have been searching for a solution but couldn't find any yet.
Situation is that I have a customcontrol that uses GestureEventArgs to apply some effect on the "Tap" event. The GestureEventArgs come out of the System.Windows.Input namespace. This is a WP7 (7.1) project by the way. If I use this control in an other WP7 (7.1) project my visual studio 2010 just crashes. No error or exception.
When I open the xaml file in Blend I get the following error:
TypeLoadException: Could not load type
"System.Windows.Input.GestureEventArgs" from assembly
"System.Windows.Input, version= 2.0.5.0, Culture = neutral,
PublicKeyToken=7cec85d7bea7798e"
The only cause that I see is that in the Microsoft.Phone.Controls namespace in my otherproject, also has a GestureEventArgs. But there isn't a complaint about ambiguity.
Anybody has been in this situation?
A fix would be awesome!

I ran into this when I installed and referenced the Windows Phone Silverlight Toolkit. It adds a new GestureEventsArgs to System.Windows.Controls. I got around this by aliasing my using for System.Windows.Input
using input=System.Windows.Input;

Related

Rg.Plugins.Popup Crashes on closing popup only in UWP

I'm using Rg.Plugins.Popup for a while but I can't get it working anymore on UWP for new projects.
While its working perfectly in Android, I get this error in UWP :
Exception thrown: 'System.NullReferenceException' in Rg.Plugins.Popup.UWP.dll
Object reference not set to an instance of an object.
Rg.Plugins.Popup.UWP.dll!Rg.Plugins.Popup.Windows.Renderers.PopupPageRenderer.UpdateElementSize() Line 124
I made a small test repo here.
I use Rg.plugins.popup 1.1.5.188, Xamarin 5.0.0.2012 and the targeted plaform in UWP is 10.0.19041.
Can anyone help me and/or check if you get the same behavior ?
I also notice that with Rg.plugins.popup version 2.0.0.12, I get another error :
Error CS0234 The type or namespace name 'Popup' does not exist in the namespace 'Rg.Plugins.Popup' (are you missing an assembly reference?)
Here is my initialisation code in UWP, just as describe in the WIKI:
What a waste of time ...
https://github.com/rotorgames/Rg.Plugins.Popup/issues/527
The minimum target has to be set to 10.0.17763 or higher. Not only the target version. That was the trick.
So stupid ...

Accessing resources XML from another library project in Xamarin.Android

I am trying to create a Xamarin.Android Component to send to the Xamarin Component Store, and I need to bundle my Colors.xml with it, so it is accessible to everyone using my component. I am setting the build action for the Colors.xml tp "AndroidResource".
So I created an Android sample application, when I add a reference to my library project's dll, I am able to use the colors defined, my project compiles and it runs, but I get no intellisense on Xamarin Studio. So that would be a bad thing for anyone using my library, as they would not be able to even see that the colors are available to use. You can see in this picture the colors defined are not available in the suggestions box.
If I add the Colors.xml directly into my project, I get Intellisense support, like this:
Is there a way to achieve the same result above when adding just the dll reference? Did I do something wrong or Xamarin.Android/Xamarin Studio doesn't support this kind of scenario?
EDIT: To be clear, I know this is a problem with Intellisense not being able to pick up the values, but is there anything I can do to make it work?

Debugging XAML databinding in Visual Studio 2012

In the Silverlight 5 beta I could debug databinding directly in XAML. Where is this feature in Visual Studio 2012 (RC)? Can I do this with WPF, WinRT and/or Silverlight? If so how? When I set a breakpoint on a binding expression application, I get the message that the breakpoint will not be hit because no source code is associated with this line.
Update:
It works in Visual Studio 2012 (RC) for Silverlight 5 applications but not for WPF applications. Please don't tell me, that this feature does not exist for WPF!
Sorry to tell you but this feature DOES NOT exist in WPF XAML nor does it exist in WinRT XAML. I can't find an official source for WPF, but here is a pretty official one for WinRT (http://social.msdn.microsoft.com/Forums/en-US/toolsforwinapps/thread/fae53937-cb47-45da-b740-49f75f8d36e9/) he insinuates pretty strongly that this was an effort spearheaded purely by the Silverlight team and can possibly be expected in future versions of WPF and WinRT.
So far the best debugging techniques I've seen are as follows:
1) WinRT & WPF: Output Window
Using the output window with the proper options enabled, make sure Tools->Options->Debugging->Output Window->Data Binding = "Warning" or something else useful...
2) WinRT & WPF: Use a converter
Using a converter and just setting a break point inside the converter. Or you can build/use something similar to how WinRT XAML Toolkit does: http://winrtxamltoolkit.codeplex.com/.../WinRTXamlToolkit.Debugging/Converters/BindingDebugConverter.cs
3) WinRT: Use DebugSettings.BindingFailed
App.Current.DebugSettings.IsBindingTracingEnabled = true;
App.Current.DebugSettings.BindingFailed += (s, e) =>
{
// debug the failed binding here
};
see: http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.debugsettings.bindingfailed for more information
4) WPF: Use PresentationTraceSources.TraceLevel Attached Property
Gives you a verbose output of the binding, see: http://msdn.microsoft.com/en-us/library/system.diagnostics.presentationtracesources.tracelevel.aspx for more information.
I realize this is an older question, but I couldn't find a good source of information for everything XAML, found this answer off a search engine and noticed it was still lacking an answer. It doesn't help that there are technically 3 versions of XAML going by the same moniker. So here's the dump of everything I found while investigating debugging bindings. Enjoy, hope it helps someone... -ck

Silverlight ChartingToolKit is not coming in xaml page

i wanted to implement charts in my silverlight app.
i have installed SL4 in my VS.
The problem is i m not getting the chartingToolkit:Chart control in my xaml page.
Gives error saying control not found .
Did i forget to add any references?
or did my installation went wrong?
do i have to download any other plugin?
Thanks
Sajad
chartings controls are from the Silverlight toolkit, you need to install it first.;)
http://silverlight.codeplex.com/
i have added the assemblies as mentioned by Xin.
System.Windows.Controls.DataVisualization.Toolkit,
System.Windows.Controls.Toolkit
System.Windows.Controls.Toolkit.Internals
But my problem was actually solved by adding this to namespace area.
xmlns:toolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
and then i could use toolkit:Chart
:)

Is it possible to reference Silverlight 3 class library by .Net 3.5-based project in VS.net 2008?

First, I know Silverlight project can't reference to non-Silverlight based project like Windows class library or Asp.net MVC project. But I need to create my projects which can support both Silverlight-based project & Asp.net MVC project.
So, I created Silverlight-based project for my sharing source code. It works fine on VS.net 2008 & .Net 3.5 SP1. However, I found some error when I try to use some method of Silverlight-based project from .Net-based project like the following code.
Silverlight-based Method
public static void InitializeInstance(object obj)
{
// Initialize Field Value
foreach (FieldInfo fi in obj.GetType().GetFields())
{
foreach (Attribute attr in fi.GetCustomAttributes(true))
{
if (attr is DefaultValueAttribute)
{
DefaultValueAttribute dv = (DefaultValueAttribute)attr;
fi.SetValue(obj, dv.Value);
}
}
}
// Initialize Property Value
foreach (PropertyInfo pi in obj.GetType().GetProperties())
{
foreach (Attribute attr in pi.GetCustomAttributes(true))
{
if (attr is DefaultValueAttribute)
{
DefaultValueAttribute dv = (DefaultValueAttribute)attr;
if (pi.CanWrite)
{
pi.SetValue(obj, dv.Value, null);
}
}
}
}
}
.Net-based Method
private void Form1_Load(object sender, EventArgs e)
{
InitializeInstance(this);
}
Error Detail
System.IO.FileNotFoundException:
Could not load file or assembly
'System, Version=2.0.5.0,
Culture=neutral,
PublicKeyToken=7cec85d7bea7798e' or
one of its dependencies. The system
cannot find the file specified. File
name: 'System, Version=2.0.5.0,
Culture=neutral,
PublicKeyToken=7cec85d7bea7798e' at
InitializeInstance(Object obj)
Finally, I try to solve this problem by copying system.dll of Silverlight to output directory and reference it. It still shows same error. So, I think this error may be limitation of both .Net & Silverlight platform. Do you have any idea for avoid this issue?
PS. I know I can use this technique for a few sharing code. But it’s impossible to do this for my projects. Because it’s very complicate & very complex more than directly create Silverlight-based or .Net-based class library.
Thanks,
The trouble here is that those types share an assembly with a different strong name: System.Windows in Silverlight, PresentationFramework or PresentationCore on the desktop CLR.
So at runtime, the intended type cannot be loaded, and there are no type forwarders for the Silverlight-to-desktop types.
My recommended solution
Consider using file links, instead of actually trying to reference the same built binary.
This way, you can have a source structure for your project that may look like this:
MyApp\
Silverlight\
Page.xaml
Page.xaml.cs
(link) ..\AspMvc\MySharedDataFile.cs
AspMvc\
MySharedDataFile.cs
MyApp.cs
This way, the source will be re-compiled with both projects. We use this on the Silverlight Toolkit to build many controls, including the charting and data visualization controls, for both WPF and Silverlight. This is by rebuilding for each platform, instead of referencing the binaries from both.
To insert a link in Visual Studio, just right-click on your project or one of its folder, Add Existing Item, then find it in the explorer open file dialog. however, instead of just clicking the button, click on the little down arrow drop-down on the Add file button, and select the "Add as link" option.
Then, it simply builds that file from another location, but it is not a copy, so you can maintain it in one place and use in both.
A crazy solution
You can use .NET reflection from your desktop app that is of a much higher trust to actually create a new app domain, hook up to the assembly resolution event, and see what that does. You may be able to instead return the type from the desktop CLR, or just no-op these warnings.
No clue if it works.

Resources