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

How to send pending notifications (using CrossLocalNotifications) when the phoned is rebooted?

$
0
0

I am using CrossLocalNotifications to send scheduled notifications. But when the phone is rebooted, the notifications are not sent. How to handle this scenario?


Where are the XAML designer tools?

$
0
0
Years have past ;-) not really but I think this question has been asked many Times' before.

The forms previewer crash all the time. It could be seen more of a compile:designer that breaks as soon as you start adding codebehind stuff.

We need a designer for Xaml not css? I think the web guys gonna stick to other tools anyways
The live previewer very nice idea, same thing doesn't work yet.

I just need BLEND with a Visual state manager. where is the backning from the Microsoft team that dream up stuff like the Blend tools :-)

How to free memory used by Images in view content OutOfMemoryError

$
0
0

Hi, I'm using PCL and getting java OutOfMemoryError exceptions. The first time I create the view with a list of images, it works, but after coming back to the view and recreating the same list (OnAppearing), it fails. Why? Its the same list and the old content is overwritten, so it should be freed by GC.

The images are actually created in a child view: tabbedPage, NavigationPage, ScrollView, Grid, StackLayout, StackLayout, then Children.Add(Image).

I tried to simplify the example by reducing the sub-subViews, but still get the problem. I know I can reduce the issue by resizing the image (which I will do), but how do I free the images?
GC.Collect() and GC.Collect(1) doesn't make any difference.

===
Example:
public class FilesPage : ContentPage

    protected override void OnAppearing()
    {
        base.OnAppearing();
        AddContent();
    }

    protected void AddContent()
    {
        int idx = 0;
        var gridView = new Grid {};

    // makes no difference
        //if (Content != null)
        //{
        //  var oldView = (ScrollView)Content;
        //  Content = null;
        //  var oldSubView = (Grid)oldView.Content;
        //  foreach(StackLayout stk in oldSubView.Children)
        //  {
        //      stk.Children.Clear();
        //  }
        //  oldSubView.Children.Clear();
        //  GC.Collect();
        //  GC.Collect(1);
        //}

        Content = new ScrollView { Content = gridView };
        List<MediaModel> mediaList = MediaModel.LoadList();

        foreach (MediaModel mediaAttrs in mediaList)
        {
            AddOneFile(gridView, mediaAttrs, idx);
            idx++;
        }
    }

...
protected void AddOneFile(Grid view, MediaModel mediaAttrs, int idx)
{
Image omg = new Image {Source = ImageSource.FromFile(Path.Combine(App.storagePath, this.fileName))};
StackLayout stk = new StackLayout
{
Children = {
...
}
};
stk.Children.Insert(1, img);
view.Children.Add(stk, idx % 2, idx / 2);
}

Shadows on SkiaSharp shape

$
0
0

I'm working with SkiaSharp shapes, and I can't put a shadow behind a shape. Does anyone have an idea how to get it done in xamarin.forms?

Xamarin.Forms Splashscreen in Android

$
0
0

Hi, In Forms how to add SplashScreen to Android appliaction? Thanks in advance.

Behaviors in ControlTemplates

$
0
0

I have a ControlTemplate defined in App.xaml for pages with ListViews like so:

<ControlTemplate x:Key="BaseModelListPageTemplate">
    <StackLayout>
        <Label
        Text="{TemplateBinding BindingContext.Category}"
        BackgroundColor="Green"
        TextColor="White"
        FontSize="24"
        FontAttributes="Bold"/>
        <ListView
            x:Name="ItemListView"
            HasUnevenRows="true"
            ItemsSource="{TemplateBinding BindingContext.ItemsList}"
            IsPullToRefreshEnabled="true"
            IsRefreshing="{TemplateBinding BindingContext.IsBusy, Mode=OneWay}"
            RefreshCommand="{TemplateBinding BindingContext.ReloadCommand}"
            ItemTemplate="{StaticResource BaseModelDataTemplateSelector}">
            <ListView.Behaviors>
                <Behaviors:ListViewScrollBehavior Command="{TemplateBinding BindingContext.LoadMoreCommand}"/>
            </ListView.Behaviors>
        </ListView>
    </StackLayout>
</ControlTemplate>

All bindings compile with no errors. The trouble is that an InvalidOperationException gets thrown: Operation is not valid due to the current state of the object. It worked fine when it was directly in a page and not in a ControlTemplate.

StackTrace is of little help:

at Xamarin.Forms.TemplateBinding+<Apply>d__17.MoveNext () [0x00018] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplateBinding.cs:82 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018 
  at UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIKitSynchronizationContext.cs:24 
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSAction.cs:163 
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at EZDelivery.iOS.Application.Main (System.String[] args) [0x00008] in /Users/taylorartunian/Projects/EZDelivery/iOS/Main.cs:17 

Listview Group footer

$
0
0

Is there any possibility add a section footer for each group in a list view.

[Xamarin.Forms][Android] Entry's width increasing - Bug ?

$
0
0

Hi,

I am currently testing one of my company's applications with some older devices to checkout if everything is working correctly and I have an issue with the Entry's width. I am not sure if it's a bug or if I am just missing something here so I decided to post on this forum instead of doing so into the Xamarim.Forms repository.

The issue is that if I entirely fill the control with more letters that it could contain, tap on the back button and come back to the same page, the Entry's width would increase to go beyond the screen's limitation. I reproduced the issue into a sample that you could find into this next link:

github.com/toussam/HorizontalStackLayoutIssueSample

The Entry is wrapped into a StackLayout that is set with the Orientation property as Horizontal and if I remove this last one, everything would work properly, but I really need to set it in such way since into our application there is also other elements into the StackLayout and all of them need to be display horizontally.

Here is also two screenshots to illustrate the issue:

Before
us.v-cdn.net/5019960/uploads/editor/kr/c3bcop4x2h29.png

After
us.v-cdn.net/5019960/uploads/editor/6d/34h1062c50kz.png

Is there anyone that could help me with this issue ?

I thank you in advance for everything and wish you a great week !
Best regards,
mtwsm

P.S.: I can't post links so I had to cut the urls' beginning.


How can I access the contacts in a Xamarin Forms app?

$
0
0

I am currently working in a Xamarin Forms app and I am searching for a plugin or a code snippet that allows me to access the contacts in the phone of the user. I want to be able to scroll navigate in my app threw the contacts and also to give the option to the user to save them in a server. I have searched for plugins that can access the contacts but I have only found plugins that no longer are supported. Any ideas??

Advanced Automation/Accessibility

$
0
0

Usually, when a navigation occurs, accessibility screen-reader software will read/focus the first element on the next page (possibly the header "back" button).

  • How can I manually change the accessibility focus cross-plattform (Droid, iOS, UWP) to an element of my choice?
  • How can I make the reader "speak" my own text one-time? (Like for example, a user clicked an image in a choice dialog and I want to say something like "You selected the duck image" as confirmation)

When I am trying to bind a List item to a label its not showing up.Please help?

$
0
0

Xaml Page-----


<Grid.ColumnDefinitions>



</Grid.ColumnDefinitions>
<Grid.RowDefinitions>

</Grid.RowDefinitions>

                                <Image x:Name="img_Ingrediants" Grid.Row="0" Grid.Column="0" Source="{Binding Ingredients.image}" />
                                <Label x:Name="lbl_Ing_Name" Grid.Row="0" Grid.Column="1" Text="{Binding Ingredients.name}"/>
                                <Label x:Name="lbl_original" Grid.Row="0" Grid.Column="2" Text="{Binding Ingredients.originalString}"/>
                            </Grid>

View Model--

public class RecipieGetItems
{
public string aggregateLikes { get; set; }
public List extendedIngredients { get; set; }
public string id { get; set; }
public string image { get; set; }
public string instructions { get; set; }
public string readyInMinutes { get; set; }
public string servings { get; set; }
public string sourceName { get; set; }
public string sourceUrl { get; set; }
public string spoonacularSourceUrl { get; set; }
public string title { get; set; }
public string sustainable { get; set; }
public bool vegetarian { get; set; }
public bool vegan { get; set; }
public bool veryHealthy { get; set; }
public bool veryPopular { get; set; }
public bool dairyFree { get; set; }
public bool glutenFree { get; set; }
public List analyzedInstructions { get; set; }
}
public class Ingredients
{
public string aisle { get; set; }
public string amount { get; set; }
public string consistency { get; set; }
public string image { get; set; }
public string name { get; set; }
public string originalString { get; set; }
public string unit { get; set; }
public string id { get; set; }
}

C# code

public void DisplayRecipeDetail()
{
objModel = BindRecipeDetails();
Device.BeginInvokeOnMainThread(() =>
{
RecipeDetails111.ItemsSource = objModel;

        });
      }

List BindRecipeDetails()
{
List objModelLst = new List();
try
{
RecipieGetItems objModel = new RecipieGetItems();
var response = recipieSearchItem.GetRecipiesDetails(id, BaseClass.Token);
CustomResponse objdata = JsonConvert.DeserializeObject<CustomResponse>(response.ToString());
objModel = JsonConvert.DeserializeObject(objdata.parameters);
objModelLst.Add(objModel);
}
catch (Exception ex)
{
Toast.MakeText(_context, ex.Message, ToastLength.Long).Show();
}
return objModelLst;
}

Target '_GetRestoreTargetFrameworksOutput', not found

$
0
0

The following warning now appears when performing a build, rebuild or clean

Warning: Target '_GetRestoreTargetFrameworksOutput', not found in the project (MyProject.Droid)

I haven't had any luck on google or SO - does anyone have any insights as to what this might mean?

Creating a Table

$
0
0

Is it possible to create a 3 by 3 Table just like what we did in html

Is there a way to render the Zxing ScannerPage in Xaml?

$
0
0

I'm using the MVVM approach to make a small scanner app. I have a startPage.Xaml with one button binded to a command in the viewModel that opens my scannerPage.Xaml On the scannerPage I have just a simple footer, and want the scanner object to fill the rest of the page. However, when I add the scanner object to my stackPanel I get the following exception: "System.MissingMethodException: Default constructor not found for type ZXing.Net.Mobile.Forms.ZXingScannerPage". I'll list my xaml code below. Any help will be much appreciated. Thanks

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:forms="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
             xmlns:custom="using:MobiNative_Forms.Views"
             x:Class="MobiNative_Forms.Views.BarcodePage"
             BackgroundColor="Transparent">
  <ContentPage.Content>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="8.5*" />
        <RowDefinition Height="1.5*" />
      </Grid.RowDefinitions>
      <StackLayout x:Name="layout2" Grid.Row="0" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
        <forms:ZXingScannerPage></forms:ZXingScannerPage>
      </StackLayout>
      <Label Grid.Row="1" Text="MOBI" FontSize="Large" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="Blue"/>
    </Grid>
  </ContentPage.Content>
</ContentPage>

Getting GPS coordinates without GeolocatorPlugin

$
0
0

Hi all!
Is there a way to get GPS coordinates without GeolocatorPlugin?
Thanks in advance.


Add custom logo in qr code xamarin forms

$
0
0

Hello,

I want to add custom logo in the qr code in xamarin forms.Can you please help me out.

Need help with ExpandableListView

$
0
0

Hey I need help with ExpandableListView sample on GitHub by HoussemDellai (sry not allowed to post links) for a project in school as im not really good in coding at all.

I try to build a ListView with expandable items. This sample works great but unfortunately I need to add different amounts of Buttons which have different onClick Events underneath each item. In the sample there are always 3 template Buttons. Is there a way to hardcode this thing in a simple way?

Thanks in advance!

Is there any Compression Technique for Video, Audio,Images & Documents in Xamarin Forms

$
0
0

I want to upload the audio, video and image files to the server. So I need to compress the files so it can easily be transported over the server.
FFMpeg(3rd party tool) was an option, but it is not supported in .net Standard 2.0., and apart from that i'm not getting any useful tool. If anyone knows any good tool, or by some means to compress and reduce the size of such files then it will be very helpful.

OnDisappearing event fired in the first page of the NavigationPage stack.

$
0
0

Hi,
I'm pretty new on xamarin form and I would like to understand why
if I initialize my first page in the NaviagationPage also the event OnDisappearing is fired.
That's my code in the app.cs file:
public App ()
{
InitializeComponent();
MainPage = new NavigationPage(new Page1());
}

and at the startup of the app the event OnDisappearing (I ovveride the method) is fired in the Page1 but the Page1 is visible properly.

Thanks

System.IO.FileNotFoundException error to build Android project in Xamarin.Forms

$
0
0

I am not able to build my Android project of Xamarin.Form. However, iOS project works fine.

I have tried by remove all DLLs from Package and Bin folders but it doesn't work.

Can anybody guide me?

Error: Exception while loading assemblies:
System.IO.FileNotFoundException: Could not load assembly 'Xamarin.iOS,
Version=0.0.0.0, Culture: neutral, PublicKeyToken=84exxxxxxxx'.
Perhaps it doesn't exist in the Mono for Android Profile?

enter image description here

DLLs with version

enter image description here

enter image description here

enter image description here

Viewing all 91519 articles
Browse latest View live