I am referencing a library with a different assembly in a Xamarin.Forms app using Xaml in Visual Studio Mac Preview.
<?xml version="1.0" encoding="utf-8"?>
<ContentPage
xmlns ="http://xamarin.com/schemas/2014/forms"
xmlns:x ="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:RTE.Test.Forms"
xmlns:rte="clr-namespace:RichTextEditor;assembly=RichTextEditor"
x:Class ="RTE.Test.Forms.RTE_Test_FormsPage">
<rte:RichTextForm
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</ContentPage>
When I look at the iOS preview screen in VS, the RichTextForm renders perfectly. However, when I run the test on iOS simulator, I get the following error:
Xamarin.Forms.Xaml.XamlParseException: Position 8:3. Type rte:RichTextForm not found in xmlns clr-namespace:RichTextEditor;assembly=RichTextEditor
I have tried changing namespaces and assembly names, but since the Previewer can find the type just fine, I don't think this is the problem.
Related
the font.otf is imported correctly and placed inside the correct folder because the font works on letters but importing an icon from the otf file does not work because of the syntax error. Entering &#x before the icon code "uf1ea" is what caused the error but it's important for finding the icon otherwise it would just display "uf1ea" on the emulator and not the actual icon.
here's a snippet of the code i wrote in app.xaml :
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="testingfont.App">
<Application.Resources>
<ResourceDictionary>
<x:String x:Key="Newspaper">&#xuf1ea;</x:String>
</ResourceDictionary>
</Application.Resources>
</Application>
You don't need to add a u in your icon code, just use it like below:
<x:String x:Key="Newspaper"></x:String>
After adding the icon codes in a new class, this worked for me:
<Label Text=""/>
This is my code. I put the Calendar reference in my code. but in visual studio shows me this message.
"The type 'conrtols:Calendar' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built"
could any one help me?
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:XamForms.Controls;assembly=XamForms.Controls.Calendar"
x:Class="CalendarApp.MainPage">
<StackLayout>
<controls:Calendar Padding="10,0,10,0"
SelectedBorderWidth="4"
DisabledBorderColor="Black"
ShowNumberOfWeek="false"
StartDay="Monday"
TitleLabelTextColor="Purple"
TitleLeftArrowTextColor="Blue"
SelectedDate="{Binding Date}"
SpecialDates="{Binding Attendances}"
DateCommand="{Binding DateChosen}"/>
</StackLayout>
</ContentPage>```
I have a multiplatform app set up, so far it is working decently. My main issue though is I need to change the layout between IOS and Android. In my main solution I have a class called LocationView:
class LocationView : ContentView {
LocationView() {
InitializeView();
}
}
...and it's subsequent XAML:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Cabs.Views.LocationPage">
<ContentPage.Content>
<Label Text="I'm regular with a bunch of regular stuff" />
</ContentPage.Content>
</ContentPage>
For IOS, I need to change and subsequent controls (UIcontrols based, etc)
What is the correct way of doing this?
I know it has something to do w/ DI, not sure of the syntax. I tried the following:
[assembly: Dependency(typeof(LocationPage))]
It still isn't working
I try calling await Navigation.PushAsync(new DependencyService.Get<LocationPage>())
But I get a compile error
What is the correct procedure for this?
Thanks
Trying to figure out Xamaring and VS by playing around with it and I've had an issue with MasterDetailPages for a couple of days.
Process
Went from a blank file and turned the MainPage.xaml into the
MasterDetailPage
added a content page into MasterDetailPage.Master
and a content page into MasterDetailPage.Detail
Added a stack layout and a label into both of their ContentPage.Content and ran the project fine.
Thought I'd try out the next step and add a new xaml file as a reference ContentPage, but just with the .Master first. Code went from
<MasterDetailPage.Master>
<ContentPage Title="Master Page" Padding="10">
<ContentPage.Content>
<StackLayout Margin="5,30,5,5">
<Label Text="NavMenu Master Page"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>
</MasterDetailPage.Master/>
//TO WHAT I HAVE BELOW THIS
<MasterDetailPage.Master>
<local:NavMenu Title=NavMenu/>
</MasterDetailPage.Master>
Ran the file and I got the error that is in the title. Tried to troubleshoot by rolling it back to the original conent and the error persisted. Created a new file, copied and pasted the code into the other file and it ran just fine.
I'm clueless to what the issued is and how I should go about fixing it.
With your first code, it isn't necessary to put ContentPage.Content as it is implicit that the code is child from that element. Other than that, your code seems to be fine.
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;"