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

[IOS] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)

$
0
0

Hello Guys and Girls,

im working on a Project which i have to change from http to https.

Since the app runs in a Mobile Iron Environment i have to use a NSUrlConnection.

Now when im trying to use the following code (which worked with http) i get the error in the title.

    `Console.WriteLine("RequestClass not null");

    String xmlSerialized= SerializeXML<cRequestClass>(reQuestClass);

    byte[] Content = Encoding.UTF8.GetBytes(xmlSerialized);
    Console.WriteLine("Class Converted");

    var request = new NSMutableUrlRequest(NSUrl.FromString(@WebserverURL), NSUrlRequestCachePolicy.ReloadIgnoringCacheData, 40);

    request.HttpMethod = "POST";
    request.ShouldHandleCookies = true;

    request.Body = NSData.FromArray(Content);

    Console.WriteLine("Start Connecting");


    Task<NSUrlAsyncResult> result = NSUrlConnection.SendRequestAsync(request, OpsQueue);

    Console.WriteLine("Result Received Async");

    NSData data = result.Result.Data;
    Console.WriteLine("Data transformed");
    ReturnValue = data.ToString();
    Console.WriteLine(ReturnValue);`

Only for development purpose i tried to add a new key to my info.plist. But without any results.

<key>NSAppTransportSecurity</key>
  <dict>
        <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
        <true/>
        <key>NSIncludesSubdomains</key>
        <true/>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
  </dict>

I working on it for a Week now and only found some java snippets with information on some Delegates ("willSendRequestForAuthenticationChallenge", which i couldnt successful implement.

Thank you for your Help.


Error: For security reasons DTD is prohibited in this XML document.

$
0
0

I am accessing WCF service, but getting the error as "For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method."

But in our Xamarin.Forms code I have not used XmlReader
I am using System.Runtime.Serialization and System.IAsyncResult to get response from service.
so where can I fix this issue on Xamarin.Forms code or on WCF service?

Thanks in advance

Load PDF Base64

$
0
0

Hi
I need your help, I need to deploy a pdf file from a Web query that returns the pdf file in base64. My goals are iOS and Android platforms .

I 'm using XAML binding for loading the user interface.

Thx.

Xamarin.Auth AndroidAccountStore Implementation

$
0
0

Hi All,

Below is an excerpt from AndroidAccountStore class which is part of the Xamarin.Auth implementation.

internal class AndroidAccountStore : AccountStore
{
    Context context;
    KeyStore ks;
    KeyStore.PasswordProtection prot;

    static readonly object fileLock = new object ();

    const string FileName = "Xamarin.Social.Accounts";
    static readonly char[] Password = "3295043EA18CA264B2C40E0B72051DEF2D07AD2B4593F43DDDE1515A7EC32617".ToCharArray ();

As you probably notice, the implementation requires that the password for the KeyStore used on Android is hard-coded.
IMHO, the password could be retrieved using a disassembler, and that would make the keystore file easy to load and inspect.

Anyone could propose a different (more secure) approach?

Thanks!

Where can I find a list of possible EventTrigger.Event strings?

$
0
0

Hello Xamarin community,

I have been trying (for several hours now) to find a list of all possible strings that can be inserted in the Event field of the EventTrigger class, so I can trigger an event when an Entry item is tapped. Does anyone know where to find this list?

Carousel View in Xamarin.Forms iOS

$
0
0

Hi, I have a web service and I'm getting imageurl from json string. But I guess wrong binding section. There isn't show any image. Here is my code.

Xaml:

    <cv:CarouselView ItemsSource="{Binding Path=BindingContext.Hotel.HotelImages, Source={x:Reference HotelDetailPage}}" HeightRequest="200">
            <cv:CarouselView.ItemTemplate>
              <DataTemplate>
                <StackLayout HeightRequest="200">
                  <Grid HeightRequest="200">
                    <Image Aspect="AspectFill" Source="{Binding FullPath}"/>
                  </Grid>
                </StackLayout>
              </DataTemplate>
            </cv:CarouselView.ItemTemplate>
          </cv:CarouselView>

and here is my get json service code;

                     for (int j = 0; j < imageCount; j++)
                                {
                                    HotelImageModel hotelImage = new HotelImageModel();

                                    hotelImage.FullPath = json["data"][i]["HotelImages"][j]["FullPath"].Value;

                                    hotel.HotelImages.Add(hotelImage);
                                }

Note: I got help at this example: https://blog.xamarin.com/flip-through-items-with-xamarin-forms-carouselview

Need to put HTML into a Label

$
0
0

I am using Xamarin.Forms and the Label view. I use the FormattedText (FormattedString class) to put formatted text in the Label. My goal here is to be able to convert HTML to a FormattedString.

In Xamarin.Android I have acces to Html.FromHtml() wich returns a ISpanned. Is there a equivalent for Xamarin.Forms ?

I cannot really use a WebView since my goal is to have multiple labels populated from HTML. If I use a WebView, I would be forced to do the whole page in HTML and not use Xamarin.Forms views/controls.

Thanks,
Max.

TabbedPage inside MasterDetailPage has an offset on toolbar

$
0
0

In my masterdetailpage, I have set a master page, and the detail page contains tabbed page with navigation bar disabled, but in the UI, ToolBar and the tab bar has a white space, it seemed it has an offset?

Did anyone experienced this?


Any Solution for PDF reader

$
0
0

hi
I am unable to find a solution for for PDF reader in Xamarin forms.
The solution provided on xamarin website

https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/controls/display-pdf/

not working for me. It says

_**The webpage at file:///android_asset/pdfjs/web/viewer.html?file=file:///android_asset/Content/abc.pdf might be temporarily down or it may have moved permanently to a new web address. **_

Someone please suggest me some easy solution or plugin for this problem. If there is any plugin working for cross platform solution free/paid please suggest.

EventArgs in commands

$
0
0

Hi,

I'm working with a component called TK.CustomMaps which is a extended version of the Xamarin.Forms.Maps element. There are few examples but I'm pretty sure this will let me accomplish what I want. Now, what I'm trying to do is to set a pin on a a TKCustomMap element when the user clicks on a position in the map. Using intellisense I can see that the control has the following options "MapClicked (Event)" and MapClickedCommand. I'm using MVVMLight so basically what I'm trying to do is bind the MapClickedCommand to a relaycommand and add the code to add the pins on that method. The thing is that I'm not sure how to pass the event args to the command, basically the position or the dynamic information I will use to create my pins.

Here is what I have so far:

XAML
<tkmap:TKCustomMap MapClickedCommand="{Binding MapClickCommand}" VerticalOptions="FillAndExpand" />

ViewModel
MapClickCommand = new RelayCommand (() => Test ());
private void Test ()
{
//I want to create the dynamic pins here.
}

@TorbenKruse
-Hi Torben, I believe you are the author of this component. Would you give me some advice in how to accomplish what I want? I want users to be able to set the pins, remove them as well as circle radius dynamically.

Thanks in advance

Why is XmlElement not available for a portable library?

$
0
0

Since I have not been able to get an answer to a question asked half a month ago, let me ask it in a different way hoping someone can shed some light on this.
Here are the targets of a portable library:

Here is the result of trying to use System.Xml.XmlElement in the library:

I have to confess that I am totally lost in terms of which version of .Net the library uses, so I do not know which version's document I should use as the correct reference.

Any light shed on this will be greatly appreciated.

Button TextColor

$
0
0

Hello, I have been unable to change the text color of my buttons on Xamarin.forms. I need the text to be white.

var upcomingButton = new Button { 
                    Text = "Upcoming",
                    BackgroundColor = Color.FromHex ("33B9FF"),
                    BorderColor = Color.FromHex ("33B9FF"),
                    BorderWidth = 2,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    TextColor = Color.FromHex ("FFFFFF")   
                };

However on other pages, I have been able to change the font color without any issue...

var exploreEventsButton = new Button 
        { 
            Text = "Explore Events",
            FontFamily = Device.OnPlatform (
                "Proxima Nova",
                null,
                null
            ), // set only for iOS
            FontSize = 30, 
            BackgroundColor = Color.FromHex("00E88E"),
            VerticalOptions = LayoutOptions.FillAndExpand,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            TextColor = Color.FromHex("FFFFFF")
        };

Command Bindings ignored on Modal Popup Page

$
0
0

I have a Photo app (Attached) that is used to take pictures using the native code (iOS ) implimentation

The App.xaml.cs is

public App() {
            MainPage = new NavigationPage(new StartPage());
  }

The Start Page has 2 buttons when clicking the Buttons PushAsync loads the TakePicturePage as an Async page and the photo button works.

private async void FullScreen_Clicked(object sender, EventArgs e)   {
            await Navigation.PushAsync(new TakePicturePage(), true);
}

and the PushModalAsync loads the Page as a Modal popup, but the Photo button doesnt work.

private async void Modal_Clicked(object sender, EventArgs e) {
      await Navigation.PushModalAsync(new TakePicturePage(), true);
}

The code is as follows for TakePicturePage is as follows

public TakePicturePage()
        {
            InitializeComponent();
            BindingContext = new TakePictureViewModel(DependencyService.Get<ICameraProvider>());
        }

XAML Code

     <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"         x:Class="CameraApplication.Views.TakePicturePage">
            <StackLayout>
                      <Button Text="Take a Picture Test" Command="{Binding TakePicture}" />
                      <Image Source="{Binding Picture}"/>
            </StackLayout>
     </ContentPage>

Is there a way that I can put progressbar inside the List view cell? Xamarin Forms

$
0
0

I just learn how simple progress bar works. But I want to make a progress graph percent or some sort of progress status.

The problem is, I'm having a problem whenever I include the progressbar inside the list view cell. Is it possible that I can put the progressbar working inside the list view cell? Here's my code.

<ListView>
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
          <StackLayout Orientation="Vertical" Padding="10">

          <Grid>
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="*" />
              <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <Label Text="Dummy Me" Grid.Row="0" Grid.Column="0" />
            <Label Text="Dummy Me2" Grid.Row="0" Grid.Column="1" />
          </Grid>
          <ProgressBar x:Name="myProgressStatus" Progress="0.2" HeightRequest="200" Width="150" />

          </StackLayout>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>  

Here's my Progress behind the xaml.

    protected async override void OnAppearing()
    {
        base.OnAppearing();

        myProgressStatus.ProgressTo(.2, 250, Easing.Linear);
    }

While the error says,

The name 'myProgressStatus' does not exist in the current context   ...

overlap stacklayout

$
0
0

hi guys, I have a little problem with the UI.
I have a ListView in a Stacklayout. When I click on a button I change the content of the StackLayout with another in this way:

StackLayoutContainer.Children[1] = new MyNewStackLayout(); // the listview is the 2nd child of StackLayoutContainer.

Now, the new layout is shown but with the listview overlying until I make a tap anywhere on the UI, in wich case listview disappears.
but, why?


FreshMvvm - Change selected tab within PageModel

$
0
0

Hi everyone,

I've been doing some coding with FreshMvvm - which is great, by the way.

My application has a FreshTabbedNavigationContainer with 3 tabs.
After clicking a button inside one of them, can I change the selected tab within my PageModel?

Thanks in advance!

Windows 10 IoT ME support?

$
0
0

Whilst we are happily developing our Xamarin Forms app for iOS and UWP, I've just been handed a device running Window 10 IoT ME (Honeywell/Dolphin CT50). This is the first time I have come across this flavour of Windows 10.

At first, I wasn't aware it was 'Win10 IoT', and just tried installing VS remote tools which failed, and then tried side-loading our app which also failed to install.

So to save me from weeks of frustration, can anybody comment on the likelihood of getting a XF UWP app running on this?

Thanks

Chris

Frame.BorderRadius

$
0
0

Is there any way to change border radius on Frame? Or maybe there is another static control with rounded corners?

Error "Could not resolve mscorlib for target framework '.NETCore, Version = v5.0'.

$
0
0

When adding a service reference to the UWP project of a Xamarin Forms project, I get the following error:

I added the latest version (5.0.1) of Microsoft.NETCore Nuget package, it did not resolve the problem, then changed the package to 5.0.0, and it failed to resolve the problem too.
I do not understand why it requires .NETCore. It is a typical UWP part of a Xamarin Forms project and targets Windows 10 (10.0; Build 10586).
Could anyone shed some light on this?

Q: Does Navigation.PopToRootAsync() and/or back *NOT* dispose of the pages that have been de-queued?

$
0
0

My app has about a dozen pages, with a 'Home' page as the central point of navigation for the user. It has a bunch of big tiles on it that take them to different function pages.

I've noticed that as I go from Home->PageOne->BackToHome...{repeat} the responsiveness of the Navigation and of the target page (PageOne for example) exponentially diminish.

By the time I have gone from Home to PageOne and back to home and back to PageOne 10+ times it is several seconds before anything responds... and the target page is WAY slow for UI binding to update based on the ViewModel.

The ViewModels are all one instance, held for reuse throughout the lifetime of the app, so its not a problem with remaking or resubscribing to events.
Making of new pages is by

                    await Navigation.PushAsync(new PageOne(), false);

It feels like the binding subscriptions aren't being disposed of when Navigation goes 'back' automatically de-queueing the Navigation stack.
To test this I made single instance properties for a couple of the pages. So they get made once when pushed for the first time, then reused each subseqent push. AMAZING response time after the first appearance; which makes sense because it has to render the first time.

The point being... Are de-queued pages not being properly de-binded in the background when Navigation is backed?

Viewing all 91519 articles
Browse latest View live


Latest Images

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