Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

CarouselPage binding

$
0
0

I haven't used the CarouselPage before and I cannot get the binding for the children pages to work. I have something like this:

`    <?xml version="1.0" encoding="utf-8" ?>
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:JaaTyrePal;assembly=JaaTyrePal"
             xmlns:iconize="clr-namespace:FormsPlugin.Iconize;assembly=FormsPlugin.Iconize"
             x:Class="JaaTyrePal.HomePage"
             NavigationPage.HasNavigationBar="false">
    <ContentPage x:Name="Page1" BackgroundColor="Black"  >
        <Label Grid.Row="0" Grid.Column="1" Text="{Binding Temp}" Style="{StaticResource GaugeLabel}"/>

    </ContentPage>
    <ContentPage x:Name="Page2" BackgroundColor="Black" Title="Right Tyres">
         <Label Grid.Row="0" Grid.Column="1" Text="{Binding TempB}" Style="{StaticResource GaugeLabel}"/>
    </ContentPage>
</CarouselPage>`

And my simple ViewModel:
`

            public HomePageModel(MasterParameterContainer masterContainer)
            {
                Temp = 2.3;
            }

            double _temp;
            double Temp
            {
                get
                {
                    return _temp;
                }
                set
                {
                    _temp = value;
                    RaisePropertyChanged();
                }

`

I cant get the binding to work for ContentPages, I even tried the following in the code behind:

`protected override void OnBindingContextChanged()
        {
            Page1.BindingContext = BindingContext;
            Page2.BindingContext = BindingContext;
            base.OnBindingContextChanged();
        }`

What am I doing wrong here?


The name 'InitializeComponent' does not exist in the current context

$
0
0

1) Updated to Visual studio 15.5
2) Created a cross-platform solution with the new .NET standard template
3) Building the .NET standard project
4) Compilation error with the error in the title

Important to mention that this issue applies both to the Windows and Mac visual studio.

a new empty project with no modifications is not passing compilation?

PushAsync is not supported globally on iOS, please use a NavigationPage.

$
0
0

I created a Xamarin.Forms Shared project referencing to the MobileCRM from the samples site
and when i tried to navigate to another page in iOS
it show me this error:

"System.InvalidOperationException: PushAsync is not supported globally on iOS, please use a NavigationPage."

and here is my code snippet:

Button button2 = new Button
{
Text = " Go to Image Demo Page ",
Font = Font.SystemFontOfSize(NamedSize.Large),
BorderWidth = 1
};
button2.Clicked += async (sender, args) =>
await Navigation.PushAsync(new ImageDemoPage());

Adding rows to a grid using MVVM

$
0
0

On a page where I am displaying a receipt to a user, I have a section which lists the subtotal, any taxes, and the total. Since the taxes applicable vary by region and based on the products being sold, the number of rows in this section will vary. For example, here are 3 separate orders, one with GST and PST, one with just GST, and one with neither:



I've accomplished this by putting just the SubTotal in the grid in XAML, and adding the rest in the code-behind in a method I call from the ViewModel. However, I'd really like to avoid doing it this way, so I'm wondering if there is an approach to accomplishing this which doesn't require having a bunch of code in the View's code-behind. I'd like to do this while keeping the columns nicely aligned as if they were in a single grid, and without adding any weird spacing between the rows.

See What’s New in Visual Studio 2017 Version 15.5

$
0
0

Today we released Visual Studio 2017 version 15.5 into stable! Read the blog post here for more information and feel free to discuss below!

FreshMVVM vs. MVVM Light

$
0
0

Hi,

can anybody share with me their experiences with both frameworks? If someboby has used both the better.

Thanks a lot

Thomas

Fresh New Project Error in Compilation after last update of VS 15.5.0 and XF

$
0
0

I just created a new project and tapped to run but i'm getting a lot of errors like that:

Here are my Nuget manager page:

In Updates Tab I only have Xamarin.Android things that NEVER EVER I was able to update.

Configurations Choosed when created the Project:

Even in Shared Project I get these errors and more.

That's It. Anyone can help me with that? Please don't tell me to reinstall Visual Studio, my internet sucks and it takes one day or maybe more....

Correct XAML pattern to bind element to BindingContext property ('x:Name' binds to page not context)

$
0
0

Hi, I'm new to Xamarin, but I've already built a few pages and have got most of the binding working flawlessly.
I am, however, having an issue figuring out the proper way to bind an element in XAML (a Map to be precise) to a child property of the BindingContext (a ViewModel). I see that the "x:Name" attribute will bind it to a property of the page class, but not the context. All the other binding examples affect values of an element, but not the element object itself.
Is there a way to do this cleanly, or do I have to do what I'm doing now where the page class passes the element (Map) along into the ViewContext manually at startup?


ToolbarItems Xamarin Forms with ios 11

$
0
0

I updated xamarin to latest version and xcode so I am using ios 11 with xamarin forms but toolbaritems don't display properly.
When I have two items only one displays. When I have one item on toolbar, I cannot see an item. Is something new with toolbar and ios 11 ?

<ContentPage.ToolbarItems >
         <ToolbarItem  Icon="icon1.png" Command="{Binding Command1}" Order="Primary"  />
         <ToolbarItem  Icon="icon2.png" Command="{Binding Command2}" Order="Primary"  />
     </ContentPage.ToolbarItems>

In previous version all toolbaritems were working properly.
In android and uwp toolbaritems are still the correct ones.

Xamarin ffimageloading plugin tap image to full screen

$
0
0

The code below render an image with 200px height using ffimageloading component. I need to tap on this image and display the image in a fullscreen or zoom it. Is it posible with ffimageloading or I need implement it by each platform (android and ios)?

I need to put space in links because I receive an annoying message: "You have to be around for a little while longer before you can post links."

View code

    <?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:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
                 prism:ViewModelLocator.AutowireViewModel="True"
                 xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
                 x:Class="Namespace.Views.MyClass">
    <Grid Padding="0"
                      Margin="0"
                      BackgroundColor="{StaticResource BackgroundColor}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="200" />
                        </Grid.RowDefinitions>
                        <ffimageloading:CachedImage
                            Grid.Row="0"
                            Source="{Binding ThumbPath}"
                            Aspect="AspectFill">
                            <ffimageloading:CachedImage.LoadingPlaceholder>
                                <OnPlatform
                                x:TypeArguments="ImageSource"
                                iOS="logo_header"
                                Android="logo_header" />
                            </ffimageloading:CachedImage.LoadingPlaceholder>
                            <ffimageloading:CachedImage.ErrorPlaceholder>
                                <OnPlatform
                                x:TypeArguments="ImageSource"
                                iOS="noimage"
                                Android="noimage" />
                            </ffimageloading:CachedImage.ErrorPlaceholder>
                        </ffimageloading:CachedImage>
                    </Grid>
    </ContentPage>

ViewModel code using prism

 public class MyClassViewModel : BindableBase, INavigationAware
 {
    public MyClassViewModel()
    {
    }

    private string _thumbPath;

    public PerfilPetDto ThumbPath
    {
        get
        {
            return "uri to online image";
        }
        set
        {
            _thumbPath = value;
            RaisePropertyChanged(nameof(ThumbPath));
        }
    }
}

Could not load assembly Xamarin.Android.Support.Fragment (Xamarin.Forms 2.5)

$
0
0

Hi,

I tried to upgrade to latest release of Xamarin.Forms v2.5.0.77107 (was before on v2.4.0.74863). It works properly for my iOS and shared projects but compilation fails for my Android project:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.Android.Support.Fragment.dll'
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00099] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:220
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:170
  at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <593a6fd557984367bb21e275d0fa0659>:0
  at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0019c] in <593a6fd557984367bb21e275d0fa0659>:0  (LionsBase.Droid)

The Package section of my project does not have any reference to Xamarin.Android.Support.Fragment and if I try to add it manually, I get exception:

Could not install package 'Xamarin.Android.Support.Fragment 26.1.0.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', 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.

Tried to choose an older release (24 or so) and error is similar.

My project is targeting Android 5.0 (API level 21) up to Android 7.0 (API level 24).

Tried to raise the maximum to Android 7.1 (API level 25) but it does not help.

Could not load assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0

$
0
0

Hi,

I have updated my Xamarin forms version to 2.5.0.91635.

Portable projects build, but the Droid project fails to build with the following error message...

Severity Code Description Project File Line Suppression State
Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.Android.Support.Fragment.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver) Quantum.Droid C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1446

Here are my VS and SDK versions:

Microsoft Visual Studio Enterprise 2017 Version 15.4.5
Xamarin 4.7.10.38 (34c1b6c)
Xamarin.Android SDK 8.0.2.1 (HEAD/c2a33d8ea)
Xamarin.iOS and Xamarin.Mac SDK 11.3.0.47 (51128b8)

Is there something extra I need to do to get this to build with the latest version?

Please help...

xamarin App is getting closed after installing SQLite.net pcl

$
0
0

Hi i created a fresh app and i am able to debug it .After installing SQLite the app i getting closed every time i tapped on it or try debug on it by saying "App2." is getting closed.Once i uninstall sq Lite it will start working fine .I am using VS2017 community and sqlite-net-pcl -Version 1.4.118

Hunting Memory Leaks, best practices?

$
0
0

Hi,

I started a new Thread because this Title makes more sense.

What are your best strategies to hunt down MemoryLeaks, especialls on Android? How can I check if a certain object get's relased? Does it make sense to include a Debug.WriteLine into the Destructor of the Class of interest?

Does it make sense to call GC.Collect to see if memory stays constant?

Thanks for all help!

Best
Thomas

VS2017 - New install - no Cross Platform App (Xamarin.Forms or Native) template

$
0
0

I tried following the "Windows Install" and the Quickstart, but keep getting stopped at the New Project.

I HAD an install of VS 2017 that had the template there, but did not have any of the Android tools. I eventually did a clean-install of VS2017, and now don't have the template.

I've uninstalled and fresh installed VS2017 via the installer several times. Each time I chose the Mobile Development with .Net. And each time when I pick New Project, I don't have that template:

(This was going to be a screenshot, but I can't upload an image?!??! Actually, I can upload an image, but I can't post links... wtf)

There are no pending updates under Extensions and Updates. Clicking Help -> Xamarin -> Release Notes leads to a 404 page so grr to that.

I have no idea what else I can check or try.


ListView memory leaks

$
0
0

I have a Xamarin Forms application. On the main page there is a ListView, every view cell contains text with image. When I start to scroll from beginning to end, after that from the end to the beginning and again and again, the app crashes. Any scrolling increases the allocated memory and after several steps the app crashes.

<ListView
                ItemsSource="{Binding ViewData}"
                ItemAppearing="OnItemAppearing"
                HasUnevenRows="True"
                SeparatorVisibility="None"
                x:Name="NewsAndFeedListView">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                            <Grid>
                                <ffimageloading:CachedImage  Grid.Row="0" DownsampleToViewSize="True" Aspect="AspectFill"       x:Name="MainPhoto">
                                    <ffimageloading:CachedImage.GestureRecognizers>
                                        <TapGestureRecognizer Tapped="MainPhotoTapped" NumberOfTapsRequired="1"/>
                                    </ffimageloading:CachedImage.GestureRecognizers>
                                </ffimageloading:CachedImage>
                                <Label Text="Click here"></Label>
                            </Grid>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

The image's source is set in the code behind in the Viewcell's BindingContextChenged method. Is there some resolution for this problem?

Listview scroll performance

$
0
0

Hello,
I created an app using xamarin.forms. Unfortunately I have problems with performance scrolling (less 200 items) in Android devices. The scroll has a lag and in some occasions it is almost unusable, especially if there are images. If I use converter for set image the listview has terrible scrolling.

Any ideas for increase performance?

Memory Leak on ListView (due to ByteArrayToImageConverter)

$
0
0

I m using ByteArrayToImageConverter to convert byte array i m getting from SQL server databse , the converter as below

 public class ByteArrayToImageConverter : IValueConverter
    {
        public ImageSource retSource;
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
           // ImageSource retSource = null;
            if (value != null)
            {
                byte[] imageAsBytes = (byte[])value;
                // byte[] decodedByteArray = System.Convert.FromBase64String(Encoding.UTF8.GetString(imageAsBytes, 0, imageAsBytes.Length));
                // var stream = new MemoryStream(decodedByteArray);
                retSource = ImageSource.FromStream(() => new MemoryStream(imageAsBytes));
            }
            return retSource;
        }


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {

            //return null;
            throw new NotImplementedException();
        }

my problem when i show all the images in the xaml list view ( bind with my model) i m having memeory leaks , every time i open the list view the memory is growing gradually , Whast is the solution to reduce the memeor leaking issue with the converter and list view ( by the way i m using CachingStrategy="RecycleElement" but it dosent reduce the memory leak. please if anyone across this type of issue please let me know.

Thank you inadvance for your support.
Pan

Xamarin Forms Video Player

$
0
0

When I was taking classes last year through Xamarin University, I was surprised to find there was no Xamarin Forms video player component in core. So I thought it would be a fun little side project I have been working on for the past few months. I just released it to the Xamarin Component Store. It allows you to hook into events (playing, paused, completed, etc.) and comes with a variety of options for volume, visibility, and arbitrary events for time intervals among other things - all from shared code.

Let me know what you guys think. I hope you find it useful in your projects. I am opening this thread for any discussions related to the component.

Component:
http://go.adams.life/1VQbqnt

Blog Post:
http://www.adams.life/blog/2016/03/cross-platform-video-player-xamarin-forms/

Bug Tracker:
https://bitbucket.org/OctaneSoftware/octane.xam.videoplayer/issues

How to play a video/create videoplayer in XAML

$
0
0

What is the easiest way to embed a cross platform videoplayer element in XAML?
WebView that plays youtube or similar (still need to create html page then) seems to work, in XLabs or native Forms I have not found any suitable element.
What is the best (==easiest) way to get a player in Xamarin Forms?

Viewing all 204402 articles
Browse latest View live


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