I am using this plugin for display badge count on tab. But some how it's not displaying. I think the problem with Naxam.Bottombar.plugin is used for display tabbar at the bottom in android. Because If I am using default TabbedPage then it works fine. How can I solve this?
I have followed all steps described in the badge plugin.
Code:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Graysons.Views.MenuPage"
xmlns:local="clr-namespace:Graysons.Customs"
xmlns:cc="clr-namespace:Graysons.Controls"
xmlns:vm="clr-namespace:Graysons.ViewModels"
xmlns:convertors="clr-namespace:Graysons.Convertors"
xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
xmlns:resources="clr-namespace:Graysons.StringResources"
xmlns:plugin="clr-namespace:Plugin.Badge.Abstractions;assembly=Plugin.Badge.Abstractions"
Title="Menus" Icon="ic_menus.png" plugin:TabBadge.BadgeText="1" plugin:TabBadge.BadgeColor="Red" plugin:TabBadge.BadgePosition="PositionBottomRight" plugin:TabBadge.BadgeMargin="15"
Style="{StaticResource CustomTopBar}">
..............
</ContentPage>
Also Added Line for rendering badge count in AssemblyInfo.cs file.
Any help will be appreciated.
the following renderer to be added Platform specific folders, not in the main project AssemblyInfo.cs
[assembly: ExportRenderer(typeof(TabbedPage), typeof(BadgedTabbedPageRenderer))]
for eg: for iOS.
Sample.iOS/Properties/AssemblyInfo.cs
use this header
using Plugin.Badge.iOS;
then use the renderer
[assembly: ExportRenderer(typeof(TabbedPage), typeof(BadgedTabbedPageRenderer))]
for Android.
Sample.Android/Properties/AssemblyInfo.cs
use this header
using Plugin.Badge.Droid;
then use the renderer
[assembly: ExportRenderer(typeof(TabbedPage), typeof(BadgedTabbedPageRenderer))]
Related
Do you know how to create a SlideUpPanel like GoogleMaps for both Android and iOS using Xamarin?
If I use SliddingupPanel layout is only for android
Help me, please.
I would suggest you use DKSlideUpPanel
It's easy to use and fast
Steps:
First, simply reference the NuGet package in your Xamrin.Forms projects.
Second, initialize SlidingUpPanel instance either in XAML or C#.
Lastly, apply the SlidingPanelConfig for your customizations.
How to use:
Add a mainView something like this;
<DK:SlidingUpPanel x:Name="spTest">
<DK:SlidingUpPanel.MainView>
<StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
**MainDesign**
</StackLayout>
</DK:SlidingUpPanel.MainView>
Set panel ratio and if you want the toolbar visible:
<DK:SlidingUpPanel.PanelRatio>0.4</DK:SlidingUpPanel.PanelRatio>
<DK:SlidingUpPanel.HideNavBar>True</DK:SlidingUpPanel.HideNavBar>
Check the following guide for an even better understanding of how it works:
https://www.c-sharpcorner.com/article/xamarin-forms-slideuppanel-app/
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
Today i faced some issue. Please help me.
I created a cross platform application on IOS and Android. So i trying to access my MainPage controls form .cs file but i can't. Here is provided code.
MainPage.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"
xmlns:local="clr-namespace:Movies"
x:Class="Movies.MainPage">
<TableView x:Name="mainTable">
<TableSection>
<ViewCell>
<ViewCell.View>
<Label Text="Hello"></Label>
</ViewCell.View>
</ViewCell>
</TableSection>
</TableView>
</ContentPage>
MainPage.xaml.cs
using Xamarin.Forms;
namespace Movies
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
mainTable.
}
}
}
https://i.imgur.com/OKO3yYc.png
Project runs successfully.
https://i.imgur.com/ondjVkP.png
I tried rebuild and even restore VS17 in VS installer.
this.mainTable doesn't work either.
Click on the .XAML file, select Properties.
See a Property called Custom Tool. Change its value from MSBuild:Compile to MSBuild:UpdateDesignTimeXaml or if it is blank set it to MSBuild:UpdateDesignTimeXaml.
This will solve the problem.
Build the project once,then you can access the name in .cs file.
When I click on the ListItem, which is a .PDF, in my ListView, I want to save the file locally. Each ListItem has a different Uri.
Is there any way I can do that?
Currently, it's a bit tricky to implement from scratch a ListView onTap gesture - but you can use a nuget that gives that functionality for Xamarin Forms:
http://www.michaelridland.com/xamarin/freshessentials-for-xamarin-forms-the-must-have-nuget-for-forms/
Basically, in order to use it you can just add a property to your ListView and Bind it to a Command to your CodeBehind or ViewModel (if you're following an MVVM pattern or framework):
<ListView ItemsSource="{Binding MyCars}" fe:ListViewItemTappedAttached.Command="{Binding ItemTapCommand}">
Don't forget to add this resource as property/namespace of your ContentPage tho:
xmlns:fe="clr-namespace:FreshEssentials;assembly=FreshEssentials"
Ex.
<ContentPage xmlns:fe="clr-namespace:FreshEssentials;assembly=FreshEssentials" ... />
On Saving files - Because Xamarin.Forms runs on multiple platforms, each with its own filesystem, there is no single approach for loading and saving files created by the user.
You can follow this guide from Xamarin to know how to do that for every platform you are targeting: https://developer.xamarin.com/guides/xamarin-forms/working-with/files/#Loading_and_Saving_Files
New to Xamarin so following a simple intro/tutorial (here)to Xamarin forms (using Xamarin Studio on a Mac). Per instructions, I entered the following into the xaml file (HelloXamlPage.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="XamForms.HelloXamlPage"
Title="Hello XAML Page"
Padding="10, 40, 10, 10">
<Label Text="Hello, XAML!"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Rotation="-15"
IsVisible="true"
FontSize="Large"
FontAttributes="Bold"
TextColor="Aqua" />
</ContentPage>
The code-behind file (HelloXamlPage.xaml.cs) is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace XamForms
{
public partial class HelloXamlPage : ContentPage
{
public HelloXamlPage ()
{
InitializeComponent ();
}
}
}
When I try to build and run it for Android or iOS I get this error: Xamarin.Forms.XamlParseException - No Property of name HorizontalTextAlignment found. Checking the documentation, it's definitely a valid property. Any help/ideas appreciated.
You need to be using one of the latest versions of Xamarin Forms. Upgrade your Xamarin Forms NuGet package to the latest 2.0.1 and you will get the property.
2.0.0 (or the 1.5.2 pre releases) were the first to have the property.
If you use previous xamarin.forms version , You should use 'XAlign' Property Instead. :)