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

'Resource.Style' does not contain a definition for 'Main.Theme'

$
0
0

Getting this error while trying to use xamarin live player. Any ideas how to solve it?


Binding reset to default value when changed with Trigger

$
0
0

I have an entry with amounts where i would like to present it with two decimals when its not focused and as-is when focused.
I tried to do this using Triggers on my Entry.
It is not working. For some reason, the Default value on my Binding is set, when the Property is triggered and the Binding is changed

Editing and entered the value 12

Default value is set when the formatting binding is applied.

<Entry Grid.Column="1" Text="{Binding Text}">
    <Entry.Triggers>
        <Trigger TargetType="Entry" Property="IsFocused" Value="True">
            <Setter Property="Text" Value="{Binding Text}" />
        </Trigger>
        <Trigger TargetType="Entry" Property="IsFocused" Value="False">
            <Setter Property="Text" Value="{Binding Text, StringFormat='{0:N2}'}" />
        </Trigger>                      
    </Entry.Triggers>
</Entry>

I am referencing a Bindable Property

public static readonly BindableProperty TextProperty =
    BindableProperty.Create(nameof(Text), typeof(decimal), typeof(MainPage), defaultValue: 0m);

public decimal Text
{
    get { return (decimal)GetValue(TextProperty); }
    set { SetValue(TextProperty, value); }
}

This could be somewhat related to https://github.com/xamarin/Xamarin.Forms/issues/1412

Does anyone have experience with a solution like this ? Suggestions for ways to work around this.

How to integrate Dialogflow bots in Xamarin forms?

$
0
0

I need to integrate dialogflow in my application. I tried to install ApiAiSdk in my package but im getting error like this
Severity Code Description Project File Line Suppression State
Error Could not install package 'ApiAiSDK 1.6.5'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile78', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Is there any way to resolve this issue or any other approach other than APiAiSdk package. Can anyone please help me out with this.

Shopping cart app add items to basket with count number of items added in toolbar ?

$
0
0

I am Creating xamarin forms app using Mvvm Data binding approach now i want to add items in my cart with count number of items added in toolbar so can anyone help me with this Plzz

Link Assemblies Task failed unexpectedly Error

$
0
0

I have added the Plugin.MediaManager.Forms in my xamarin forms project for video view. The project was working fine before adding this plugin in my project, but after i have added the plugin, the project doesn't compile for android giving " Link Assemblies Task failed unexpectedly " error. Can somebody help me ?

It works fine for IOS.

Moreover, the plugin installs with warnigs too :

Package 'Plugin.MediaManager.Forms 0.4.5' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

TabbedPage 5th to 1th listview autochange position

$
0
0

I have some problem with my xamarin forms app. tabbed page have 5 children if i am go to 5th tab, my first tab in listview change position.(turn start). how can i fix it ?

Button with image

$
0
0

Hi all,
I need an urgent help please. I am trying to have a button with an image. Actually I simple want to show he image and have it behave as a button. I have created the button and gave it a widthrequest of 120 and Heightrequest of 120 also. I then placed an image of size 120x120. But the image does not get aligned with the button. It shifts somehow showing some parts of the button. How do I make the image alight exactly with the button.
Here's the code
Button btn = new Button
{
WidthRequest = 120,
HeightRequest = 120,
Image = "btnResults.jpg",
};

UWP project doesn't load after Visual Studio 15.7.6 update

$
0
0

After updating Visual Studio to 15.7.6, my Xamarin.Forms UWP project no longer loads with the error

error : Unterminated string. Expected delimiter: ". Path 'packages[252].localizedResources[8].description', line 1, position 853299.

The main project as well as the iOS and Android projects load just fine.

Tried re-creating an empty Xamarin.Forms project and the UWP project doesn't even get created, even though it's enabled. If I check the solution log, I see the exact same error message


Xamarin.Forms.Maps Disable / Hide Info window but still keep default actions

$
0
0

Hi everyone,

I'm pretty new to Xamarin and I'm pretty stuck on this...

Can someone please help me find a solution to just disabling the info window from showing?

I followed the tutorials for creating a custom renderer and so far have managed to disabled the default action by returning true on a marker click however this disabled clicks altogether ... I still need the data being passed on from the click so that I can show a window / panel at the bottom of the screen.

Here's a sample:

public void OnMapready(GoogleMap googleMap){
    map = googleMap;
    map.SetOnMarkerClickEventListener(this);
}

public bool OnMarkerClick(Marker marker){
    return true; //disables info window from showing but now I can't check for clicks on the map and get the data from the marker
}

I have tried marker.HideInfoWindow() but it does nothing at all :neutral:

How to add sub menu items clicking on MenuItems in xamarin.forms MasterDetailPage

$
0
0

Hi, I want to display submenu items when clicking on MenuItems in MasterDetailPage.My Master Xaml is 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="HomeMaster"
             Title="Master">
  <StackLayout>
        <ListView x:Name="ListViewMenuItems"
              SeparatorVisibility="None"
              HasUnevenRows="true"
              ItemsSource="{Binding MenuItems}">
            <ListView.Header>
                <Grid BackgroundColor="Transparent">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="10"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="10"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="10"/>
                    </Grid.RowDefinitions>
                    <Image
              Grid.Column="1"
              Grid.Row="2"
              Source="User.png" HeightRequest="100" x:Name="userImg"/>
                </Grid>
            </ListView.Header>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                            <StackLayout VerticalOptions="FillAndExpand"
                             Orientation="Horizontal"
                             Padding="20,10,0,10"
                             Spacing="20">

                                <Image Source="{Binding Icon}"
                         WidthRequest="40"
                         HeightRequest="40"
                         VerticalOptions="Center" />

                                <Label Text="{Binding Title}"
                         FontSize="Medium"
                         VerticalOptions="Center"
                         TextColor="Black"/>
                            </StackLayout>
                     </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>
</ContentPage>

I want to add submenu items when click on MenuItem like expandable list .How can I do this.
Thank you.

How to do a simple InputBox dialog?

$
0
0

I'm struggeling with a simple thing.

How can I display a prompt in a dialog box, thats waits for the user to input text or click a button, and then returns a string containing the contents of the text box with Xamarin.Forms?

With Android or WP8 I was able to create a popup with some controls, but I didn't find any similar in Xamarin.Forms.

Thx, Tom

Xamarin form : Token authentication with xamarin form web api

$
0
0

i am working with token based authentication for xamarin form here is my code

 public async Task<string> checkLogin(string username, string password)
    {




    var keyValues = new List<KeyValuePair<string, string>>
    {
        new KeyValuePair<string, string>("username",username),
        new KeyValuePair<string, string>("password",password),
                        new KeyValuePair<string, string>("grant_type","password")


    };
    var request = new HttpRequestMessage(HttpMethod.Post, "http://softsol.com.pk/Token");

    request.Content = new FormUrlEncodedContent(keyValues);

    var client = new HttpClient();

    var response = await client.SendAsync(request);
    var content = await response.Content.ReadAsStringAsync();


    JObject jdynamic = JsonConvert.DeserializeObject<dynamic>(content);
    var accessToken = jdynamic.Value<string>("access_token");
    var refershToken = jdynamic.Value<string>("refresh_token");
    var date = DateTime.Now.ToString();
    var accessTokenExpiration= jdynamic.Value< DateTime> (".expires");


    //await Application.Current.MainPage.DisplayAlert("Alert", content, "OK");
    Debug.WriteLine(content);
    Settings.AccessToken=accessToken;
    Settings.RefreshToken = refershToken;

    Settings.AccessTokenexpiration = accessTokenExpiration;
    return accessToken;
    //return response.IsSuccessStatusCode;



}

when i login with usernamre and password i get this error

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0

and if i run in postman its working fine for example if i run this http://softsol.com.pk/Token in postman with username="test",password="test", grant-type="password" i get the token and its working but i get error from xamarin form. And i am stuck here

How to implement SIP calling on the Xamarin Forms ( i,e. on Cross -Platform ) ?

$
0
0

Hi every one , I'm kinda new to implementing the SIP calling on the Xamarin Forms, I have no clue about SIP calling , I need the code for receiving the call and cancellation of the call through SIP , Please ,

Thanks in Advance

Xamarin.Forms Android FileProvider: Files are opened readonly

$
0
0

Hi,

I have implemented a FileProvider in my Android app to edit PDF/DOCX files and call it from my Xamarin.Forms app via the dependency service.
The files I want to open reside in the private storage of my app.

Certain apps (like Google Docs) open the files in "write-mode", so that changes get saved in my private storage.
Other apps (like Microsoft Word and Adobe Reader) open the files read-only, although I am granting them full write access.

More details about my implementation can be found in this StackOverflow post:
http://stackoverflow.com/questions/42252933/xamarin-forms-android-fileprovider-grantwriteuripermission-not-always-working

Has anybody experienced similar issues?

Somebody who works FileProvider?

$
0
0

I have problem with FileProvider = error:
Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.PackageItemInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference

Manifest:


FileProvider in *.cs file:
var folderPath = new Java.IO.File(Forms.Context.FilesDir, "dwnlds/");
if (!folderPath.Exists())
folderPath.Mkdirs();

var filePath = new Java.IO.File(folderPath, filename);
Android.Net.Uri contentUri = FileProvider.GetUriForFile(Forms.Context, "com.ladis.smartapps.provider", filePath);

Any ideas how to help me?


preventing from timer to be closed by Andriod

$
0
0

hi,
I'm running a simple timer in my app, but when the time is too long and the phone goes to sleep (or the user changes apps) the timer (or actually my app) gets killed by Android. how can I prevent it from happening?
(i'm using Mobilist.AdvancedTimer.Forms.Plugin)

flexlayout Binding

$
0
0

Hi I am testing the new Flexlayout to create a new view with multiple Buttons from a ObservableCollection in code ..

** foreach (var item in Transitems)
{
Button _button = new Button
{
Image = item.ImageName, IsEnabled = item.IsButtonOn,
WidthRequest = 160, Command = new Command (() => //do something )
};

            FlexGrid.Children.Add(_button);
        }**

Is it possible to set the Source like a ListView in XMAL ?

Thansk

How to add Menu on a Desktop Forms App?

$
0
0

Hi, I'm studing the new features of Forms 3.x in particular the GTK support.
My demo app works, but now i want to add a classic desktop app menu (File, Edit,...).

Reading the api documentation I found this class: Xamarin.Forms.Menu and (https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.menu?view=xamarin-forms). The description say: "Represents an application menu on platforms that support them." so I think is the correct one. But there is any documentation about how to use it.

Where I can find some help to how use it?

Thanks

Cross-Platform Floating Action Button/Menu

$
0
0

Hello everyone!

I've been working on a Cross-Platform XAML Floating Action Button, as well as a Floating Action Menu consisting of nested buttons. It's meant to resemble the built-in control in Android it was named after.

The button alone works perfectly on both platforms and looks neat, but the menu's child-buttons do not respond to clicks for some reason.
Can anyone please help me figure out what the problem is and think of a solution?

You are welcome to peek at my code here. It's free for anyone to use and edit as you wish :)

Thank you!

CopyWin32Resources failed with exit code -1

$
0
0

I keep getting the error : CopyWin32Resources failed with exit code -1
every time I make a new XarmarinForms project and build my UWP app. At first I was just updating the Xamarin.Forms nuget and the Microsoft.NetCore.UniversalWindowsPlatform nuget and that was doing just fine. However, today I keep getting this error even after updating all my nuget packeges. It believe it occurs in the Microsoft.NetCore.UniversalWindowsPlatform nuget package according the the following build logs:

1>------ Build started: Project: WindowsFluentDesignSample.UWP, Configuration: Debug x86 ------
1>  WindowsFluentDesignSample.UWP -> C:\Users\adham\Source\Repos\WindowsFluentDesignSample\WindowsFluentDesignSample\WindowsFluentDesignSample.UWP\bin\x86\Debug\WindowsFluentDesignSample.UWP.exe
1>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(3093,5): warning : APPX4001: Build property AppxBundlePlatforms is not explicitly set and is calculated based on currently building architecture. Use 'Create App Package' wizard or edit project file to set it.
1>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(2487,5): warning APPX0104: Certificate file 'WindowsFluentDesignSample.UWP_TemporaryKey.pfx' not found.
1>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(2487,5): warning APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478.
1>C:\Users\adham\.nuget\packages\microsoft.net.uwpcoreruntimesdk\2.1.2\tools\CoreRuntime\Microsoft.Net.CoreRuntime.targets(238,5): error : CopyWin32Resources failed with exit code -1
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

When I double click 1>C:\Users\adham\.nuget\packages\microsoft.net.uwpcoreruntimesdk\2.1.2\tools\CoreRuntime\Microsoft.Net.CoreRuntime.targets(238,5) it takes me to Microsoft.Net.CoreRuntime.targets where I also believe that the error is happieing in the Line 238 (Build logs) which is

<WireUpCoreRuntime
        AppxManifest="@(FinalAppxManifest)"
        AppxPackagePayload="@(AppxPackagePayload)"
        OutputPath="$(_WireUpCoreRuntimeOutputPath.TrimEnd('\'))"
        TargetRuntime="$(TargetRuntime)"
        TargetArch="$(_PlatformTargetForCoreRuntime)"
        FrameworkPackages="@(FrameworkPackagesForTargetArchitecture)"
        CoreRuntimeSDKLocation="$(CoreRuntimeSDKLocation)"
        CopyWin32ResourcesLocation="$(CopyWin32ResourcesX86Path)">

This prevents me from doing any projects so I need quick help

Viewing all 77050 articles
Browse latest View live


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