Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

ContextAction Command from custom ViewCell

$
0
0

I have a custom ViewCell which gets selected by a Tempalte Selector.
Now i want that the Command from the ContextAction is executed in the corresponding page ViewModel,
but i don't now how to get the reference to MyPageName.

This is my custom ViewCell:

<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
          xmlns:local="clr-namespace:MyApplication.Converters;assembly=MyApplication"
             x:Class="MyApplication.Pages.Custom.CustomCell">
    <ViewCell.ContextActions>
                                <MenuItem 
                                    Command="{Binding Path=BindingContext.OnSettingsCommand, Source={x:Reference Name=MyPageName}}"
                                    CommandParameter="{Binding .}"
                                    Icon="settings_white.png"
                                    Text="More"/>
                                <MenuItem 
                                    Command="{Binding Path=BindingContext.OnDeleteCommand, Source={x:Reference Name=MyPageName}}" 
                                    CommandParameter="{Binding .}"
                                    Icon="delete.png"
                                    IsDestructive="True"
                                    Text="Delete"/>
                            </ViewCell.ContextActions>
    <ViewCell.View>
        <StackLayout 
                                Orientation="Horizontal" 
                                Padding="10"
                                Spacing="10">
            <StackLayout.Resources>
                <ResourceDictionary>
                    <local:DateConverter x:Key="dateConverter"/>
                </ResourceDictionary>
            </StackLayout.Resources>
            <Image Source="{Binding Image}" />
            <StackLayout Orientation="Vertical" HorizontalOptions="StartAndExpand"
                                             VerticalOptions="Center">
                <Label 
                                            Text="{Binding Title}"  
                                            TextColor="{StaticResource Dark}"
                                            VerticalOptions="End"
                                            Font="Medium, Bold"/>

                <Label 
                                            Text="{Binding CreationDate, Converter={StaticResource dateConverter}}"  
                                            TextColor="{StaticResource grayDark}" 
                                            FontSize="Small" />
            </StackLayout>
            <StackLayout Orientation="Vertical" VerticalOptions="Center">
                <Image Source="{Binding ImageConnectionTypeStatus}"/>
                <Image Source="{Binding ImageSignalStrength}"/>
            </StackLayout>
            <Image Source="arrow_right.png"/>
        </StackLayout>
    </ViewCell.View>
</ViewCell>

Does anybody have an idea ?


Trigger a Picker programmatically

$
0
0

Hi there,

I have a picker as a children on my stacklayout. If i press it, the items at the picker are shown, and i can select one. So far so good.

However i want to show it without having to press it, that is, for instance if i have an option at the tabbar, and i press it, i want the picker to show.
How can i achieve this?

Thank you!

XAM U closing - Xamarin Certification now meaningless/cancelled/worthless

$
0
0

cc: @NMackay Thought you'd find this interesting

After May 1, 2019, these programs, including Xamarin certification exams, will no longer be available and active subscriptions will be canceled. For more details, please read our FAQ.

Just got this in email. As I read it Xamarin University will soon be a thing of the past. It will all be self-taught and YouTube. I'm sure glad I had the opportunity to do these course with live instructors. I think this is saying that there won't be any more certifications. Is that what everyone else reads in this? I wonder how that affects the LInkIN area just for certified developers.

Xamarin University is moving to Microsoft Learn

In September 2018, Microsoft launched a free, interactive training portal, Microsoft Learn, incorporating many of Xamarin University's popular features. We're now preparing to merge Xamarin University into the new learning platform, where all coursework will be free.

What to expect

By early 2019, we'll transition most Xamarin University certification and Xamarin.Forms courses to our self-guided learning portal, where they'll be free. Then we'll gradually convert all self-guided learning courses to Microsoft Learn before we close Xamarin University in June 2019. At that time, remaining subscriber-only content, including labs and off-topic videos, such as guest lectures, will be made available on YouTube and GitHub.

Office hours and instructor-led-only courses will remain available until May 1, 2019, giving you time to finish any in-progress Xamarin certifications. After May 1, 2019, these programs, including Xamarin certification exams, will no longer be available and active subscriptions will be canceled. For more details, please read our FAQ.

Thanks for learning with Xamarin University. We're excited about sharing Xamarin content on Microsoft Learn, where we'll provide new features and content—free for everyone.

How to add buttons into the renderer map pin?

$
0
0

Is it possible to add some buttons into the rendered map pin and every button can trigger its associated event? If so, how to do it?

Setting BaseUrl on files loaded from Environment.SpecialFolder.LocalApplicationData

$
0
0

This should probably be straightforward but it's been giving me a headache.
Basically I'm creating an app that downloads a zip file containing html, css, javascript etc.
It unzips the contents and stores them in LocalApplicationData, loades the index.html into a webview likes so:

HtmlWebViewSource html = new HtmlWebViewSource();

html.Html = htmlString;
html.BaseUrl = DependencyService.Get().Get();
courseWindow.Source = html;

All of this works just fine, except I end with unformatted html, no scripts running etc..
I'm assuming this has to do with the baseURL but could it be something else like resources being blocked from loading?

If anybody has come upon the same issue or could point me in the right direction that would be great.

NavigationStack is not updated successfully in xamarin forms ios

$
0
0
I have a xamarin forms project and i use custom master detail page. so i have MasterDetailPage and NavigationPageRenderer in xamarin ios and xamarin android project. i want to navigate as follows

var mdp = App.Current.MainPage as MasterDetailPage;
await mdp.Detail.Navigation.PushAsync(new Page1());
await mdp.Detail.Navigation.PushAsync(new Page2());
await mdp.Detail.Navigation.PushAsync(new Page3());
await mdp.Detail.Navigation.PushAsync(new Page4());
await mdp.Detail.Navigation.PushAsync(new Page5());
await mdp.Detail.Navigation.PushAsync(new Page6());

i have a NavigationStack of 6 elements and i want to go Page2 from Page6. So I did the following operations
for (int i = 0; i < 3; i++)
{
mdp.Detail.Navigation.RemovePage(mdp.Detail.Navigation.NavigationStack[mdp.Detail.Navigation.NavigationStack.Count - 2]);
}
await mdp.Detail.Navigation.PopAsync();

i remove pages between Page6 and Page 2 and then i remove last page(Page6) with PopAsync. This worked successfully in android project. But it's not working in ios project. The stack successfully changed in the ios project, but view is not updated successfully. The screen appears as the title of page 6 and white screen. Page2 doesn't appear.

I tried the following
Device.BeginInvokeOnMainThread(async () => await mdp.Detail.Navigation.PopAsync());
and
await mdp.Detail.Navigation.PopAsync(true);

But it's not working.

Who can help me with this problem?

How to identify and reference to the dependent Assembly or Library among Projects? resolve Error CS0

$
0
0

How to identify and reference to the dependent Assembly or Library among Projects? resolve Error CS0012?

Error:

Error CS0012
The type 'IAsyncOperation<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows.Foundation.FoundationContract, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
ViewModels

My UWP app-solution has three projects:

Project-1 (UWP):
Target version: Windows 10 Anniversay Edition (10.0; build 14393)
Min version: Windows 10 Anniversay Edition (10.0; build 14393)
References:
Analyzers
HockeySDK.UWP
Microsoft.NETCore.UniversalWindowsPlatform
PcscSdk
Serilog
Serilog.Sinks.RollingFileAlternate.MultiPlatform
System.Reactive
UniversalWindows
Xam.Plugin.Battery
Xam.Plugin.PopupMenu
Xam.Plugins.Settings
Xamarin.Forms
Dependencies: Projects\ViewModel

Project-2 (Forms):
Target framework: .NET Standard 1.4
Dependencies: NuGet\
Xam.Plugin.Battery (3.0.1)
Xam.Plugin.PopupMenu (1.1.0)
Xam.Plugins.Settings (3.1.1)
Xamarin.Controls.SignaturePad.Form (2.2.0)
Xamarin.Forms (2.5.0.122203)
Dependencies: Projects\ViewModel
Dependencies: SDK\NETStandard.Library(2.0.1)

Project-2 (ViewModel):
Target framework: .NET Standard 1.4
Dependencies: Assemblies\ Windows.Foundation.UniversalApiContract
Dependencies: NuGet\
System.Reactive (3.1.1)
Xam.Plugin.Battery (3.0.1)
Xam.Plugins.Settings (3.1.1)
Xamarin.Forms (2.5.0.122203)
Dependencies: SDK\NETStandard.Library(2.0.1)

Label TextColor Binding on iOS doesn't updates

$
0
0

Hi,

I have a very simple page, just with one label whose text color is data bound to a property in VM. However the color of the text updates fine on Android each time the property changes but doesn't updates on iOS at all.

There seems to be a bug in iOS. Can you please address this issue?

I am using XF 3.4


How to use filesystem folder as baseUrl for the WebView?

$
0
0

Hi,
I have this problem: I want to load an html string that use a css file the I downloaded in the temp path. With iOS I have no problems, but in Android i cannot make it works.

Any ideas?

This is the code:

var temppath = System.IO.Path.GetTempPath();

// This is my function to download the file in the temp folder.
DownloadCssFunction("http://.../demo.css", System.IO.Path.Combine(temppath, "demo.css");

var html_string = "<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Hello World</title><link href="demo.css" rel="stylesheet" type="text/css"></head><body><h1>Hello World</h1></body></html>";

var html_source = new HtmlWebViewSource();
html_source.BaseUrl = temppath;

// I also try this but without success
// #if __ANDROID__
// html_source.BaseUrl = "file://" + temppath;
// #endif

html_source.Html = html_source;

WEBView.Source = html_source;

How to reference downloaded assets within a WebView in a shared PCL Project

$
0
0

I am downloading a zip file from our server which contains html files, images, css etc. unzipping the files and saving them within the PCL using PCLStorage nuget package.
To view the content I am using a WebView to display the html that has been loaded successfully via reading in a stream and converting to byteArray to get at the HTML.
The problem is that relative references to images, css & js do not work even when setting the baseUrl for the HtmlSource using a dependency service as suggested in other support topics. (tested on Android and iOS simulators)
How can I load these downloaded assets in the WebView?

when all BindableProperties get initialized from XAML regardless their declaration order?

$
0
0

This happens a lot when creating custom controls (mostly in code only). In many cases some properties (if not all) are dependent on each other, like for example: ItemsSource and DisplayMemberPath .. etc- I need to know the value of DisplayMemberPath while I'm iterating over the ItemsSource to render controls (set the Text of a Label to the value of DisplayMemberPath).

when I process Items in the ItemsSource collection I want to make sure that the DisplayMemberPath property has also been set,
when using the propertyChanged delegate of the ItemsSourceProperty it's likely that the DisplayMemberPathProperty is null, if it's set in XAML after ItemsSource:

<controls:FlowList ItemsSource="{Binding Items}" DisplayMemberPath="Title"/>

so, where is the proper place where I'll be sure every property has been set regardless their declaration order?

Login with Facebook

$
0
0

Hi people, my name's Leonardo, i have a solution of xamarin forms and it is a application android and ios, i need create a login that use facebook login, but, all help in internet not help me because nothing is functional, I tryed use Xamarin.auth and I no have success, please help me, sorry, my inglesh not is good.

UWP InAppNotification in Xamarin.Forms?

$
0
0

Hello,

I have a Xamarin.Forms App and I want to show in app notifications (about loading progress etc.). I use Toast.MakeText for Android and for UWP I would like to use the InAppNotification from the UWP community toolkit. This is obviously a UWP XAML control which I cannot add to my Xamarin.Forms pages.

Can I somehow add this control from an Interface (which allows me to use UWP controls) to my current page? I use Interfaces to generate custom popups for each platform, but I did not find an option to add a UWP XAML Control to the current page.

Regards,

Philipp

Opening Oauth2 page with self signed certificate causing webview to display security warning

$
0
0

Is there a way I can prevent the security warning popup from displaying. Is there a solution where I can still use my self signed certificate or do I have to use a trusted certificate?

    var authenticator = new OAuth2Authenticator(
            Constants.OAuthAuthCodeLocal.ClientId,
            "",
            Constants.OAuthAuthCodeLocal.AuthorizeUrl,
            Constants.OAuthAuthCodeLocal.RedirectUrl);
        LoadMask = true;
        authenticator.Completed += OnAuthCodeAuthenticationCompleted;
        authenticator.Error += OnAuthCodeAuthenticationError;
        AuthenticationState.Authenticator = authenticator;

        var presenter = new OAuthLoginPresenter();
        presenter.Login(authenticator);

Missing required Icons

$
0
0

Hi,

we have a problem uploading our app to the iOS app store for some days now. Actually it is a Forms App but hope it's still correct in this forum.
The app was working before but since we updated to Mojave and updated some of the Xamarin stuff there seems to be problem in building the asset catalog.
When trying to upload the ipa to the app store we get errors like:

ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '76x76' pixels, in .png format for iOS versions >= 7.0."
ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '167x167' pixels, in .png format for iOS versions supporting iPad Pro."
ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '152x152' pixels, in .png format for iOS versions >= 7.0."

We already deleted bin/obj folders. Recreated the asset catalog. Checked the path in info.plist.
Everything seems to be fine.

I could figure out that the Assets.car that is created in copied to the ipa is empty or includes a default Xamarin Forms image.
I checked my build output and there are two entries related to the Assets.car:

    Copying file from '/Users/.../iOS/obj/iPhone/Release/actool/bundle/Assets.car' to '/Users/.../iOS/bin/iPhone/Release/....iOS.app/Assets.car'

and later:

    Copying file from '/Users/.../iOS/obj/iPhone/Release/Assets.car' to '/Users/.../iOS/bin/iPhone/Release/....iOS.app/Assets.car'

This makes actually no sense to me. The first copies the correct file to the bin path with the related assets. The second seems to copy an empty template file. Does that make sense to anyone? Is it possible to change the build process or is the actool building incorrect?

Any help is appreciated.

Chris.


How can I implement Google Authentication in a Xamarin Project?

$
0
0

I have searched a lot on Google but almost every one of the tutorials that I found wasn't implementable, the only one that I could almost use was this: Sample-XamarinAuth-Google by TimLariviere (I wasn't able to post link).

But I'm facing a problem, in this project, it uses the Main.axml to show the layout, in my project that I want to implement the functionality, all of the pages are in the shared project, how can I refer to a button of the shared project content page in the MainActivity.cs of the Android specific project?

OBS: Sorry for my bad English.

Using UrhoSharp in mixed-dimension UWP app

$
0
0

I'm interested in building a UWP app that, when launched, has a default 2D XAML type view, but can switch to a secondary 3D UrhoSharp view (incidentally, this is to be run on HoloLens). I'm new to UrhoSharp but I'm able to follow some online tutorials that create a 3D UWP UrhoSharp application by creating a new UWP app in Visual Studio, deleting the "App.xaml" and "MainPage.Xaml" classes and then defining a new UrhoSharp entry point by adding the following:

using Urho;

public static class Program
{
    [MTAThread]
    static void Main() => CoreApplication.Run(new UrhoAppViewSource<MixedRealityApplication>());
}

and:

using Urho;
using Urho.SharpReality;

internal class MixedRealityApplication : StereoApplication
{
    public MixedRealityApplication(ApplicationOptions options) : base(options)
    {
        // Do some initialization.
    }

    protected override void Start()
    {
        // Start drawing some 3D stuff
    }
}

The above works and I'm able to see my 3D objects. Now I wish to create a UWP application that starts with its default view as a standard 2D XAML window but then be able to switch to a 3D UrhoSharp view when clicking a button. I found a thread on this forum titled "Right Way to Run UrhoSharp As Part of 2D UWP on HoloLens" where the author has done exactly that. However, the code example is very sparse (1 or 2 lines) and I can't get anywhere. I've tried using the (unmodified) "MixedRealityApplication" class in the code above in the way used by the author:

Using Windows.ApplicationMode.Core;
using Urho;

private void Button_Click)object sender, RoutedEventArgs e)
{
    CoreApplicationView urho3DView = CoreApplication.CreateNewView(new UrhoAppViewSource<MixedRealityApplication>());
    ...etc...
}

The above throws the following exception when trying to instantiate "urho3DView": "System.Runtime.InteropServices.COMException: 'A method was called at an unexpected time.'"
I not sure what else to try, and the fact that it seems possible according to the linked post is tantalizing. Does anyone have any idea as to how to go about this? If only the author had shown what "HelloWorldApplication" looks like in his/her code.

Reporting bugs in Visual Studio with Xamarin

View as:Generic not showing in latest Xamarin.iOS Designer ?

$
0
0

I am using VS for Mac for Xamarin.iOS development. I do not see "View as: Generic" option to support for any screen sizes. My iOS designer allows me to design UI only for a particular device size. Enabling and disabling "AutoLayout" and "Use Size classes" does not make any difference. My Xamarin.iOS and VS for Mac is of latest version. Can somebody help me how to get generic view back ?
Thanks

Difference between AndroidApp and Android XamlApp?

$
0
0

Hi,
What's the difference between AndroidApp and Android XamlApp (Xamarin.Forms)?

Viewing all 204402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>