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

Custom Renderer ListView throwing exception

$
0
0

Hi

I have been trying to implement custom ListView based on Tutorial provided by CraigDunn in his git repository.

https://github.com/xamarin/xamarin-forms-samples/tree/master/CustomRenderers/ListView

I have created new Tab with my custom Listview. I came across a problem when i tried to bind items on the listView. Everything seems fine as long as you add items to the list in a c# like this:

    public WojTab()
    {

        InitializeComponent();
        nativeListView3.Items = DataSource3.GetList();

    }
    async void OnItemSelected (object sender, SelectedItemChangedEventArgs e)
    {
        await Navigation.PushModalAsync (new DetailPage (e.SelectedItem));
    }

However problems starts once you try to bind that list in an actual XAML:

    <StackLayout>
      <Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*" />
      </Grid.RowDefinitions>
      <Label Text="Woj's Page" HorizontalTextAlignment="Center"/>
      <local:NativeListView3 Grid.Row="1" x:Name="nativeListView3" ItemSelected="OnItemSelected" VerticalOptions="FillAndExpand" Items="dataSource" />
    </Grid>
   </StackLayout>

dataSource is a public property of "List" which I add in a similar fashion.

dataSource = DataSource3.GetList();

public class DataSource3
{
    public string Name { get; set; }
    public string Category { get; set; }
    public string ImageFilename { get; set; }

    public DataSource3()
    {
    }

    public DataSource3(string name, string category, string imageFilename)
    {
        Name = name;
        Category = category;
        ImageFilename = imageFilename;
    }

    public static List<DataSource3> GetList()
    {
        var l = new List<DataSource3>();

        l.Add(new DataSource3("FirstItem", "FirstItem", "FirstItem"));
        l.Add(new DataSource3("Item", "Item", "Item"));
        l.Add(new DataSource3("Item2", "Item2", "Item2"));
        l.Add(new DataSource3("Ite3", "Ite3", "Ite3"));
        l.Add(new DataSource3("Ite4", "Ite4", "IteIte4m"));
        l.Add(new DataSource3("Item5", "Item", "Item"));
        l.Add(new DataSource3("Item6", "Item", "Item"));
        l.Add(new DataSource3("Item7", "Item", "Item"));
        l.Add(new DataSource3("Item8", "Item", "Item"));
        l.Add(new DataSource3("Item9", "Item", "Item"));
        l.Add(new DataSource3("Item10", "Item", "Item"));
        l.Add(new DataSource3("Item11", "Item", "Item"));
        l.Add(new DataSource3("Item12", "Item", "Item"));
        l.Add(new DataSource3("Item13", "Item", "Item"));
        l.Add(new DataSource3("Item14", "Item", "Item"));
        l.Add(new DataSource3("Item15", "Item", "Item"));

        return l;
    }

}

If I do it in XAML I get an exception. Stating that compiler cannot convert System.String to List

My question is: Am I doing something wrong or you actually cannot Bind Items in ListView in XAML to certain property with Custom Renderers (bear in mind no MVVM is used here).


"Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'."

$
0
0

Hello everyone,

I'm trying to consume webservices from my Android App using Xamarin.Forms, from my local server (IIS Express), but when I clik on the button I occured this error
"Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'."
I changed my "localhost" address to my IP address, but nothing changed always the same error.
Please somone can help me.

App Android crashing randomly

$
0
0

Log crash from LogCat:
12-15 11:39:16.102 2173 2173 E audit : type=1701 msg=audit(1513345156.092:359): auid=4294967295 uid=10271 gid=10271 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=28543 comm=546872656164706F6F6C20776F726B reason="memory violation" sig=11

12-15 11:39:16.282 847 2128 D GraphicsStats: Buffer count: 12

12-15 11:39:16.282 314 382 D libEGL : eglTerminate EGLDisplay = 0xb65bf6fc

12-15 11:39:16.282 314 382 D libEGL : eglTerminate EGLDisplay = 0xb65bf6fc

12-15 11:39:16.282 314 382 I SurfaceFlinger: id=239 Removed NainActivit (5/7)

12-15 11:39:16.282 314 1308 I SurfaceFlinger: id=239 Removed NainActivit (-2/7)

12-15 11:39:16.282 314 314 D libEGL : eglTerminate EGLDisplay = 0xbe8683a4

12-15 11:39:16.282 847 1401 I WindowState: WIN DEATH: Window{b068f7c u0 d0 xx.xxx.mypackage/md596454a66b4b64dc6a9d4ad4b5c8b403f.MainActivity}

12-15 11:39:16.282 847 2128 I ActivityManager: Process xx.xxx.mypackage (pid 28142)(adj 0) has died(280,374)

12-15 11:39:16.282 847 2128 D ActivityManager: cleanUpApplicationRecord -- 28142

12-15 11:39:16.292 847 1401 D InputDispatcher: Focus left window: 28142

12-15 11:39:16.292 847 2128 D ActivityManager: isAutoRunBlockedApp:: xx.xxx.mypackaged, Auto Run ON

12-15 11:39:16.292 847 2128 W ActivityManager: Force removing ActivityRecord{bd9de50 u0 xx.xxx.mypackage/md596454a66b4b64dc6a9d4ad4b5c8b403f.MainActivity t30}: app died, no saved state

12-15 11:39:16.302 377 377 I Zygote : Process 28142 exited due to signal (11)

Packages config Droid project:
<?xml version="1.0" encoding="utf-8"?>
packages
package id="CarouselView.FormsPlugin" version="4.4.2" targetFramework="monoandroid71" /
package id="DryIoc.dll" version="2.10.1" targetFramework="monoandroid80" /
package id="Microsoft.AppCenter" version="1.1.0" targetFramework="monoandroid80" /
package id="Microsoft.AppCenter.Analytics" version="1.1.0" targetFramework="monoandroid80" /
package id="Microsoft.AppCenter.Crashes" version="1.1.0" targetFramework="monoandroid80" /
package id="Microsoft.Bcl" version="1.1.10" targetFramework="monoandroid80" /
package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="monoandroid80" /
package id="Microsoft.Net.Http" version="2.2.29" targetFramework="monoandroid80"
package id="Microsoft.NETCore.Platforms" version="1.0.1" targetFramework="monoandroid71" /
package id="Microsoft.Win32.Primitives" version="4.0.1" targetFramework="monoandroid71" /
package id="NETStandard.Library" version="1.6.0" targetFramework="monoandroid71" /
package id="OxyPlot.Core" version="1.0.0" targetFramework="monoandroid71" /
package id="OxyPlot.Xamarin.Android" version="1.0.0" targetFramework="monoandroid71" /
package id="OxyPlot.Xamarin.Forms" version="1.0.0" targetFramework="monoandroid71" /
package id="PCLCrypto" version="2.0.147" targetFramework="monoandroid71" /
package id="PInvoke.BCrypt" version="0.3.2" targetFramework="monoandroid71" /
package id="PInvoke.Kernel32" version="0.3.2" targetFramework="monoandroid71" /
package id="PInvoke.NCrypt" version="0.3.2" targetFramework="monoandroid71" /
package id="PInvoke.Windows.Core" version="0.3.2" targetFramework="monoandroid71" /
package id="Plugin.CurrentActivity" version="1.0.1" targetFramework="monoandroid71" /
package id="Plugin.Fingerprint" version="1.4.5" targetFramework="monoandroid71" /
package id="Plugin.Share" version="7.0.2-beta27" targetFramework="monoandroid71" /
ackage id="Prism.Core" version="6.3.0" targetFramework="monoandroid71" /
package id="Prism.DryIoc.Forms" version="6.3.0.1" targetFramework="monoandroid80" /
package id="Prism.Forms" version="6.3.0" targetFramework="monoandroid71" /
package id="System.AppContext" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Collections" version="4.0.11" targetFramework="monoandroid71" /
package id="System.Collections.Concurrent" version="4.0.12" targetFramework="monoandroid71" /
package id="System.Console" version="4.0.0" targetFramework="monoandroid71" /
package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="monoandroid71" /
package id="System.Diagnostics.Tools" version="4.0.1" targetFramework="monoandroid71" /
package id="System.Diagnostics.Tracing" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Globalization" version="4.0.11" targetFramework="monoandroid71" /
package id="System.Globalization.Calendars" version="4.0.1" targetFramework="monoandroid71" /
package id="System.IO" version="4.1.0" targetFramework="monoandroid71" /
package id="System.IO.Compression" version="4.1.0" targetFramework="monoandroid71" /
package id="System.IO.Compression.ZipFile" version="4.0.1" targetFramework="monoandroid71" /
ackage id="System.IO.FileSystem" version="4.0.1" targetFramework="monoandroid71" /
package id="System.IO.FileSystem.Primitives" version="4.0.1" targetFramework="monoandroid71" /
package id="System.Linq" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Linq.Expressions" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Net.Http" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Net.Primitives" version="4.0.11" targetFramework="monoandroid71" /
package id="System.Net.Sockets" version="4.1.0" targetFramework="monoandroid71" /
package id="System.ObjectModel" version="4.0.12" targetFramework="monoandroid71" /
package id="System.Reflection" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Reflection.Extensions" version="4.0.1" targetFramework="monoandroid71" /
package id="System.Reflection.Primitives" version="4.0.1" targetFramework="monoandroid71" /
package id="System.Resources.ResourceManager" version="4.0.1" targetFramework="monoandroid71" /
package id="System.Runtime" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Runtime.Extensions" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Runtime.Handles" version="4.0.1" targetFramework="monoandroid71" /
package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Runtime.InteropServices.RuntimeInformation" version="4.0.0" targetFramework="monoandroid71" /
package id="System.Runtime.Numerics" version="4.0.1" targetFramework="monoandroid71" /
package id="System.Security.Cryptography.Algorithms" version="4.2.0" targetFramework="monoandroid71" /
package id="System.Security.Cryptography.Encoding" version="4.0.0" targetFramework="monoandroid71" /
package id="System.Security.Cryptography.Primitives" version="4.0.0" targetFramework="monoandroid71"
package id="System.Security.Cryptography.X509Certificates" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Text.Encoding" version="4.0.11" targetFramework="monoandroid71" /
package id="System.Text.Encoding.Extensions" version="4.0.11" targetFramework="monoandroid71" /
package id="System.Text.RegularExpressions" version="4.1.0" targetFramework="monoandroid71" /
package id="System.Threading" version="4.0.11" targetFramework="monoandroid71" /
package id="System.Threading.Tasks" version="4.0.11" targetFramework="monoandroid71" /
package id="System.Threading.Timer" version="4.0.1" targetFramework="monoandroid71" /
package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="monoandroid71" /
package id="System.Xml.XDocument" version="4.0.11" targetFramework="monoandroid71" /
package id="Validation" version="2.2.8" targetFramework="monoandroid71" /
package id="Xam.Plugin.Connectivity" version="2.3.0" targetFramework="monoandroid71" /
package id="Xam.Plugins.Settings" version="2.5.8" targetFramework="monoandroid71" /
package id="Xamarin.Android.Arch.Core.Common" version="1.0.0" targetFramework="monoandroid80" /
package id="Xamarin.Android.Arch.Lifecycle.Common" version="1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Arch.Lifecycle.Runtime" version="1.0.0" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.Annotations" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.Compat" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.Core.UI" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.Core.Utils" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.CustomTabs" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.Design" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.Fragment" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.Media.Compat" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.Transition" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.v4" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.v7.AppCompat" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.v7.CardView" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.v7.MediaRouter" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.v7.Palette" version="26.1.0.1" targetFramework="monoandroid80" /
package id="Xamarin.Android.Support.v7.RecyclerView" version="26.1.0.1" targetFramework="monoandroid80" />
package id="Xamarin.Android.Support.Vector.Drawable" version="26.1.0.1" targetFramework="monoandroid80" />
package id="Xamarin.Auth" version="1.5.0.3" targetFramework="monoandroid80" />
package id="Xamarin.Build.Download" version="0.4.7" targetFramework="monoandroid80" />
package id="Xamarin.FFImageLoading" version="2.2.9" targetFramework="monoandroid71" />
package id="Xamarin.FFImageLoading.Forms" version="2.2.9" targetFramework="monoandroid71" />
package id="Xamarin.Forms" version="2.3.4.247" targetFramework="monoandroid71" />
/packages>

How to Consume WCF Service in Xamarin.forms PCL ?

$
0
0

I created a Xamarin.Forms PCL project which gave me a solution with PCL project, Andriond,IOS and Windows projects. I have written my business logic in a WCF service library and hosted it on my LOCAL IIS which is accessible from anywhere in the corporate network. The business logic talks to TFS object model in turn. I tried consuming the service using channel factory (my web service interface class is in a different PCL project and I referenced the PCL dll in xamarin.forms PCL and the endpoint address is my hosted service), but not successful. I tried following the walk through provided by xamarin for consuming WCF service in an android application and was successful, but was not able to consume the service via same approach in xamarin forms android application ( where I used the service client proxy class in PCL and tried to populate the data using app.cs class in PCL). Is there any specific approach for consuming WCF service in xamarin forms with PCL ?

Help me solve problems in this code (Custom Render cleanUp)

$
0
0

Custom Render cleanUp reference :
https://igorelikblog.wordpress.com/2016/07/08/xamarin-form-memory-management/

The DisposeManger class has some errors. How do I resolve the _contentPage _navigationPage and _disposableRenderer?

 public class DisposeManager
{
    private readonly IDisposable ;
    Page NavigationPage ;

    public DisposeManager(IDisposable disposableRenderer, Element element)
    {
        _disposableRenderer = disposableRenderer;
        SetupDisposeEvents(element);
    }

    private void SetupDisposeEvents(Element element)
    {
        var contentPage = GetContainingPage(element);

        _navigationPage = GetContainingNavigationPage(contentPage);
        if (_navigationPage != null)
        {
            _navigationPage.Popped += OnPagePopped;
        }
    }

    private Page GetContainingPage(Element element)
    {
        Element parentElement = element.ParentView;

        if (parentElement is Page)
        {
            return (Page)parentElement;
        }
        return GetContainingPage(parentElement);
    }

    private NavigationPage GetContainingNavigationPage(Element element)
    {
        var parentElement = element.Parent;

        if (parentElement == null)
        {
            return null;
        }

        if (parentElement is NavigationPage)
        {
            return (NavigationPage)parentElement;
        }

        return GetContainingNavigationPage(parentElement);
    }

    private void OnPagePopped(object s, NavigationEventArgs e)
    {
        if (e.Page == _contentPage)
        {
            _disposableRenderer.Dispose();
            _navigationPage.Popped -= OnPagePopped;
        }
    }
}

App crash after upgrade to Xamarin.Forms 2.4.0

$
0
0

I have a Xamarin.Forms PCL application which I have recently upgraded to XF 2.4.0 from 2.3.4.

Since upgrading my Android app is crashing on startup with the following exception.

11-01 21:07:56.247 I/MonoDroid( 1474): UNHANDLED EXCEPTION:
11-01 21:07:56.252 I/MonoDroid( 1474): System.MissingMethodException: Method 'Xamarin.Forms.Platform.Android.FormsViewGroup.SendViewBatchUpdate' not found.
11-01 21:07:56.252 I/MonoDroid( 1474):   at Xamarin.Forms.Platform.Android.VisualElementTracker.HandleViewAttachedToWindow () [0x00008] in D:\agent\_work\1\s\Xamarin.Forms.Platform.Android\VisualElementTracker.cs:182 
11-01 21:07:56.252 I/MonoDroid( 1474):   at Xamarin.Forms.Platform.Android.VisualElementTracker+AttachTracker.OnViewAttachedToWindow (Android.Views.View attachedView) [0x00013] in D:\agent\_work\1\s\Xamarin.Forms.Platform.Android\VisualElementTracker.cs:402 
11-01 21:07:56.252 I/MonoDroid( 1474):   at Android.Views.View+IOnAttachStateChangeListenerInvoker.n_OnViewAttachedToWindow_Landroid_view_View_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_attachedView) [0x0000f] in <2e14bb2dd93a405e81838369ed72695b>:0 
11-01 21:07:56.252 I/MonoDroid( 1474):   at (wrapper dynamic-method) System.Object:3d624d93-c5a8-437a-af7c-7dbe3b5c5f10 (intptr,intptr,intptr)

My iOS app is still working fine. I have tried all of the various 2.4.0 versions (2.4.0.38779, 2.4.0.18342, 2.4.0.282, 2.4.0.280) ensuring my version matches between PCL and Droid each time and have cleaned, deleted bin/obj and restarted Visual Studio in-between builds. Same problem each time. If I downgrade back to 2.3.4.270 the app runs again fine without changes to any code or other Nuget packages.

Has anyone else seen this error and could help me out or suggest what could be wrong?

Thanks

Keyboard

$
0
0

Someone know if exist a way to disable thephisical keyboard on a device?

List-View group header List-view group header not getting proper height in xamarin IOS.

$
0
0

I'm uses xamarin forms(V-2.3.3.193) and uses listview in xaml. In listview i have used group header and item template. I have also given HasUnevenRows="True" so it takes proper heights for Android however it not taking proper height in ios. Below are the example of xaml code.

           <ListView xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              IsGroupingEnabled="True"
              HasUnevenRows="True"
              SeparatorVisibility="None">
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <StackLayout BackgroundColor="#14949c" Padding="10,10,10,10" Margin="0,1,0,0">
                    <!--<Label Text="{Binding}" LineBreakMode="WordWrap"
                 TextColor="White" Margin="0,0,0,0" FontSize="13"/>-->
                    <ctl:CustomTextView Text="{Binding}"
                 TextColor="White" Margin="0,0,0,0" FontSize="13"></ctl:CustomTextView>
                </StackLayout>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
    <ListView.GroupHeaderTemplate>
        <DataTemplate>
            <ViewCell>
                <StackLayout Orientation="Horizontal" Padding="0,10,10,10" Margin="0,2,0,0" BackgroundColor="#14949c" Spacing="0">
                    <Button Image="{Binding Icon}" BorderWidth="0" VerticalOptions="Center" Clicked="Button_tapped" CommandParameter="{Binding .}" BackgroundColor="#14949c"
          WidthRequest="18" HeightRequest="18" Margin="10,0,0,0" />
                    <StackLayout Spacing="0" VerticalOptions="Center" Padding="10,0,0,0">
                        <Label Text="{Binding Title}" TextColor="White" LineBreakMode="WordWrap">
                            <Label.FontSize>
                                <OnPlatform x:TypeArguments="x:Double" iOS="18" Android="18" WinPhone="14" />
                            </Label.FontSize>
                            <Label.FontFamily>
                                <OnPlatform x:TypeArguments="x:String" iOS="Asap-Regular" Android="Asap-Regular.ttf#Asap-Regular"/>
                            </Label.FontFamily>
                        </Label>
                        <!--<Label Text="{Binding SubTitle}" FontSize="10" TextColor="White" LineBreakMode="WordWrap"/>-->
                    </StackLayout>

                </StackLayout>
                <!--<BoxView HeightRequest="3" BackgroundColor="#146c74"></BoxView>-->
            </ViewCell>
        </DataTemplate>
    </ListView.GroupHeaderTemplate>
</ListView>

Edit:
I need to update the height based on content which using "HasUnevenRows=True" working fine in Android however not working in IOS.

kindly suggest solution to resolve this issue.

In Advance Thanks.
Regards,
Ankit


Joining main url and remaining url using IValueConverter

$
0
0

I have two web services in my xamarin forms project.

From the first web service, I got the main url and from the second web service, I got the remaining url of an image. The mainurl is stored in a variable using Application.Current.Properties.

The second web service is a list of items. So I need to join the two url and show it in the UI. For this, I am using IValueConverter.

My converter code:

    public class UrlsLinkconverter : IValueConverter
       {
        #region IValueConverter implementation
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
                return string.Empty;

            string rootUrl = Application.Current.Properties["rootUrl"].ToString();
            string fullUrl = String.Concat(rootUrl,value.ToString());
            Debug.WriteLine("fullUrl::>>>>"+fullUrl);
            return fullUrl.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
        #endregion
    }

Xaml codes:

    <ContentPage.Resources>
        <ResourceDictionary>
            <local:UrlsLinkconverter x:Key="urlJoinConverter"></local:UrlsLinkconverter>
        </ResourceDictionary>
    </ContentPage.Resources>

    <controls:CircleImage 
         Source="{Binding thumbnailImageUrl, Converter={StaticResource urlJoinConverter}}"
         HorizontalOptions="Start"
         VerticalOptions="Start"
         WidthRequest="50" 
         BorderColor="#1C7DB4"
         BorderThickness="2"
         HeightRequest="50" /> 

When running got a different message in the output box.

    [0:] fullUrl::>>>>d1kv7s9g8y3npv.cloudfront.net/testsite/files/doc-lib/2017/12/26/09/26/42/141/head/tweet_pic-thumbnail.jpg
    [0:] FileImageSourceHandler: Could not find image or image file was invalid: File: d1kv7s9g8y3npv.cloudfront.net/testsite/files/doc-lib/2017/12/26/09/26/42/141/head/tweet_pic-thumbnail.jpg

The two url are get joined but showing image file is invalid. But I can see the image if paste the full url into a browser.

I don't know the reason of this, anybody please suggest a solution?

Hot to combine values from different get web service using Binding to listview

$
0
0

Dears,

I am calling two web service in my xamarin forms project. From the first web service I am getting the root URL of an image and from the second I am getting the remaining url part. Only the second web service response is connected with the listview using ItemsSource property. My root url is d1kv7s9g8y3npv.cloudfront.net. Currently, I hardcoded the rooturl value in my code.

My Image code:

                       <Image 
                            Source="{Binding remainingUrl , StringFormat='d1kv7s9g8y3npv.cloudfront.net{0:F0}'}"
                            HorizontalOptions="Start"
                            VerticalOptions="Start"
                            WidthRequest="50" />

So how can I add the root url to this image code without hard coding?

Thanks in advance :)

Images not showing

$
0
0

I know this has been asked before, and I've read all the previous threads I can find.

I can get backgrounds and images to show on the emulator fine. I can't get any to show on an Android device connected using LivePlayer.

Images are in Resources/Drawable (also copied in to the hpdi etc. folders)
File properties are AndroidResource, Copy always
File names are lower case and just letters
Image formats are PNG, and all are less than 30K
I've cleaned and rebuilt
I've tried switching between release and debug builds
I've tried with fake image names, and it doesn't throw any errors (e.g. using missing.png, which doesn't exist)
Help!

It used to work, but after lots of unrelated work on the code using the emulator, when I go back to the LivePlayer it doesn't work. I had loads of problems with System.Json working sporadically, and so had to drop that in favour of newtonsoft, but along the way I updated all Nuget packages etc.

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:SparkEVX3"
             x:Class="SparkEVX3.MainPage"  BarBackgroundColor="#0e3c63" BarTextColor="Red" >

    <ContentPage BackgroundImage="background.png" Title="Status" >
        <ContentPage.Content>
        <StackLayout  VerticalOptions="Fill" HorizontalOptions="Fill" >
    ... 
                </StackLayout>
    </ContentPage.Content>
   </ContentPage>
</TabbedPage>

Error: Could not resolve type with token 01000041 (from typeref, class/assembly Xamarin.Forms.Inter

$
0
0

When i try to load mainpage i get this error:

System.TypeLoadException: Could not resolve type with token 01000041
(from typeref, class/assembly Xamarin.Forms.Internals.ResourceLoader, Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null)
at Operacional.MainPage..ctor () [0x00009] in C:\Projeto\AppOperacional\Source\Operacional\Operacional\Operacional\Views\MainPage.xaml.cs:25 }

What do i must to do?

This is mainpage code. I puted try..catcth to catch the error.

[XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class MainPage : ContentPage
    {
        DataService dataService;
        public MainPage()
        {
            try
            {
                InitializeComponent();
            }
            catch(Exception ex)
            {
                string err = ex.Message;
            }
            NavigationPage.SetHasNavigationBar(this, false);
            dataService = new DataService();
        }    
}

ios ui not reacting to touch events, no errors, no crash, nothing to indicate what is wrong.

$
0
0

ok so to start i am working on a cross platform project for work. i basically could just use a hand narrowing down what is causing an issue with the ios side of the project. Android works perfectly and as i want it to for now. ios did work as expected last week when i last updated its code and tested it.

i have a log in page. (displays page fine no issues, opens up sign up page as well and navigates back when button is pushed)

log in works, i have set breakpoints and followed code through this part. it hits the api and returns server status code gets users profile data and token information and opens the "masternav"(master detail page)

after it "logs in" this is where is just stops doing anything. the menu does not open, none of masterdetail detail page buttons can be hit. i set break points on each click function and nothing. the console only shows :

[0:] OK
[0:] 4
[0:] eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6Im1hdHRwQG5lc2RhLmNhIiwic3ViIjoibWF0dHBAbmVzZGEuY2EiLCJqdGkiOiIwOTQyNTE4NS00MzRiLTQyNmItYjMxMS1lYTdiNzIzMzQ5ZGIiLCJpYXQiOiIxLzE1LzIwMTggNzoyNjo1MiBQTSIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcHJpbWFyeXNpZCI6IjQiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiI0IiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy92ZXJzaW9uIjoiMSIsIm5iZiI6MTUxNjA0NDQxMiwiZXhwIjoxNTE2MDQ4MDEyLCJpc3MiOiJIZXJlMldvcmsiLCJhdWQiOiJIZXJlMldvcmsifQ.fz7iZaMjAZ2hfnz2NbMMgZjsYScPAbDLxG_PesuRZ-uGgi6sAxK7D0STxwNYsVr1JOVPh50VlCUtZqNM5f_1eQ
[0:] 2018-01-15T19:26:52.1687068Z
[0:]
[0:]
[0:] OK
[0:] Get profile was successful
[0:] Matt Perley
[0:] coming alive again....

^^^is the output of the log in function. the really weird thing is while im writing this question im now getting some new messages:

2018-01-15 14:26:57.813 VolMobile.iOS[267:28155] <_UISystemGestureGateGestureRecognizer: 0x17419b450>: Touch: Failed to receive system gesture state notification before next touch
2018-01-15 14:26:57.813 VolMobile.iOS[267:28155] <_UISystemGestureGateGestureRecognizer: 0x17419b380>: Gesture: Failed to receive system gesture state notification before next touch
2018-01-15 14:26:58.285 VolMobile.iOS[267:28155] <_UISystemGestureGateGestureRecognizer: 0x17419b450>: Touch: Failed to receive system gesture state notification before next touch
2018-01-15 14:26:58.286 VolMobile.iOS[267:28155] <_UISystemGestureGateGestureRecognizer: 0x17419b380>: Gesture: Failed to receive system gesture state notification before next touch

2018-01-15 14:27:00.014 VolMobile.iOS[267:28155] Cannot snapshot view (>) with afterScreenUpdates:NO, because the view is not in a window. Use afterScreenUpdates:YES.

other than the console output above there is no indication of an error, builds and deploys fine, as i said i can go through the log in process but as soon as i hit the landing page it just freezes, no crash, error, nothing.

the only major changes i have made in last week was adding an android background location service to the app and its not even mentioned in the pcl anywhere and its pretty bare bones, literally just the service that gets your location every minute. there is no background service for ios yet as that was the intended goal of today. besides that i cleaned up several functions/methods to get rid of spagetti code. but none of those changes broke the android app.

android works perfectly fine as it always has, its just ios giving an issue.

--i swear ive read that there were time limits on functions running or something on ios?

--could my log in process be running to long causing an error?

--is there a limit to http calls per second or something? because i am hitting one api and then making another call to 2 seperate endpoints a few times for different data.

--yes i am googling as i go. no im not a noob, however this is likely an issue i have caused i wont deny it lol.
i was trying to clean the app up so it didnt look like shit and making the code reusable as i have recently finished developing all of the concepts.

i can take pics and images but as this project is confidential and this is my first professional developer job i am going to try and avoid just posting them publicly, please feel free to request them to provide assistance, personally i dont mind sharing code but my boss does.

if anyone would possibly know whats going on please let me know. im going to continue looking into this while i wait so hopefully i will be able to resolve this issue on my own.

i am kind of new to xamarin and mobile development but not to programming or c#. i hope this makes sense as i am very frustrated and tired of looking at this so i may not come off as coherent as id like.

thank you to anyone who can try and shed some light on this.
Matt

Create Xamarin app on IOS and maintain/build on Windows

$
0
0

I am new to Xamarin development and come from a web development background

I have both iMac and Windows development environments and have installed the latest stable Visual Studio on both computers

I want to create a Xamarin app on IOS and share it with Windows via iCloud so that I can maintain/build the app on the Windows platform

Is this possible and what issues am I likely to have ?

StackLayout Children does not contain a definition for 'Add'

$
0
0

The project I'm working on uses Xamarin.Forms.2.5.0.122203

The entire exception thrown reads:

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'System.Collections.Generic.IList<Xamarin.Forms.View>' does not contain a definition for 'Add'

The code that generates the exception reads:

protected override void OnBindingContextChanged()
{
    base.OnBindingContextChanged();

    if( BindingContext == null )
    {
        return;
    }

    dynamic bindingContext = BindingContext;

    var title       = new Label{Text = bindingContext.Title};
    var subtitle    = new Label{Text = bindingContext.Subtitle};

    var pair = new StackLayout()
    {
        Padding             = 4,
        Spacing             = 0,
        HorizontalOptions   = LayoutOptions.FillAndExpand,
        VerticalOptions     = LayoutOptions.FillAndExpand,
        Children            = { title, subtitle },
    };

    this.View = pair;
}

The exception occurs at the line var pair = new StackLayout() and the cause is the line Children = { title, subtitle },

Taking out the line Children = { title, subtitle }, and adding the following two lines throws the same exception:

pair .Children.Add( title );
pair .Children.Add( subtitle );

However, the replacing the previous two lines with the following two lines eliminate the problem:

pair .Children.Insert( 0, title );
pair .Children.Insert( 1, subtitle );

This does not make any sense.

Could anyone please shed light on the issue?

Thank you all.


Trying to get Live Player to work

$
0
0

I'm using Visual Studio 15.4.4 and I have Live Player installed on my Android Nexus 5x. The phone says "Waiting for Visual Studio" -- when I bring up my application I do not get the banner. I have checked Enable Xamarin Live Player in the options.

Manage Live Player devices shows my device, and clicking Live Player from the device drop down does nothing.

Any suggestions? Thanks!

License error after installing VS2017

$
0
0

Since installing VS2017, the first time I compile a Forms app in the VS session I receive an error and the build fails. After that the build will compile until I close VS and open a new session, then the error appears again.

I did try deleting this file as suggested in older posts, but it did not solve the issue:
%APPDATA%\VisualStudio\account.json

The root assembly conflicts with another assembly

$
0
0

Hi, after updating my Xamarin for Visual Studio it shows

Severity Code Description Project File Line Suppression State
Error The root assembly /Users/focus/Library/Caches/Xamarin/mtbs/builds/Sample.iOS/f4117d8ec82f837c5c099ce86166d4d3/bin/iPhoneSimulator/Debug/Sample.iOS.exe conflicts with another assembly (/Users/focus/Library/Caches/Xamarin/mtbs/builds/Sample.iOS/f4117d8ec82f837c5c099ce86166d4d3/bin/iPhoneSimulator/Debug/Sample.iOS.exe).

while building the ios project help me for solving this.
Thank you.

Xamarin Forms Carousel View in C#

$
0
0

I'm trying to create a Xamarin Forms app for iOS using a Carousel view but i'm getting no where and I can't seem to find any useful help.
I can use C# and have a fairly good knowledge of C# but I can't seem to find anything useful.
Everythig i'm seeing is using XAML code which i'm not familiar with.

If someone could provide a very simple project of a Carousel page written in C# that would be a massive help
As would anyother information on Carousel pages.

How can I use binding with static property ?

$
0
0

I am using this code but its not working :

IsVisible="{x:Static local:GlobalResources.IsUserLoggedIn}"

This is the class :

public class GlobalResources { public static bool IsUserLoggedIn { get; set; } }

Viewing all 58056 articles
Browse latest View live


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