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

SocketException: No such host is known

$
0
0

Hi Team,

Getting this exception in the case of android when I am trying to connect https connection.

{System.Net.Sockets.SocketException (0x80004005): No such host is known
at System.Net.Http.ConnectHelper.ConnectAsync (System.String host, System.Int32 port, System.Threading.CancellationToken cancellationToken) [0x000c8] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectHelper.cs:65 }

please help me, it would be great for me!


GridItemsLayout in CollectionView to be flexible and Frame or border around collectionview item

$
0
0

Question 1. - Is there a way to get the Frames to be flexible ? I mean to get the frames in the bottom line to be closer to the upper line to close the gap.

Question 2. - Is there a way to get the collectionview items to separate frames or to get them a border like the frames has ?

<CollectionView IsGrouped="True" ItemsSource="{Binding DLHY_VYPIS}">
            <CollectionView.ItemsLayout>
                <GridItemsLayout Orientation="Vertical" Span="4" />
            </CollectionView.ItemsLayout>
            <CollectionView.GroupHeaderTemplate>
                <DataTemplate>
                    <Label x:Name="vyslednasuma" FontAttributes="Bold" Text="{Binding VyslednaSuma}" TextColor="{DynamicResource PrimaryTextColor}">
                        <Label.Triggers>
                            <DataTrigger TargetType="Label" Binding="{Binding Bool_farba_textu}" Value="True">
                                <Setter Property="TextColor" Value="{DynamicResource RedText}"/>
                            </DataTrigger>
                        </Label.Triggers>
                    </Label>
                </DataTemplate>
            </CollectionView.GroupHeaderTemplate>
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <StackLayout VerticalOptions="FillAndExpand">
                    <Frame CornerRadius="10" OutlineColor="{DynamicResource PrimaryTextColor}" Padding="5" Margin="5">
                        <StackLayout BackgroundColor="{DynamicResource PageBackgroundColor}" Padding="5">
                            <Label Text="{Binding Popis}" Margin="0" TextColor="{DynamicResource PrimaryTextColor}" BackgroundColor="{DynamicResource PageBackgroundColor}"/>
                            <Label Text="{Binding KEDY}" Margin="0" TextColor="{DynamicResource PrimaryTextColor}" BackgroundColor="{DynamicResource PageBackgroundColor}"/>
                            <Label Text="{Binding KOĽKO,StringFormat='{0:N}€'}" Margin="0" TextColor="{DynamicResource PrimaryTextColor}" BackgroundColor="{DynamicResource PageBackgroundColor}"/>
                            <!--<Button Text="DELETE" Command="{Binding Source={x:Reference DLHY_USER_}, Path=BindingContext.TEST}" CommandParameter="{Binding ID}"/>-->
                            <Image Source="delete_bin_icon" WidthRequest="15" HeightRequest="15" HorizontalOptions="End">
                                <Image.GestureRecognizers>
                                    <TapGestureRecognizer  Command="{Binding Source={x:Reference DLHY_USER_}, Path=BindingContext.TEST}" CommandParameter="{Binding ID}"/>
                                </Image.GestureRecognizers>
                            </Image>
                        </StackLayout>
                    </Frame>
                    </StackLayout>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>

ListView Grouping issues on UWP

$
0
0

I am facing two issues with grouping in ListView on UWP. They are:

  1. In Group Header by default it shows the GroupShortNameBinding rather than the GroupDisplayBinding (which is the default for Android & iOS). I can get to display the GroupDisplayBinding only if I define a GroupHeaderTemplate. Is that the only way?
  2. If leave it to the default settings, tapping on a group header shows the single letter based jump list. But if I use the GroupHeaderTemplate, tapping a group header clears the screen and the app hangs. How can prevent taps on group header, as I don't need have a jump list?

I did find some threads in this forum on ListView grouping. But it appears they never had these issues as no one reported it. Is it a recent issue or am I the only one having it?

My Button Command Parameter not Working in FreshMVVM

$
0
0

Hello Devs! I was using FreshMVVM in my Xamarin Forms Project, I implemented Button Command Parameter in my LoginPage but it seems the Button doesn't have connect with the LoginPageModel, I use XF Material Library.

Here is the Register Button in LoginPage.Xaml:

<material:MaterialButton CornerRadius="5" Margin="0, 0, 0, 30" Text="Register Here" BackgroundColor="#FFFFFF" TextColor="#275685" ButtonType="Text" PressedBackgroundColor="Transparent" x:Name="BtnRegister" VerticalOptions="End" Command="{Binding RegisterCommand}" />

and this is the LoginPageModel.cs:

using FreshMvvm; using PropertyChanged; using System.Threading.Tasks; using System.Windows.Input; using Xamarin.Forms; namespace buziTrade.PageModels { [AddINotifyPropertyChangedInterface] public class LoginPageModel : FreshBasePageModel { public ICommand RegisterCommand => new Command(async () => await RegisterPage()); public LoginPageModel() { } public override void Init(object initData) { base.Init(initData); } private async Task RegisterPage() { await CoreMethods.PushPageModel<RegisterPageModel>(); } } }

@MichaelRidland @Martijn00

Crash: PdfSharp.Xamarin.Forms already initialized before

$
0
0

Hi all,

I use PDFSharp.Xamarin.Forms in my app (Android and iOS). I initiated the package in MainActiviy.cs:

This works in general, but sometimes I get a strange error which causes my app to crash:

System.InvalidOperationException: PdfSharp.Xamarin.Forms already initialized before

Where does this error come from and how to solve this?

AdMob update for Xamarin Forms

$
0
0

Does anyone know the most up-to-date way to use AdMob for android please? Since the breaking changes in version 17.0.0 of the SDK you can no longer use the same method James Montemagno uses, and his way is pretty much what is all over the internet.
By that I mean, he initialises ads using the app id in MainActivity.cs , now it is required to be in the AndroidManifest.xaml in a <metadata/> tag.

Also, if anyone knows how to make Native ads and consume them with forms I would love to have a resource or guide I can follow for this. Thanks in advance.

Style error

$
0
0

Hi guys, I've got an app with a certain 'splashscreen' style and I wanted to add something to my style.xml file, but when I try to test the app, I get the error: Error APT2260: resource style/splashscreen not found. Any help?

<style name="splashscreen" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowBackground">@drawable/splashscreen960x1440</item> <item name="android:windowNoTitle">true</item> <item name="android:windowIsTranslucent">false</item> <item name="android:windowIsFloating">false</item> <item name="android:backgroundDimEnabled">true</item> </style>

dyld: Library not loaded: @rpath/GoogleToolboxForMac.framework/GoogleToolboxForMac, IOS app crashed

$
0
0

Hi Xamarin dev's

My IOS version app works successfully on Simulator but it is crash and doesn't lunch on physical device without errors.
This is the application output

dyld: Library not loaded: @rpath/GoogleToolboxForMac.framework/GoogleToolboxForMac
Referenced from: /private/var/containers/Bundle/Application/0C69CF2C-BD07-4F3B-A78D-89DFD2D88D4D/Shaabiat.iOS.app/Shaabiat.iOS
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/0C69CF2C-BD07-4F3B-A78D-89DFD2D88D4D/Shaabiat.iOS.app/Frameworks/GoogleToolboxForMac.framework/GoogleToolboxForMac: code signature invalid for '/private/var/containers/Bundle/Application/0C69CF2C-BD07-4F3B-A78D-89DFD2D88D4D/Shaabiat.iOS.app/Frameworks/GoogleToolboxForMac.framework/GoogleToolboxForMac'

/private/var/containers/Bundle/Application/0C69CF2C-BD07-4F3B-A78D-89DFD2D88D4D/Shaabiat.iOS.app/Frameworks/GoogleToolboxForMac.framework/GoogleToolboxForMac: stat() failed with errno=1

and the packages

Please need your help


Xamarin.Essentials.Browser.Openasync is not closing after activity in iOS

$
0
0

When Auth0 URL is passed to Xamarin.Essentials.Browser.Openasync to open the browser, after authentication in android Callback url is handled and continuing to corresponding ContentPages. But in iOS i'm getting the callback from OpenUrl function in AppDelegate but the browser is not closing. And even if we forcibly dismiss the ViewController of browser, Still the navigation to corresponding ContentPages is not happening. But can see the compiler is going through corresponding codes while debugging and the view is not appearing.

Random WebService Timeouts

$
0
0

I am getting random webservice timeouts and I can't figure out why, it is only happening when calling the webservice from the Xamarin app. If I test the webservice in SoapUI, and even spam it with requests, I get 100% success and return values. But when calling the same webservice in Xamarin about 30% of the calls never return and eventually timeout. But on the backend I and see the calls 100% of the calls made it to the webservice and worked, but Xamarin isn't getting the response 30% of the time.

Webservice is C# asmx webservice, which is added via the connected services in the Xamarin project.

The call is pretty simple

PhoneWSServiceReference.PhoneWebServiceSoapClient wsclient = new PhoneWebServiceSoapClient(EndPointName); WSHelper.SetWSTimeOut(ref wsclient, 20); BaseResponse response = wsclient.UserLogin(UserName, Password);

But 30% of the time I get "System.TimeoutException: 'The operation has timed out.'"

I am using the IsBusy flag, setting it to true just before the webservice call and false after it. Is there a better way to call the asmx webservices?

Iphone device is not showing in debug list in project.

$
0
0

Hello,
I am creating an app for ios and android with help of xamarin.forms. When I am connecting my iphone device with my mac system for debugging the code it is not showing in the debug list. There is still showing Ios device. But if I open any other project of xamarin.forms Iphone option is showing in the debug list. I don't know why it is not showing only in one project. Is there any setting to enable the iphone device for project? Or any other way to manage iphone device with project?

Custom List from other list

$
0
0

Hi friends, how are things going there?

I'm new in XF and I'm facing a issue that I'm not able to solve alone.

I need to create a custom List from other to use in picker.itemsource. When I use the original List it brings all columns (Name, Address, Phone etc.) from that list, but I need just the Names, do you know?

I want to use this value as parameters to a complex search screen (see attached image). I'm using just an entry field but I want to avoid the user commit some mistake while using the search, does it make sense?

Any help will be appreciated.

Thanks and best regards.

Shell: Is BackgroundImageSource working on Android?

$
0
0

I am trying to get a background image working with Shell on Android - no luck so far.
The same embedded image displays if used as FlyoutBackgroundImage, so I know the embedding works.
Is BackgroundImageSource even supported with Shell?

I updated to 4.6 and now iOS does not apply styles, colors and fonts to labels.

$
0
0

After updating to 4.6 my labels don't work properly in iOS.

If I have a label with Style="{StaticResource Blue1_Font16_Book}" and Text="{helpers:StringResource lblTimeCardSummaryGuideHint}" the style is not applied. It also does not work if the text is hardcoded. (StringResource is a markup extension that returns the value for the key passed to it.)

However, if the label is changed as follows: Style="{StaticResource Blue1_Font16_Book}" Text="{Binding lblTimeCardSummaryGuideHint}" />" the style is applied.

Can we get Microsoft Store ID for an app that is not yet submitted to MS Store?

$
0
0

I am trying to access Google Drive from an XF.UWP app. The Client ID for UWP form on Google API Console is asking to fill in the 'last part of your app's Microsoft Store URL'. What to fill in here, any idea?

I have filled 'com.mycompany.myappname' here and Protocol URL in Package.appxmanifest file. I am setting redirect_uri also to the same thing with a suffix of ':/oauth2redirect'.

In the declaration of Protocol URL, I am setting the StartPage to MainPage.xaml after checking the ExecutableOrStartPageIsRequired box.

My app crashes after 'Allow' is pressed while authenticating.

Any clue what to do?


Why is it necessary to re-install a NuGet package for an existing class?

$
0
0

I'm curious why this is necessary and wonder if my understanding is at fault. I have installed the NuGet package Xam.Plugin.Media within an existing solution that was already in development. I installed it for the solution and the Android project, before making any code changes. When I then insert my code from another separate and already-working application, it doesn't recognise the references to the NuGet package even though it's already installed for this solution:

using Plugin.Media;
using Plugin.Media.Abstractions;

if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) {  }

I then follow its offer to auto-correct, and it shows within the drop-down menu that there is a local version 5.0.1 already. Choosing this rectifies the problem, but as far as I can see there is no code change to my class as a result of this. What has it done to my solution in order to resolve this? Does this mean that NuGet packages and versions are specific to each class? If so, where is this information stored? Image of the whole thing is below, showing the menu.

Android push notifications “Message was successfully sent, but there were no matching targets."

$
0
0

I am trying to setup push notifications on a Xamarin.Forms Android app following this tutorial and this sample. My AndroidManifest.xml, FirebaseService.cs and MainActivity.cs are basically the same as the sample. When I fire up the Android Emulator and do a Test Send from Azure Notification Hubs I get: "Message was successfully sent, but there were no matching targets." Is that tutorial outdated?

Xamarin.Android JavaTypeInfo Build Error

$
0
0


I am not able to build my Android project. It is throwing me the error, as shown in attached.

Following is error details:
Failed to create JavaTypeInfo for class: Android.Support.V4.View.Accessibility.AccessibilityManagerCompat/IAccessibilityStateChangeListenerImplementor due to System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\simeh\source\XamarinApps\CheckListManifesto\CheckListManifesto\CheckListManifesto\CheckListManifesto.Android\obj\Debug\81\android\src\mono\android\support\v4\view\accessibility\AccessibilityManagerCompat_AccessibilityStateChangeListenerImplementor.java'.

Any help or suggestions on how to fix this?.

Thanks In Advance!!!..

How can I add an item (just 1) from a list into another list?

$
0
0

Once I initialized two lists (a, b), I'd like to add one item from list "a" into "b" whenever I press a button. Note, JUST 1 and not the whole list. With my current code, my list "b" keeps being null.

This is what I've tried

//Initialize / declare lists

public List a;

    List<string> b= new List<string>();

// List a
a = new List()
{
new Question() { QuestionText="", Answer=false } ,
new Question() { QuestionText="", Answer=false },
new Question() { QuestionText="", Answer=true },
new Question() { QuestionText="", Answer=false },
new Question() { QuestionText="" , Answer=true },
new Question() { QuestionText="", Answer=false },
new Question() { QuestionText="", Answer=false },

        };

//Add method---this is what I tried for adding items
if (_currentAnswerValue == false)
score++;

            else
            {
                b.Add(QuestionText.ToString());

HELP GC is preventing on running my app

Viewing all 89864 articles
Browse latest View live


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