Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

i am using WKWebView for ios in xamarin forms to display pdf but it is not working in real device

$
0
0

Control.LoadRequest(new NSUrlRequest(new NSUrl(Path,false)));
Control.Reload();

i am using this code it is working fine in simulator but not in real device help!


Open tab from other page

$
0
0

Hi all,
I created a ContentPage with 4 buttons, and a TabbedPage with 4 tabs.

Now I can open the TabbedPage, but always shows the first tab and I'm trying to open the tab that is selected on the button, first button opens TabbedPage on the first tab, the second button I want to open the TabbedPage on the second tab...

But I don't know how to do it, help will be appreciated.

StackLayout : bug with horizontal orientation and long text in entry

$
0
0

Hi,

I want to use a layout similar to the one presented in the last example of this page : https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/stack-layout/

My goal is to align in Android a label and an entry in a horizontal StackLayout like this :

`<StackLayout Orientation="Horizontal">
        <Label FontSize="14" Text="Ask me about:" TextColor="White"
        HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/>
        <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono... " TextColor="White" BackgroundColor="Maroon" />
      </StackLayout>`

This example renders OK. However if I use a longer text, the entry will expand towards the label and make it shrink :
image

I can try to fix that by setting the MinimumWidthRequest on the label, but then I got another problem :
It seems the entry sets its minimum width to the length of its text. When the text is too long, you can see that the entry overlaps on the right side of the screen. The problem here is that when the entry overlaps, I cannot scroll the text horizontally (like in a 'normal' entry), making it really difficult to view and edit.
image

Is there a way to make the entry sets its width correctly, regardless of the length of the initial text ?

Thanks !

how can stretch background content image?

$
0
0

How can i set the background no-repeat but stretch dinamically to all page?

Show two pages side by side or as seperate pages

$
0
0

Hello,

I have two pages (a master and a detail page) that I want to show in my Xamarin.Forms app. The layout can be compared the UWP Mail app: The master page contains the list of all messages and the detail page shows one e-mail message. When the width of the app is small (e.g. phone), only one page is shown at a given time. When the users wants to read the email message (= visit the details page), the list of messages disappears and only the email message is shown (= navigates from master page to detail page). When the width of the app is sufficiently large (e.g. tablet in landscape mode), the list of email messages is shown on the left and the selected message is displayed on the right (= master and detail page are shown side by side).

How can I recreate such a behavior for my app? My master page is a list view from which I can navigate to the detail page, but I also want to show these two pages side by side when the app is wide enough.

My details "page" does not have to be a XAML page, I could also use e.g. ContentView if this is easier. However, thus far I was unable to create the layout I described.

Regards,
Philipp

Xamarin Forms ADMob (Firebase.ADS) Not Show

$
0
0

Hello, I have a problem.
I am using the Firebase.ADS plugin to add ads to my application however I am getting this error message and the advertisement is not displayed!
I'm in a .netstandard2.0 project

12-29 22:05:30.118 I/Ads (24010): Ad failed to load : 3

I need Help Please!

iOS Native Linking Error

$
0
0

When I attempt to run my xamarin forms app using the iOS simulator I'm getting the following errors around linking. I'm using a new dll that I created. The simulator is paired with a mac mini that is running macOS High Sierra Version 10.13.3, Xcode 9.1, and Visual Studio for Mac Enterprise 7.4. I was curious if anybody had any ideas about what was causing these errors?

Severity Code Description Project File Line Suppression State
Error Native linking error: framework not found /Users/dwighthyde/Library/Caches/Xamarin/mtbs/builds/UCH.MHC.Mobile.iOS/febaa3b698a046262026a17f2d96a20b/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/registrar.o UCH.MHC.Mobile.iOS

Severity Code Description Project File Line Suppression State
Error Native linking failed. Please review the build log. UCH.MHC.Mobile.iOS

Severity Code Description Project File Line Suppression State
Error Native linking failed. Please review the build log and the user flags provided to gcc: -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/dwighthyde/Library/Caches/Xamarin/mtbs/builds/UCH.MHC.Mobile.iOS/febaa3b698a046262026a17f2d96a20b/obj/iPhoneSimulator/Debug/Entitlements.xcent UCH.MHC.Mobile.iOS

Change google map info window text when it is appearing

$
0
0

my current situation that i want when user click on marker i send a request to get clicked position address and show it in the info window it working for IOS but android has problems


Deploying HttpClient - NameResolutionFailure - only on iOS device

$
0
0

Hi All,

I'm having an issue with httpClient, but only on my iOS device (I've not checked Android but I'm not targeting it), it works well in the emulator.

When my app loads the ViewModels do a API call to try and get data from my server and I almost immediately get a System.Net.WebException: Error: NameResolutionFailure crash. I don't get this in the iOS emulator for the same API call.

I tried calling https://jsonplaceholder.typicode.com/posts which I know works and rules out anything idiosyncratic bugs in my code but it still fails.

Is there anything special I need to do enable internet access on an iOS device? Could I have set up something wrong in my provisioning profile in the Apple Account?

Thanks in advance

Complie Error

$
0
0

Any one help, when tried to compile system throw below error. three times uninstall VS and Xamarin. but no use.

packaging of 'C:\Users\XXXXXXX\AppData\Local\Temp\nykza20f.fpe\resources.apk.bk' failed App1.Android C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1703
ERROR: unable to open 'obj\Debug\81\lp\5\jl\bin\classes.jar' as a zip file: -40 "classes.jar' as a zip file: -40". App1.Android C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1703
unable to process jar files while packaging 'C:\Users\XXXXXXX\AppData\Local\Temp\nykza20f.fpe\resources.apk.bk' App1.Android C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1703

Hover Effect is not working properly on button in Xamarin UWP

$
0
0

I tried to add a hover effect for a button.
Following code shows a custom class created in UWP

[assembly: ResolutionGroupName("MyCompany")]
[assembly: ExportEffect(typeof(FocusEffect), "FocusEffect")]
namespace EffectsSample.UWP
{
    class FocusEffect : PlatformEffect
    {
        protected override void OnAttached()
        {
            try
            {
                (Control as Windows.UI.Xaml.Controls.Control).PointerEntered += pointer_Entered;    
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
            }
        }
        private void pointer_Entered(object sender, RoutedEventArgs e)
        {           
            (this.Control as Windows.UI.Xaml.Controls.Control).Background = new SolidColorBrush(Colors.Red);   
        }         
        protected override void OnDetached()
        {
        }
       }
    }

Effect is added to button in xaml like below:

   <Button Text="Button">
        <Button.Effects>
            <local:FocusEffect />
        </Button.Effects>
    </Button>

The issue is that background is not changing on Pointer Enter Event. Instead it changes on Pointer Exit.
Any help will be appreciated!

Xamarin forms Push notification

$
0
0

I want to add push notification in my xamarin forms project. Which method is the best option to implement push notification.

SVG image is not displaying in android in xamarin.forms

$
0
0

I am trying ti display the SVG image in my xamarin.form application, there are no issues to display the SVG image in iOS but not able to display the same image in the android application.

here is my code to display the svg image
<ContentView.Resources> <ResourceDictionary> <ffimageloadingsvg:SvgImageSourceConverter x:Key="SvgImageSourceConverter"></ffimageloadingsvg:SvgImageSourceConverter> </ResourceDictionary> </ContentView.Resources> <ContentView.Content> <ffimageloadingsvg:SvgCachedImage Source="{Binding SvgFileName, Converter={StaticResource SvgImageSourceConverter}}" Grid.Column="0" WidthRequest="200" HeightRequest="600" ReplaceStringMap="{Binding BodyMapreplceStrings}" /> </ContentView.Content>

And from View Model I am binding the image as following

 public string SvgFileName
        {
            get { return _svgFileName; }
            set
            {
                _svgFileName = value;
                OnPropertyChanged();
            }
        }

and

SvgFileName="Flower.svg";

and given svg image in Resources for iOS and in Resources ->drawable

in MainActivity added following lines
CachedImageRenderer.Init(true);
var ignore = typeof(SvgCachedImage);

Is there anything I am missing?

How to detect text and search a location over mapview?

$
0
0

I added mapview using xamarin.forms.maps package. I wanted to add a searchbar field to search address and drop pin using search box.

How to add a SearchBar programmatically a search a location?

I tried the following:

var searchField = new SearchBar
{
Placeholder = "Enter search term"
};
searchField.SearchCommand = new Command(() => { if (searchField != null) { string.Format("Result: {0} is what you asked for.", searchField.Text); }
** // I don't get the text here**

Content = new StackLayout
{
Spacing = 0,
Children = {
searchField,
map,
buttons
}
};

Xamarin form : Unable to recieve IOS firebase token

$
0
0

i have developed a project for android and ios. FCM notificaiton works fine for android i can get token as well, but i am not able to get ios token from fcm and getting these errors

2018-12-29 16:12:31.298436+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID009001] Error removing keypair status: -34018
2018-12-29 16:12:31.299426+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID010007] Unable to remove RSA keypair
2018-12-29 16:12:32.865414+0500 Consultant.iOS[26902:871853] [Firebase/InstanceID][I-IID010003] Unable to generate keypair.
2018-12-29 16:12:32.865788+0500 Consultant.iOS[26902:871853] [Firebase/InstanceID][I-IID010009] Keypair could not be loaded from Keychain. Error: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:32.866843+0500 Consultant.iOS[26902:871853] [Firebase/Analytics][I-ACS020001] Failed to get InstanceID: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:32.887691+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID009001] Error removing keypair status: -34018
2018-12-29 16:12:32.887954+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID010007] Unable to remove RSA keypair
2018-12-29 16:12:33.061443+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID010003] Unable to generate keypair.
2018-12-29 16:12:33.062002+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID010009] Keypair could not be loaded from Keychain. Error: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:33.062421+0500 Consultant.iOS[26902:871906] [Firebase/Analytics][I-ACS020001] Failed to get InstanceID: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:33.078473+0500 Consultant.iOS[26902:871853] [Firebase/InstanceID][I-IID009001] Error removing keypair status: -34018
2018-12-29 16:12:33.078835+0500 Consultant.iOS[26902:871853] [Firebase/InstanceID][I-IID010007] Unable to remove RSA keypair
2018-12-29 16:12:33.600527+0500 Consultant.iOS[26902:871850] [Firebase/InstanceID][I-IID010003] Unable to generate keypair.
2018-12-29 16:12:33.600801+0500 Consultant.iOS[26902:871850] [Firebase/InstanceID][I-IID010009] Keypair could not be loaded from Keychain. Error: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:33.601524+0500 Consultant.iOS[26902:871850] [Firebase/Analytics][I-ACS020001] Failed to get InstanceID: Error Domain=com.firebase.iid Code=-34018 "(null)"
Thread finished: <Thread Pool> #78

How to export/save the keystore files from MAC

$
0
0

I am using MAC visual studio for xamarin forms app development. I am trying to take a back up for my android keystore files.

I found the keystore files at /Users/[username]/Library/Developer/Xamarin/Keystore/ in my MAC using keystore explorer. How can I export or save the keystore files from here? Copy/paste, drag and drop and export options are not working.

Anyone, please tell me a way to export the keystore files from MAC?

Showing white blank page before navigating from Login page to MasterDetailpage in Xamarin Form

$
0
0

Hi, I'm working on app in Xamarin form where I need to login first in login page , then if succeed will it navigate to master detail page. I able to achieved it but when navigating from Login page to masterdetail page, it show <1second white blank page in between the navigation. Is that any way to make it navigate more faster without showing the white page? I'm using the masterdetail (https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/master-detail-page) page template provide by the Xamarin form.
Below show how I navigate between the pages.

      MainPage = new LoginPage();
      Application.Current.MainPage = new MasterDetailPage();

How can i download the pdf file with out opening the browser (With out using Device.OpenUri(pdfUr)

$
0
0

i need it like abackgroud proccess in my context it open the browser directly and ask me to download it but i need
to download it without asking the user . how can i remove the redirect proccess from the app to the browser and complete the process in the app.

thank you in advance.

TimeZone With UTC format

$
0
0

Hi,
i have to list out all the timezones like (UTC-12:00) International Date Line West......in PCL.

i can able to do with TimeZoneInfo.GetSystemTimeZones(). but this not displays UTC with name ... please help me to do this..

x:Reference not working?

$
0
0

I'm trying to use a view-to-view binding using x:Reference, but am having no luck. Specifically, I am binding the command/parameter of a TextCell's context actions menu. I wish to bind the command itself to an ICommand property of the main view model, while keeping the command parameter bound to the current item of the ListView that contains the cells. So this means using x:Reference as the Source of the command binding. Yet this doesn't seem to work.

I tried digging through the Xamarin Forms code using dotPeek to see if I could figure out what was going wrong - and I don't even see a ReferenceExtension class in XF 1.3 (Stable)?? Was this removed from the platform, or am I just looking in the wrong place?

My code looks very similar to this, however the binding's Source is totally being ignored:

<ListView ItemsSource="{Binding EventsList}"
          x:Name="EventsList">
  <ListView.ItemTemplate>
    <DataTemplate>
      <TextCell Text="{Binding Name}">
        <TextCell.ContextActions>
          <MenuItem Text="Delete" 
                    IsDestructive="True"
                    Command="{Binding Path=BindingContext.DeleteEventCommand, Source={x:Reference Name=EventsList}}"
                    CommandParameter="{Binding}"/>
        </TextCell.ContextActions>
      </TextCell>
    </DataTemplate>
  </ListView.ItemTemplate>
</ListView>

The ListView's BindingContext is a viewmodel class that has an ObservableCollection of items named EventsList, as well as an ICommand named DeleteEventCommand.

Viewing all 91519 articles
Browse latest View live


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