I write this for chat app in WP7, and I need to put it on project
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:Chat.Controls">
and I get this error
Error 7 Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'Chat.Controls' that is not included in the assembly. C:\Users\Amin\Documents\Visual Studio 2010\Projects\Chat\Chat\WP7_Chat\Control.xaml 4 36 Chat
Need I to add an assembly or what??
Doing xmlns:Controls="clr-namespace:Chat.Controls" means that you're using a namespace local to the current assembly (in the same project as that piece of XAML), but the compiler says that it doesn't exist.
So either you have the wrong namespace, or you're missing the assembly after the namespace (something like xmlns:Controls="clr-namespace:Chat.Controls;assembly=Chat.Controls"
Related
A class in "Assembly - CSharp" is not recognized or used by a class in another namespace.
The error I'm getting now is:
Unity Editor: The type or namespace name 'LogitechGSDK' could not be found (are you missing a using directive or an assembly reference?)
IDE: Namespace does not correspond to file location
How do I set it up?
have you setup the dependencies/references for the class not inside the "Assembly - CSharp"? If so you should add Assembly - CSharp to the depencies/references of the Assembly you want to use it in. Here is a link that could help you fix your Problem.
https://learn.microsoft.com/en-us/visualstudio/ide/managing-references-in-a-project?view=vs-2019
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 ...
I am wrote this XAML code in an Xamarin.Forms app (multiplatform):
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyNameSpace;assembly=MyAssemblyName"
Padding="0,20,0,0">
<TabbedPage.Children>
<local:Page1 />
<local:Page2 />
...
MyNameSpace is the namespace I choose when creating the project, and MyAssemblyName is the project name.
Page1 and Page2 are others XAML/cs pages.
This does not work. I had errors on Xamarin preview and at execution. Those errors said my assembly name is not found or something like that.
I have checked options in iOS and Android sub projects. Those options where auto generated at creation.
I see that assembly names are: MyAssemblyName.iOS and MyAssemblyName.Droid
If I rename both to MyAssemblyName, my project works.
My questions are:
Is it a good thing to have the same assembly name for iOS and Android project?
Why this tags did not work with default assembly names?
You are probably in a "Shared Project". If this is the case, each platform you have in your solution has an assembly, but the Shared Project (the one you write most of the code) doesn't.
The solution for this error is to simply remove the assembly=MyAssemblyName from the xmlns:local string. It should be xmlns:local="clr-namespace:MyNameSpace;"
Was wondering if someone had a good idea of how to handle this.
In WP7.1, we can utilize the excellent Windows Phone Toolkit to include some useful controls such as LongListSelector and Panorama. These are part of the Microsoft.Phone.Controls.Toolkit assembly.
In WP8, we do not need the toolkit for those two controls because they're part of the official Microsoft.Phone.Controls assembly.
I have multi-targeted my app so that I have two phone projects, WP71 and WP80, where I link files in WP80 to files in WP71.
This works great until I try to use the Panorama or LongListSelector control in a XAML page. In the WP80 project, if I reference the WP80 DLL of the phone toolkit, it does not include the two aforementioned controls because, surprise, they're already present.
The issue is, WP71 needs the namespace declaration at the top of the XAML and the namespace is different for both projects.
WP71:
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
<toolkit:Panorama />
WP80:
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
<phone:Panorama />
I cannot build the projects because each project thinks the namespace is incorrect if I just use one because they need to point to different assemblies.
I don't think I can use compile constants in my XAML, otherwise that would be a fix.
My workaround was originally to just reference the older WP71 DLL in my WP80 project. But other 3rd party libraries bind against the official 8.0 SDK DLL (Caliburn, in my case) so it causes problems.
How can I solve this pickle? The only idea off the top of my head was to resort to code-behind to create the instance of the control :( Is there a better way?
Don't use a link, create a separate view for each.
Another solution might be to create a PanoramaEx control in each of the relative projects and inherit from Panorama. Then the view would reference the PanoramaEx control and you could still use a link to a single view. That's if both UI projects have the same namespace.
Edit: isn't panorama for WP7 in the namespace:
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
I do use my initial solution for ProgressBar and PerformanceProgressBar, I have a ProgressBarEx in each UI project, the WP7 one inherits from ProgressBar and the WP8 one inherits from PerformanceProgressBar and then in the views I reference ProgressBarEx.
Might not be the most elegant solution, but you can try to use a T4 file (.tt file) to generate both targets.
<## template language="C#" hostspecific="true"#>
<## output extension=".xaml"#>
<## assembly name="EnvDTE" #>
<phone:PhoneApplicationPage
x:Class="PhoneAppDemo.Pages.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
<# IServiceProvider serviceProvider = (IServiceProvider)Host;
EnvDTE.DTE dte = (EnvDTE.DTE)serviceProvider.GetService(typeof(EnvDTE.DTE));
var configName = dte.Solution.SolutionBuild.ActiveConfiguration.Name;
if (configName == "WP7") { #>
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
<# }else{ #>
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
<# } #>
>
<# include file="Page.xaml" #>
</phone:PhoneApplicationPage>
In this example, the inner content of the Page is in "Page.xaml". We just encapsulate it in <phone:PhoneApplicationPage> at processor time, based on the target name (usually Debug and Release, but in this example we assumed there was a target WP7).
For other stuff related to a multi-targeted silverlight app, you can always read Maintaining a WP7 and WP8 version of a same Silverlight application.
I used ToggleSwitch control in windowsphone, It works fine in windowsphone7 version, takes Microsoft.Phone.Controls as a assembly reference. But in the windowsphone7.5 it asks assembly reference for ToggleSwitch control, it's not included in Microsoft.Phone.Controls. Anyone know the assembly reference for windowsphone7.5 ToggleSwitch control.
The ToggleSwitch control is part of the Silverlight Toolkit, and is part of the namespace Microsoft.Phone.Controls.
To enable it in your project, add a reference to the toolkit dll (or better yet, use NuGet to install it), and then reference the namespace in your XAML
(I'm sure you already know this stuff, and that the actual alias you choose isn't important as long as you use the same one when adding the control to the XAML - using "toolkit" here because that's what I normally do)
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
and make sure your declaration of the control in the XAML includes the namespace reference...
<toolkit:ToggleSwitch ... ><!-- more stuff here --></toolkit:ToggleSwitch>