ContentView does not have a ControlTemplate - c#

I am just starting with xamarin to play around with it, and thought xamarin forms would be a good place to start to learn.
I began following this tutorial:
https://developer.xamarin.com/guides/xamarin-forms/templates/control-templates/creating/
which has a line as follows:
contentView.ControlTemplate = (originalTemplate) ? tealTemplate : aquaTemplate;
The problem for me is that my local code says that ContentView does not contain a definition for ControlTemplate.
The only xamarin related using statement in the document is:
using Xamarin.Forms;
I have the following declaration at the top of the class aswell:
ControlTemplate mainTemplate = new ControlTemplate(typeof(MainTemplate));
This has the error 'The type or namespace ControlTemplate could not be found'
When I try rebuild it throws that as an error, so it isn's just VS 2015 being slow.
I downloaded xamarin yesterday.
My JDK is 1.7.0_55.
My android SDK was downloaded yesterday (don't know where to find version)
My android NDk is version r10e.
Any suggestions are appreciated.
Thanks

Use Nuget manager in VS to be sure you have the latest version of the Xamarin Forms packages.

Related

Error Code :XamlC error XFC0000 : Cannot resolve type "MediaElement"

I just updated to Xamarin Forms 5 and I cannot seem to fix this error, my app was completely fine before this and had no errors and now I updated I get this error and all of my dependencies have a yellow warning symbol on them, any help would be appreciated thanks.This image is a screenshot of the error along with my page that it is saying the error is on and my dependencies
MediaElement has been moved to Xamarin Community Toolkit package (soruce). Under the xaml namespace:
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
<xct:MediaElement ...
Official documentation
https://learn.microsoft.com/en-us/xamarin/community-toolkit/views/mediaelement
Official repo
https://github.com/xamarin/XamarinCommunityToolkit

The name 'HapticFeedback' does not exist in the current context - Xamarin.Forms

I'm creating an app in which I want to utilise Xamarin.Forms' haptic feedback feature. This feature is currently under preview - so I went to the Microsoft documentation and got it setup as expected.
First of all - in my AssemblyInfo.cs in my Android project I added the following code:
[assembly: UsesPermission(Android.Manifest.Permission.Vibrate)]
Then I pasted in the following code from Microsoft into my code-behind:
HapticFeedback.Perform(HapticFeedbackType.Click);
After adding the code I get the following message:
Steps to reproduce
Open up a new project and under the Android AssemblyInfo.cs add the following code:
[assembly: UsesPermission(Android.Manifest.Permission.Vibrate)]
Paste in the following code: HapticFeedback.Perform(HapticFeedbackType.Click);
Now you should notice that intellisense says that HapticFeedback does not exist in the current context.
Things I've tried
I tried to update Xamarin.Forms and Xamarin.Essentials - but it still was not recognised for some reason
I tried to close and reopen the solution - but it sitll was not recognised.
I am looking for a solution to this so I can use haptic feedback in my application.
Image
The Xamarin.Essentials: Haptic Feedback is only available in Xamarin.Essentials pre-release version now.
To get pre-release version, check the include prerelease in the right corner:
Then you can use HapticFeedback in your project.

using Zxing.Net Mobile for forms does is not recognize

I am new in Xamarin.Forms and I want use the bar code scaner by Zxing.
however I install the plugin form nuget:
1)ZXing.Net.Mobile for Forms
2) ZXing.Net.Mobile. -> install it since I read somewhere it would help my problem but its not.
as far as I understood I need to add this line: to the Android project in main Activity
However alotugh I install the packages I am still getting an error of:
The type or namespace name 'Andorid' does not exist in the namespace 'ZXing.Net.Mobile.Forms' (are you missing an assembly reference?) ScannerZXing.Android
what can I do? (perofrm clean and rebuild for the project didn't help)
also would like to add that it is added in the referecnes of the projects.
Thanks for the ansewrs.
In my case the reason was that I installed only ZXing.Net.Mobile.Forms. After installing ZXing.Net.Mobile it`s gone. (two libraries need to be installed)
UPDATE: After trying to run the project I discovered that you actually need both Nuget Packages
Previous: Just in case anyone had the same issue as me there are actually two ZXing.Net.Mobile packages both of which by Redth. They both have the exact same description as well unfortunately. I tried the first one which at the time of this writing had the most downloads... however it produced the error as described. By uninstalling and reinstalling the second I resolved the issue:

System.Data namespace missing from visual studio 2013 for windows blank app template

I have created new blank WP8.1 app from visual studio 2013 for windows and trying to test some database tutorials.
When i try to add System.Data, i get an error "type or namespace data does not exists in namespace System" and it's not shown in intelisense. Also, when i try to use some thing from system.data, there is no option to "fix error" by adding required namespace.
When i create Databound app template, i can use system.data normally..
Can someone help me with this?
From the screenshot above it looks like you're creating a WinRT template, that's why the System.Data namespace is not present. The DataBound template is Windows Phone Silverlight-based, and it has System.Data.
You can try one of the following:
1. When you create a Blank App, select "Blank App (Windows Phone Silverlight)"
2. Look at this similar thread with more info: WinRT System.Data - Connect to SQL
Hope that helps! Please let me know!

Visual Stusio doesn't recognize System.Web.DataVisualization

I'm writing a Windows Forms application in C# in Visual Studio.
I'm using the MSChart in my project.
I want to create an object:
public Series myseries = new Series("Default");
The VS doesn't recognize the class Series. As far as I understand, it would be recognized if I write
using System.Web.DataVisualization
If I add using System.Web.DataVisualization then the project doen't recognize DataVisualization . It says that DataVisualization doesn't exist in System.Web.
I looked at the list of references in the project. On the tab .NET I see a reference about System.Web.DataVisualization.dll . To be sure, I found this .dll and dragged it to the project - it didn't help.
I reinstalled MSChart component. No change. The DataVisualization is still not recognized in System.Web.
I've found in the Internet several suggestions how to solve this issue - nothing has helped.
Could you please direct me what may be the reason for DataVisualization being not recognized?
Thanks a lot!
the following line has helped: using System.Web.UI.DataVisualization.Charting

Categories

Resources