I have a problem. I am using the Nuget package: Rg.Plugins.Popup.Pages with this colorPicker: Spillman.Xamarin.Forms.ColorPicker.
I created this page:
<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
x:Class="Memento.Dialogs.ColorPicker"
xmlns:colorPicker="clr-namespace:Spillman.Xamarin.Forms.ColorPicker;assembly=Spillman.Xamarin.Forms.ColorPicker">
<pages:PopupPage.Animation>
<animations:ScaleAnimation
PositionIn="Center"
PositionOut="Center"
ScaleIn="1.2"
ScaleOut="0.8"
DurationIn="400"
DurationOut="300"
EasingIn="SinOut"
EasingOut="SinIn"
HasBackgroundAnimation="True"/>
</pages:PopupPage.Animation>
<pages:PopupPage.BindingContext>
<colorPicker:ColorPickerViewModel />
</pages:PopupPage.BindingContext>
<ContentView HorizontalOptions="Center" VerticalOptions="Center"
Padding="8" BackgroundColor="White">
<colorPicker:ColorPickerView />
</ContentView>
</pages:PopupPage>
But when I try to define the page like this: ColorPicker_Popup = new ColorPicker(); I get the following error:
Android.Content.Res.Resources+NotFoundException: 'Resource ID #0x7f0700c3'
What am I doing wrong?
Can't you do it like this?
await PopupNavigation.PushAsync(new ColorPicker(), true);
Related
In Xamarin, I frequently used <NavigationPage.TitleView> to customize the navigation title bar in my views. Now that I am working in MAUI, this tag seems to have no effect on a ShellItem view.
Here is AppShell.xaml:
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="MyApp.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:localize="clr-namespace:FleetHDMobile.Resources.Strings"
xmlns:local="clr-namespace:FleetHDMobile.Views"
Shell.FlyoutBehavior="Disabled">
<ShellItem Route="MainPage">
<ShellContent
Title="MainPage"
ContentTemplate="{DataTemplate local:MainPage}"
/>
</ShellItem> . . .
Here is MainPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:localize="clr-namespace:FleetHDMobile.Resources.Strings"
Shell.FlyoutBehavior="Flyout"
x:Class="FleetHDMobile.Views.MainPage">
<NavigationPage.TitleView>
<Label
Text="XXX"
HeightRequest="44"
WidthRequest="300" />
</NavigationPage.TitleView>
<ScrollView>
I have tried making MainPage a tab in the tabbar, but that didn't customize the title view either.
The <NavigationPage.TitleView> tag has no effect on the rendered view. I would like to put small logo icons in the title bar, but cannot figure out how to do so.
There are some known issues about this problem.
You can follow up them here:
https://github.com/dotnet/maui/issues/9269
https://github.com/dotnet/maui/issues/9687
Thanks for your support and feedback.
Did you try doing it through the ViewModel or the .cs of your View ?
Such as for MainPage.xaml.cs or MainPageViewModel.cs
public class MainPageViewModel
{
public MainPageViewModel
{
Title = “”; // or this.Title = “”;
}
}
Please tell me how to change size of icon in Toolbar.Because when I put another icons with the same resolution they are too small
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Icon="{Binding CurrentIcon}"
x:Class="App1.BicyclePageMain"
xmlns:control="clr-namespace:App1"
BackgroundColor="{AppThemeBinding Light=White, Dark=White}">
</ContentPage>
I just started to use Xamarin. Now i have learnt how to create Cross Platform Apps. But now i have a Worry. I want to get input from the input Box as this
Here is what my XAML looks like :
<?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="Qasimapp.Page1"
BackgroundColor="#fff">
<ContentPage.Content>
<StackLayout Spacing="20" Padding="50" VerticalOptions="Center">
<Image Source="slim_logo.png" x:Name="logom" HeightRequest="100" WidthRequest="100"/>
<Entry Placeholder="Username"></Entry>
<Entry Placeholder="Password" IsPassword="True"></Entry>
<Button Text="Log In" TextColor="White" BackgroundColor="#ff77D065"></Button>
</StackLayout>
</ContentPage.Content>
</ContentPage>
And use this to connect to a database using WebAPI or something like a normal PHP API and redirect to another form such as the Dashboard. here is what my PHP looks like
<?php
require_once('inc/config.php');
$con = mysqli_connect($host,$user,$pass,$db) or die ('Cannot Connect to Database'.mysqli_error());
$username = mysqli_real_escape_string($con,$_POST['userID']);
$passwd = mysqli_real_escape_string($con,$_POST['passwd']);
$designation = mysqli_real_escape_string($con,$_POST['designation']);
$query = "SELECT * FROM evmsdbusers WHERE username='$username' AND password='$passwd' and designation='$designation'";
$result = mysqli_query($con,$query);
if (mysqli_num_rows($result) == 1) {
if($designation == 'User')
{
saveLoginLogs();
}
else if($designation =='Security')
{
saveLoginLogs();
}
}
?>
Now i have uploaded it to a server on here http://32.125.23.120/login.php for instance and i want to use it to login using XAML cross platform
How can I achieve something like this? How can it Authenticate and then redirect to the main Page i want it to? I am very new to something like this and all my search prove abortive .
I've searched everywhere on google and it seems like this 'Pull To Refresh' feature is only available for ListViews. There are some posts regarding 'Pull To Refresh' for WebView but they are coded in Java and in Android Studio. Is there any easy way to implement this?
You can use #jamesmontemagno's PullToRefreshLayout and include your WebView inside PullToRefreshLayout element:
<?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="RefreshSample.Views.ScrollViewXamlPage"
xmlns:controls="clr-namespace:Refractored.XamForms.PullToRefresh;assembly=Refractored.XamForms.PullToRefresh"
Title="Xaml Scroll">
<controls:PullToRefreshLayout
IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsBusy}"
RefreshColor="Blue">
<WebView>
</WebView>
</controls:PullToRefreshLayout>
</ContentPage>
I created my own custom renderer in Xamarin that looks like so:
namespace TestApp
{
public class CustomEntry : Entry
{
public CustomEntry ()
{
}
}
}
How can I include this in my HomePage.xaml file? I tried this:
<?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:TestApp;assembly:TestApp"
x:Class="TestApp.SubPage">
<ContentPage.Content>
<StackLayout>
<local:CustomEntry></local:CustomEntry>
</StackLayout>
</ContentPage.Content>
</ContentPage>
But it didn't work, saying CustomEntry is not a valid control in the "http://xamarin.com/schemas/2014/forms" namespace. Any ideas?
Try changing <x:local="clr-namespace:TestApp;assembly:TestApp"> into <xmlns:local="clr-namespace:TestApp;assembly:TestApp">
And <x:local:CustomEntry> into <local:CustomEntry>
Nevermind, I found the problem. It seems that the xmlns:local declaration I had was wrong. I had this:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestApp;assembly:TestApp"
x:Class="TestApp.SubPage">
And it was this:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestApp;assembly=TestApp"
x:Class="TestApp.SubPage">
Seems that assembly was assigned with the '=' operator, not the ':' one. The class stayed the same and everything works now.