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

What can I do about Linker Behavior problems with an iOS app in Xamarin.Forms?

$
0
0

Hello,

I'm building a Xamarin.Forms app and have successfully released to Google Play for Android. I'm having trouble with iOS however.

The root of the problem is that I have to build with the Linker Behavior set to "Don't Link" for the duration of my development. Since my app isn't large, I wasn't concerned about it. When I recently went to submit to the App Store for TestFlight, I got an automated rejection indicating that there were all sorts of permissions I needed to add entries for in info.plist. I'm not using any of these permissions, so on a hunch I built using a Linker Behavior of "Link Framework SDKs Only" and the app was accepted for TestFlight. The problem is that my app crashes in a specific spot inside a .NET Framework 2.0 library I'm using when building with "Link Framework SDKs only".

It appears to be an Expression Tree call?

This is the stack trace:

System.ArgumentNullException: Value cannot be null.
Parameter name: method
at System.Linq.Expressions.Expression.Call (System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo method, System.Collections.Generic.IEnumerable1[T] arguments) [0x00111] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs:1239 at System.Linq.Expressions.Expression.Call (System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo method, System.Linq.Expressions.Expression[] arguments) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs:1046 at System.Linq.Expressions.Expression.Call (System.Reflection.MethodInfo method, System.Linq.Expressions.Expression[] arguments) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs:1001 at System.Dynamic.ExpandoObject+MetaExpando.BindSetMember (System.Dynamic.SetMemberBinder binder, System.Dynamic.DynamicMetaObject value) [0x00033] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Dynamic/ExpandoObject.cs:863 at System.Dynamic.SetMemberBinder.Bind (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args) [0x00035] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Dynamic/SetMemberBinder.cs:57 at System.Dynamic.DynamicMetaObjectBinder.Bind (System.Object[] args, System.Collections.ObjectModel.ReadOnlyCollection1[T] parameters, System.Linq.Expressions.LabelTarget returnLabel) [0x000c6] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Dynamic/DynamicMetaObjectBinder.cs:90
at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T] (System.Runtime.CompilerServices.CallSite1[T] site, System.Object[] args) [0x00019] in <4b284bfdf0034973b11698729c2d63bc>:0 at System.Runtime.CompilerServices.CallSiteOps.Bind[T] (System.Runtime.CompilerServices.CallSiteBinder binder, System.Runtime.CompilerServices.CallSite1[T] site, System.Object[] args) [0x00000] in <4b284bfdf0034973b11698729c2d63bc>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Exception source) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:156
at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Reflection.TargetInvocationException exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Utilities.cs:172
at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00035] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/CallInstruction.cs:327
at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00015] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Interpreter.cs:63
at System.Linq.Expressions.Interpreter.LightLambda.Run3[T0,T1,T2,TRet] (T0 arg0, T1 arg1, T2 arg2) [0x00038] in <4b284bfdf0034973b11698729c2d63bc>:0
at Q42.HueApi.HueClient+d__15.MoveNext () [0x000b5] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <0f7865fc4fbb4fddaab6f86c915ebae0>:0
at Q42.HueApi.Streaming.StreamingHueClient+d__12.MoveNext () [0x00091] in <88e6e7daf100469d84c7f4213d723d5e>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113

I'd appreciate any help I can get - this is completely blocking my release.

Thanks!


Updating VS 2017 to Version 15.7.0 results in several of the projects to be labeled "(incompatible)"

$
0
0

Hi,

Thanks for looking at this issue.

5 of the 9 csproj in the solution that was working in Version 15.6.0 now, for 15.7.0 has "(incompatible)" after the project.

When I try to reload one of those projects, I get message boxes that say
"(Warning Icon) The 'XamarinShellPackage' package did not lod correctly.
The problem may have been caused by a configuration
change or by the instalation of another exatension. You can get more information by examining the file
'C\Users...\ActivityLog.xml'.

And the same message but for XamarinIOSPackage.

In the ActivityLog.xml, there are some red ERROR messages. One is an 844 error and starts with "LegacySitePackage failed for package [XamarinShellPackage]Source: 'Merq.Core' Description: The type initializer for 'System.Reactive.Linq.Observable' threw an exception..." and goes on and on.

That is followed by 845 ERROR SetSite failed for package XamarinShellPackage

What is causing these messages? There is no difference between the csproj files for the project that I tried a reload.

Any insight is much appreciated.

Is there a package as iCarousel in xamarin forms.

$
0
0

I have been trying to implement the cylindrical animation to the horizontal listview to achieve the iCarousel cylindrical effect.Here is the sample I have tried .

<ContentPage.Resources>
    <ResourceDictionary>
         <xamanimation:StoryBoard 
            x:Key="empListViewAnimation"         
            Target="{x:Reference empListView}">
            <xamanimation:TranslateToAnimation TranslateY="90" Easing="SpringOut" Duration="800" />
        </xamanimation:StoryBoard>
    </ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Triggers>
    <EventTrigger Event="Appearing">
        <xamanimation:BeginAnimation   
            Animation="{StaticResource empListViewAnimation}" />
    </EventTrigger>
</ContentPage.Triggers>
<ContentPage.Content>
    <StackLayout Spacing="0">
        <!-- <xamanimation:StoryBoard x:Key="empListViewAnimation" Target="{x:Reference empListView}">
            <xamanimation:TranslateToAnimation TranslateY="600" Duration="0" />
            <xamanimation:TranslateToAnimation TranslateY="0" Easing="SpringOut" Duration="800" />
        </xamanimation:StoryBoard>-->
        <Controls:HorizontalList  x:Name="empListView"  ListOrientation="Horizontal" HeightRequest="300" BackgroundColor="Transparent" ItemsSource="{Binding}" Margin="10,0,10,0">
            <Controls:HorizontalList.ItemTemplate>
                <DataTemplate>
                    <templates:ServiceItemTemplate />
                </DataTemplate>
            </Controls:HorizontalList.ItemTemplate>
        </Controls:HorizontalList>
    </StackLayout>
</ContentPage.Content>

and this is the service template

<ContentView.Content>
    <Grid>
        <Controls:AnimatedDonutChart x:Name="DonutChart" Percentage="{Binding Percentage}"  StrokeHeight="15" DefaultColor="Gray" ValueColor="Purple" WidthRequest="150" HeightRequest="200" />
    </Grid>
</ContentView.Content>

Is there a package as iCarousel in xamarin forms.

$
0
0

I have been trying to implement the cylindrical animation to the horizontal listview to achieve the iCarousel cylindrical effect.Here is the sample I have tried .

<ContentPage.Resources>
    <ResourceDictionary>
         <xamanimation:StoryBoard 
            x:Key="empListViewAnimation"         
            Target="{x:Reference empListView}">
            <xamanimation:TranslateToAnimation TranslateY="90" Easing="SpringOut" Duration="800" />
        </xamanimation:StoryBoard>
    </ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Triggers>
    <EventTrigger Event="Appearing">
        <xamanimation:BeginAnimation   
            Animation="{StaticResource empListViewAnimation}" />
    </EventTrigger>
</ContentPage.Triggers>
<ContentPage.Content>
    <StackLayout Spacing="0">
        <!-- <xamanimation:StoryBoard x:Key="empListViewAnimation" Target="{x:Reference empListView}">
            <xamanimation:TranslateToAnimation TranslateY="600" Duration="0" />
            <xamanimation:TranslateToAnimation TranslateY="0" Easing="SpringOut" Duration="800" />
        </xamanimation:StoryBoard>-->
        <Controls:HorizontalList  x:Name="empListView"  ListOrientation="Horizontal" HeightRequest="300" BackgroundColor="Transparent" ItemsSource="{Binding}" Margin="10,0,10,0">
            <Controls:HorizontalList.ItemTemplate>
                <DataTemplate>
                    <templates:ServiceItemTemplate />
                </DataTemplate>
            </Controls:HorizontalList.ItemTemplate>
        </Controls:HorizontalList>
    </StackLayout>
</ContentPage.Content>

and this is the service template

<ContentView.Content>
    <Grid>
        <Controls:AnimatedDonutChart x:Name="DonutChart" Percentage="{Binding Percentage}"  StrokeHeight="15" DefaultColor="Gray" ValueColor="Purple" WidthRequest="150" HeightRequest="200" />
    </Grid>
</ContentView.Content>

Disposing ViewCells

$
0
0

Hi,

in my custom ViewCell I have a complex BindableProperty that also has some event handlers. In the propertyChanged and propertyChanging delegates I wire/unwire those event handlers but the unwiring does never happen, which of course leads to memory leaks.
So my idea was to wire in OnAppearing and unwire in OnDisappearing, which doesn't really help either as OnDisappearing isn't called for every cell when I navigate back for example.
What would be a good workaround, or is there anything I can override from the ViewCell that gets called when the cell is disposed? Maybe a reset of the binding context?
(I can't change my ViewModel itself, and also can't remove the event handlers).

Thanks and all the best, Roland

Dynamic fields in listview...suggestion

$
0
0

I am creating a dynamic forms. Basically i have a listview that contains all the possible fields. Based on the data i will only show ONE field type per row.

Question, how do i only show 1 field based on a property called typeid.
eg. typeid=1 Show Label typeid=2 Show Checkbox typeid=3 Show Picker

Is this the best approach acceptable for the moment( i know i can improve it)?


<ListView.ItemTemplate>





Are you looking for a Xamarin Developer?

$
0
0

Dear Mates,

I have 5 years of experience in analysis, design and development of Web and Windows and Mobile based n-tier applications using Microsoft .Net technology.
Programming and Build Technology

• Xamarin Studio ,WCF,Entity Framework, Web API.
• ASP.Net ,MVC 4,5, C#.Net, VB.Net, XML, LINQ
• Geo location, Geo fencing,
• Facebook,Twitter,Instagram,Google+ integration
• Work On .Net Framework 3.5,4.0,4.5

i delivered more than 100 projects successfully.

You can reach me on Skype: cisin.justin or Email:jutindotc@talentsfromindiadotcom

Thanks,
Justin
+14074139057

Gesture not updating its status as completed

$
0
0

I have a PanGestureRecognizer in my custom view. For the PanUpdated event handler, I have a function that does some stuff when the gesture is running and then something else when the gesture is completed. However, sometimes the gesture never gets to its completed state.
Any ideas?

Here's what I have...

        class ImageContainer : ContentView
        {

            public ImageContainer()
            {
                PanGestureRecognizer panGesture = new PanGestureRecognizer();
                panGesture.PanUpdated += OnPanUpdated;
                GestureRecognizers.Add(panGesture);
            }


            void OnPanUpdated(object sender, PanUpdatedEventArgs e)
            {
                switch(e.StatusType)
                {
                            case GestureStatus.Started:
                                // do some stuff
                                break;  
                    case GestureStatus.Running:
                    // do more stuff
                                break;
                            case GestureStatus.Completed:
                                // sometimes this does not get called!
                                break;
                }
            }
        }

Android PanGestureRecognizer jumps back and forth

$
0
0

Hi,

Im trying to do some panning and it works very smooth on iOS but it doesn't on Android. I have the following code:

    ...
    var panGesture = new PanGestureRecognizer();
    panGesture.PanUpdated += PanGesture_PanUpdated;
    handleBar.GestureRecognizers.Add(panGesture);
}

void PanGesture_PanUpdated(object sender, PanUpdatedEventArgs e)
{
        switch (e.StatusType)
        {
            case GestureStatus.Started:
                startX = contentGrid.TranslationX;
                break;

            case GestureStatus.Running:
                contentGrid.TranslationX = startX + e.TotalX;
                Debug.WriteLine($"e.TotalX:{e.TotalX}");
                break;
            }
}

If I swipe from left to right on Android I see this in my logging:

e.TotalX:153,451090494792
e.TotalX:139,719360351563
e.TotalX:157,746846516927
e.TotalX:144,34169514974
e.TotalX:162,310221354167
e.TotalX:149,070007324219
e.TotalX:167,131062825521
e.TotalX:154,131408691406
e.TotalX:172,146565755208
e.TotalX:158,630777994792
e.TotalX:175,341796875
e.TotalX:160,81787109375
e.TotalX:176,309244791667
e.TotalX:161,518229166667

As you can see it jumps back and forth and I see this exact behaviour in the UI on Android. iOS doesn't have this behaviour. Any reason why it jumps like that, and how to fix this?

ListView Grouping

$
0
0

hi,listview grouping help me ..
my function ;
`
public async Task getVoyagesData()
{
voyagesList.Clear();
try
{
var uri = new Uri(url);
HttpClient myClient = new HttpClient();
var response = await myClient.GetAsync(uri);
var content = await response.Content.ReadAsStringAsync();
JObject results = JObject.Parse(content);
var results2 = results["data"];
if (response.IsSuccessStatusCode)
{

                foreach (var i in results2)
                {
                        VoyagesMdl voyDay = new VoyagesMdl();
                        VoyagesMdl voyNight = new VoyagesMdl();


                        string clock;
                        clock = i["time"].Value<string>().Substring(11);
                        int clockker = Convert.ToInt32(clock.Substring(0, 2));

                    if (!(clockker > 18 || clockker < 6))
                    {
                        voyDay.opactiy = "1";
                        voyDay.rectangle_price = "rectangle.png";
                        voyDay.rectangle2_date = "rectangle2.png";
                        voyDay.resim = "day.png";
                        voyDay.textcolor = "Black";

                        if (i["prop_ekran"].Value<bool>())
                            voyDay.prop_ekran_img = "ekrantv_day.png";
                        else
                            voyDay.prop_ekran_img = "null";

                        if (i["prop_ekranmuzik"].Value<bool>())
                            voyDay.prop_ekran_img = "ekranmuzik_day.png";
                        else
                            voyDay.prop_ekran_img = "null";


                        if (i["prop_k21"].Value<bool>())
                            voyDay.koltuktipi = "2+2";
                        else
                            voyDay.koltuktipi = "2+1";

                        voyDay.clock = clock;
                        voyDay.id = i["id"].Value<int>();
                        voyDay.name = i["name"].Value<string>();
                        voyDay.time = i["time"].Value<string>();
                        voyDay.time_description = i["time_description"].Value<string>();
                        voyDay.extra = i["extra"].Value<bool>();
                        voyDay.vehicle_type = i["vehicle_type"].Value<string>();
                        voyDay.list_price = i["list_price"].Value<decimal>();
                        voyDay.price = i["price"].Value<decimal>() + " ₺";
                        voyDay.prop_ekran10 = i["prop_ekran10"].Value<bool>();
                        voyDay.prop_ekrantv = i["prop_ekrantv"].Value<bool>();
                        voyDay.prop_ekranmuzik = i["prop_ekranmuzik"].Value<bool>();
                        voyDay.prop_ekranfm = i["prop_ekranfm"].Value<bool>();
                        voyDay.prop_geneltv = i["prop_geneltv"].Value<bool>();
                        voyDay.prop_cep = i["prop_cep"].Value<bool>();
                        voyDay.prop_usbsarj = i["prop_usbsarj"].Value<bool>();
                        voyDay.prop_v220 = i["prop_v220"].Value<bool>();
                        voyDay.prop_internet = i["prop_internet"].Value<bool>();
                        voyDay.prop_futbol = i["prop_futbol"].Value<bool>();
                        voyDay.prop_wc = i["prop_wc"].Value<bool>();
                        voyDay.prop_kulaklik = i["prop_kulaklik"].Value<bool>();
                        voyDay.prop_express = i["prop_express"].Value<bool>();

                        voyagesListDay.Add(voyDay);
                    }
                    else
                    {
                        voyNight.opactiy = "1";
                        voyNight.rectangle_price = "rectangle_night.png";
                        voyNight.rectangle2_date = "rectangle2_night.png";
                        voyNight.resim = "night.png";
                        voyNight.textcolor = "White";

                        if (i["prop_ekran"].Value<bool>())
                            voyNight.prop_ekran_img = "ekrantv.png";
                        else
                            voyNight.prop_ekran_img = "null";

                        if (i["prop_ekranmuzik"].Value<bool>())
                            voyNight.prop_ekran_img = "ekranmuzik.png";
                        else
                            voyNight.prop_ekran_img = "null";


                        if (i["prop_k21"].Value<bool>())
                            voyNight.koltuktipi = "2+2";
                        else
                            voyNight.koltuktipi = "2+1";

                        voyNight.clock = clock;
                        voyNight.id = i["id"].Value<int>();
                        voyNight.name = i["name"].Value<string>();
                        voyNight.time = i["time"].Value<string>();
                        voyNight.time_description = i["time_description"].Value<string>();
                        voyNight.extra = i["extra"].Value<bool>();
                        voyNight.vehicle_type = i["vehicle_type"].Value<string>();
                        voyNight.list_price = i["list_price"].Value<decimal>();
                        voyNight.price = i["price"].Value<decimal>() + " ₺";
                        voyNight.prop_ekran10 = i["prop_ekran10"].Value<bool>();
                        voyNight.prop_ekrantv = i["prop_ekrantv"].Value<bool>();
                        voyNight.prop_ekranmuzik = i["prop_ekranmuzik"].Value<bool>();
                        voyNight.prop_ekranfm = i["prop_ekranfm"].Value<bool>();
                        voyNight.prop_geneltv = i["prop_geneltv"].Value<bool>();
                        voyNight.prop_cep = i["prop_cep"].Value<bool>();
                        voyNight.prop_usbsarj = i["prop_usbsarj"].Value<bool>();
                        voyNight.prop_v220 = i["prop_v220"].Value<bool>();
                        voyNight.prop_internet = i["prop_internet"].Value<bool>();
                        voyNight.prop_futbol = i["prop_futbol"].Value<bool>();
                        voyNight.prop_wc = i["prop_wc"].Value<bool>();
                        voyNight.prop_kulaklik = i["prop_kulaklik"].Value<bool>();
                        voyNight.prop_express = i["prop_express"].Value<bool>();

                        voyagesListNight.Add(voyNight);
                    }
                }





                var list = new List<VoyagesListGroup>()
                {
                    voyagesListDay,
                    voyagesListNight,
                };


                voyagesListDay.Heading = "test";
                voyagesListNight.Heading = "test";


                ListOfGroupVoyages = list;

                voyagesListview.ItemsSource = null;
                voyagesListview.ItemsSource = ListOfGroupVoyages;



                animationView.IsPlaying = false;
                animationView.Pause();
                animationView.Loop = false;
                animationView.IsEnabled = false;
                animationView.IsVisible = false;
            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex);
        }
    }

my xaml listview :

    <ListView x:Name="voyagesListview"  IsGroupingEnabled="True" 
              HasUnevenRows="True" Grid.Row="4" >

        <ListView.GroupHeaderTemplate>
            <DataTemplate>
                <ViewCell>

                </ViewCell>
            </DataTemplate>
        </ListView.GroupHeaderTemplate>

        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Grid  RowSpacing="0" Opacity="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="35"/>
                            <RowDefinition Height="35"/>
                            <RowDefinition Height="35"/>
                            <RowDefinition Height="1"/>
                        </Grid.RowDefinitions>

                        <Image Source="{Binding resim}" 
                               x:Name="daySource"   
                               Grid.RowSpan="3" Aspect="AspectFill">
                        </Image>

                        <Grid Grid.Row="0" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="70"/>
                            </Grid.ColumnDefinitions>


                            <Image Source="path_black.png"  Grid.Column="0" Margin="10"/>
                            <Label 

                                Text="{Binding koltuktipi}"
                                TextColor="{Binding textcolor}"
                                Grid.Column="1" 
                                VerticalTextAlignment="Center" HorizontalTextAlignment="Start"
                                FontSize="13">
                                <Label.FontFamily>
                                    <OnPlatform x:TypeArguments="x:String">
                                        <On Platform="Android" Value="openlight.ttf#openlight" />
                                        <On Platform="iOS" Value="openlight.ttf#openlight" />
                                    </OnPlatform>
                                </Label.FontFamily>
                            </Label>

                            <Image x:Name="img_path"  Source="path_white.png"   Grid.Column="0" Margin="10"/>
                            <Label 
                                Text="{Binding vehicle_type}"
                                TextColor="{Binding textcolor}"
                                Grid.Column="2" 
                                VerticalOptions="Center" HorizontalOptions="Center"
                                HorizontalTextAlignment="Center"
                                VerticalTextAlignment="Center">
                                <Label.FontFamily>
                                    <OnPlatform x:TypeArguments="x:String">
                                        <On Platform="Android" Value="open.ttf#open" />
                                        <On Platform="iOS" Value="open.ttf#open" />
                                    </OnPlatform>
                                </Label.FontFamily>
                            </Label>
                            <Image Source="{Binding rectangle_price}" Grid.Column="3" Aspect="Fill"/>
                            <Label 
                                Text="{Binding price}"
                                TextColor="White"
                                Grid.Column="3" 
                                VerticalOptions="Center" HorizontalOptions="Center"
                                HorizontalTextAlignment="Center"
                                VerticalTextAlignment="Center">
                                <Label.FontFamily>
                                    <OnPlatform x:TypeArguments="x:String">
                                        <On Platform="Android" Value="constantia.ttf#constantia" />
                                        <On Platform="iOS" Value="constantia.ttf#constantia" />
                                    </OnPlatform>
                                </Label.FontFamily>
                            </Label>
                        </Grid>

                        <Grid Grid.Row="1" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Label 
                                VerticalOptions="Center"
                                HorizontalOptions="Center"
                                VerticalTextAlignment="Center"
                                HorizontalTextAlignment="Center"
                                Text="{Binding name}"
                                Grid.Column="0"
                                TextColor="{Binding textcolor}">
                                <Label.FontFamily>
                                    <OnPlatform x:TypeArguments="x:String">
                                        <On Platform="Android" Value="openbold.ttf#openbold" />
                                        <On Platform="iOS" Value="openbold.ttf#openbold" />
                                    </OnPlatform>
                                </Label.FontFamily>
                            </Label>
                        </Grid>

                        <Grid Grid.Row="2" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="70"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="70"/>
                            </Grid.ColumnDefinitions>
                            <Image  Source="{Binding rectangle2_date}"  Grid.Column="0"  Aspect="Fill" />
                            <Label 
                             x:Name="otobus_saat"
                            Text="{Binding clock}"
                            TextColor="White"
                            FontSize="20"
                            Grid.Column="0"
                            VerticalTextAlignment="Center" HorizontalTextAlignment="Center">
                                <Label.FontFamily>
                                    <OnPlatform x:TypeArguments="x:String">
                                        <On Platform="Android" Value="constantia.ttf#constantia" />
                                        <On Platform="iOS" Value="constantia.ttf#constantia" />
                                    </OnPlatform>
                                </Label.FontFamily>
                            </Label>


                            <Grid Grid.Column="1" Grid.ColumnSpan="2" VerticalOptions="Center" HorizontalOptions="Center">

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Image Source="{Binding prop_ekran_img}" Grid.Column="0" />
                                <Image Source="{Binding prop_ekranmuzik_img}" Grid.Column="1" />
                            </Grid>



                            <Grid Grid.Column="3">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="20" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Image Source="detay.png" Grid.Column="0" />
                                <Label Text="Detaylı Bilgi"
                                       TextColor="{Binding textcolor}"
                                       Grid.Column="1" FontSize="9" VerticalTextAlignment="Center" HorizontalTextAlignment="Start"/>
                            </Grid>
                        </Grid>


                    </Grid>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>


    </ListView>

`

VoyagesListGroup class ;

public class VoyagesListGroup : List<VoyagesMdl> { public string Heading { get; set; } public List<VoyagesMdl> ListOfGroupVoyages => this; }

my VoyagesMdl class ;

` public class VoyagesMdl
{
public string opactiy { get; set; }
public string resim { get; set; }
public string textcolor { get; set; }
public string otobus_tipi { get; set; } //otobus_tipi
public string rectangle_price { get; set; } // paranın olduğu yerin background resmi // gece ,, gündüze göre değişyior
public string rectangle2_date { get; set; } //background
public string clock { get; set; }
public string koltuktipi { get; set; }

    // küçük logolar
    public string prop_ekran_img { get; set; }
    public string prop_ekranmuzik_img { get; set; }



    public int id { get; set; }
    public string name { get; set; }
    public string time { get; set; }
    public string time_description { get; set; }
    public bool extra { get; set; }
    public string vehicle_type { get; set; }
    public decimal list_price { get; set; }
    public string price { get; set; }
    public bool prop_k21 { get; set; }
    public bool prop_ekran { get; set; }
    public bool prop_ekran10 { get; set; }
    public bool prop_ekrantv { get; set; }
    public bool prop_ekranmuzik { get; set; }
    public bool prop_ekranfm { get; set; }
    public bool prop_geneltv { get; set; }
    public bool prop_cep { get; set; }
    public bool prop_usbsarj { get; set; }
    public bool prop_v220 { get; set; }
    public bool prop_internet { get; set; }
    public bool prop_futbol { get; set; }
    public bool prop_wc { get; set; }
    public bool prop_kulaklik { get; set; }
    public bool prop_express { get; set; }

}`

App crashes when built in release but works fine in debug

$
0
0

I am currently running into an issue where my debug build of an app functions just fine but when I build it out in release, the app crashes. Below is the error given. One thing someone suggested was to look at the linking option. I have and both builds are linking sdk assemblies only.

04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): [Error] Exception { Message: "CurrentDomainOnUnhandledException", Data: [], InnerException: RuntimeException { JniPeerMembers: XAPeerMembers { ManagedPeerType: Java.Lang.RuntimeException, JniPeerTypeName: "java/lang/RuntimeException", JniPeerType: JniType { PeerReference: JniObjectReference { Handle: IntPtr { }, Type: Global, IsValid: True } }, InstanceMethods: JniInstanceMethods { }, InstanceFields: JniInstanceFields { }, StaticMethods: JniStaticMethods { }, StaticFields: JniStaticFields { } }, StackTrace: "
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): --- End of managed Java.Lang.RuntimeException stack trace ---
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testco.android.testapp/md52383f3bfe5cb92264ccfe16c72588a4e.MainActivity}: android.content.res.Resources$NotFoundException: File ModernHttpClient.Android from drawable resource ID #0x7f080051: .xml extension required
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.app.ActivityThread.-wrap11(ActivityThread.java)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.os.Handler.dispatchMessage(Handler.java:102)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.os.Looper.loop(Looper.java:148)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.app.ActivityThread.main(ActivityThread.java:5417)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at java.lang.reflect.Method.invoke(Native Method)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): Caused by: android.content.res.Resources$NotFoundException: File ModernHttpClient.Android from drawable resource ID #0x7f080051: .xml extension required
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.content.res.Resources.loadColorStateListForCookie(Resources.java:2758)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.content.res.Resources.loadColorStateList(Resources.java:2699)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.content.res.Resources.getColor(Resources.java:976)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.content.Context.getColor(Context.java:441)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.support.v4.content.ContextCompatApi23.getColor(ContextCompatApi23.java:32)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.support.v4.content.ContextCompat.getColor(ContextCompat.java:432)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.support.design.widget.TextInputLayout.setErrorEnabled(TextInputLayout.java:628)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at md52383f3bfe5cb92264ccfe16c72588a4e.MainActivity.n_onCreate(Native Method)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at md52383f3bfe5cb92264ccfe16c72588a4e.MainActivity.onCreate(MainActivity.java:30)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.app.Activity.performCreate(Activity.java:6237)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): ... 9 more
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): ", PeerReference: JniObjectReference { Handle: IntPtr { }, Type: Global, IsValid: True }, Handle: IntPtr { }, LocalizedMessage: "Unable to start activity ComponentInfo{com.testco.android.testapp/md52383f3bfe5cb92264ccfe16c72588a4e.MainActivity}: android.content.res.Resources$NotFoundException: File ModernHttpClient.Android from drawable resource ID #0x7f080051: .xml extension required", Message: "Unable to start activity ComponentInfo{com.testco.android.testapp/md52383f3bfe5cb92264ccfe16c72588a4e.MainActivity}: android.content.res.Resources$NotFoundException: File ModernHttpClient.Android from drawable resource ID #0x7f080051: .xml extension required", Data: [], InnerException: RuntimeException { JniPeerMembers: XAPeerMembers { ManagedPeerType: Java.Lang.RuntimeException, JniPeerTypeName: "java/lang/RuntimeException", JniPeerType: JniType { PeerReference: JniObjectReference { Handle: IntPtr { }, Type: Global, IsValid: True } }, InstanceMethods: JniInstanceMethods { }, InstanceFields: JniInstanceFields { }, StaticMethods: JniStaticMethods { }, StaticFields: JniStaticFields { } }, StackTrace: " at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <4baa936e3c434e3ba112aa790597bb76>:0
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <fc
04-30 11:33:39.799: E/TestApp.Mobile.Droid.MainActivity(3177): --------- beginning of crash
04-30 11:33:39.800: E/AndroidRuntime(3177): FATAL EXCEPTION: main
04-30 11:33:39.800: E/AndroidRuntime(3177): Process: com.testco.android.testapp, PID: 3177
04-30 11:33:39.800: E/AndroidRuntime(3177): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testco.android.testapp/md52383f3bfe5cb92264ccfe16c72588a4e.MainActivity}: android.content.res.Resources$NotFoundException: File ModernHttpClient.Android from drawable resource ID #0x7f080051: .xml extension required
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.app.ActivityThread.-wrap11(ActivityThread.java)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.os.Handler.dispatchMessage(Handler.java:102)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.os.Looper.loop(Looper.java:148)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.app.ActivityThread.main(ActivityThread.java:5417)
04-30 11:33:39.800: E/AndroidRuntime(3177): at java.lang.reflect.Method.invoke(Native Method)
04-30 11:33:39.800: E/AndroidRuntime(3177): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
04-30 11:33:39.800: E/AndroidRuntime(3177): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-30 11:33:39.800: E/AndroidRuntime(3177): Caused by: android.content.res.Resources$NotFoundException: File ModernHttpClient.Android from drawable resource ID #0x7f080051: .xml extension required
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.content.res.Resources.loadColorStateListForCookie(Resources.java:2758)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.content.res.Resources.loadColorStateList(Resources.java:2699)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.content.res.Resources.getColor(Resources.java:976)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.content.Context.getColor(Context.java:441)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.support.v4.content.ContextCompatApi23.getColor(ContextCompatApi23.java:32)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.support.v4.content.ContextCompat.getColor(ContextCompat.java:432)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.support.design.widget.TextInputLayout.setErrorEnabled(TextInputLayout.java:628)
04-30 11:33:39.800: E/AndroidRuntime(3177): at md52383f3bfe5cb92264ccfe16c72588a4e.MainActivity.n_onCreate(Native Method)
04-30 11:33:39.800: E/AndroidRuntime(3177): at md52383f3bfe5cb92264ccfe16c72588a4e.MainActivity.onCreate(MainActivity.java:30)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.app.Activity.performCreate(Activity.java:6237)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
04-30 11:33:39.800: E/AndroidRuntime(3177): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
04-30 11:33:39.800: E/AndroidRuntime(3177): ... 9 more

xamarin ios project LaunchScreen.storyboard shows black screen

$
0
0

Hello, i have tried all the solutions provided in most of the forums.
Basically, i have created a Launchscreen.storyboard and added it in ios project properties in "Launch Storyboard" field and "Main Interface".
Launchscreen story board is simple with one image and two labels.
Below is the list i have checked:

1) made the viewcontroller as "Is Initial View Controller" checked.
2) checked info.plist with "Launch screen interface file base name" to have my "Launchscreen.storyboard" selected.
3) In storyboard document checked "Can be Launch Screen"
3) Deleted app from simulator and re-run simulator many times almost after each change

Did all of the above but stil i get black screen when app launches.

Please help
New to xamarin forms, using visual studio with xamarin on windows and simulator on mac agent.

CarouselView.FormsPlugin not rendering in StackLayout

$
0
0

For some reason, the carousel is not rendering. I reduced this to bare minumum. I have tried this in a page with only the carousel and it works. The label above it shows, but not the carousel. Is there a problem with StackLayout and this control?

<StackLayout x:Name="List" Orientation="Vertical" IsVisible="True">
        <Label Margin="10" FontSize="Large" Text="Houses found..." FontAttributes="Bold" HorizontalOptions="Center" HorizontalTextAlignment="Center"/>
        <car:CarouselViewControl x:Name="propertyCarousel">
            <car:CarouselViewControl.ItemTemplate>
                <DataTemplate>
                    <Label Text="{Binding .}" FontSize="30"/>
                </DataTemplate>
            </car:CarouselViewControl.ItemTemplate>
        </car:CarouselViewControl>
    </StackLayout>

Xam Forms Layout issue

$
0
0

I am attempting to create a very simple page and running into an issue. The projectis xamarin forms. I want the page to dispaly different sections. Each section will have a header. The header must have a background color that stretches from one side to another with no margin or padding. I then want the text inside the header to have a margin so it is not pushed up against the side of the page. I have tried stack panels and grids to no avail. Can anyone show me what I am doing wrong.


Heading 1

content


Heading 2

content


Heading 3

content

Here is my xaml


<Grid.RowDefinitions>




</Grid.RowDefinitions>

                <StackLayout Grid.Row="0" Spacing="0" Padding="0">

                    <StackLayout Spacing="4" Padding="0,0,0,15">
                        <Label Text="Description" HorizontalTextAlignment="Start" BackgroundColor="Silver"  LineBreakMode="NoWrap"/>


                        <Label Text="Details" FontSize="12">
                        </Label>
                    </StackLayout>
                    <StackLayout Spacing="4" Padding="0,0,0,15">
                        <Label Text="Address"  HorizontalTextAlignment="Start" BackgroundColor="Silver" LineBreakMode="NoWrap">
                        </Label>
                        <Label Text="Address Details" FontSize="12">
                        </Label>
                    </StackLayout>

......

How to use a PageRenderer in Xamarin.WPF

$
0
0

There is no section for Xamarin.WPF yet apparently but I need to know how to use a PageRenderer in Xamarin.WPF. I have a ContentPage in my Xamarin.Forms PCL and I am using a PageRenderer in my Xamarin.WPF project but I cannot figure out how to set its content. Can anyone please help?


Styling on iOS broke with IDE update

$
0
0

I use VS on Windows and VS for MAC on the MAC for writing my Xamarin forms project.

Everything was working fine until the VS for MAC IDE told me there was a bunch of updates which I installed and they seem to have broken the styles on iOS.

XAML Code

<ContentPage.Content>
    <StackLayout>
        <Button Text="Logout" Clicked="Logout_Clicked" Style="{StaticResource DeleteButton}" />
        <Button Text="Test" Clicked="Logout_Clicked" BackgroundColor="Black" TextColor="White" />
        <Button Text="Login" Clicked="Login_Clicked" Style="{DynamicResource DefaultButton}" />
    </StackLayout>
</ContentPage.Content>

The resulting images on both simulators are attached.

These are the 2 styles that are set in the Resource Dictionary of the App.xaml file

<Style x:Key="DefaultButton" TargetType="Button">
            <Setter Property="HorizontalOptions" Value="FillAndExpand" />
            <Setter Property="VerticalOptions" Value="FillAndExpand" />
            <Setter Property="TextColor" Value="White" />
            <Setter Property="BackgroundColor" Value="Black" />
</Style>
<Style x:Key="DeleteButton" TargetType="Button">
            <Setter Property="HorizontalOptions" Value="FillAndExpand" />
            <Setter Property="VerticalOptions" Value="FillAndExpand" />
            <Setter Property="TextColor" Value="White" />
            <Setter Property="BackgroundColor" Value="Red" />
</Style> 

Anyone encountered this and know how to work around it?

My Mac is running Sierra 10.13.4 and the IDE version is 7.5.1 (build 22)

Binding to Custom Behavior Bindable Property in XAML

$
0
0

I'm trying to follow along with the information here about making a custom max length behavior: https://xamarinhelp.com/xamarin-forms-triggers-behaviors-effects/

public class MaxLengthCheckValidator: Behavior<Entry>
{

    public static readonly BindableProperty IsValidProperty = BindableProperty.Create("IsValid", typeof(bool), typeof(MaxLengthCheckValidator), false);
    public static readonly BindableProperty MaxLengthProperty = BindableProperty.Create("MaxLength", typeof(int), typeof(MaxLengthCheckValidator), 0);

    public int MaxLength
    {
       get { return (int)GetValue(MaxLengthProperty); }
       set { SetValue(MaxLengthProperty, value); }
    }

    public bool IsValid
    {
       get { return (bool)GetValue(IsValidProperty); }
       set { SetValue(IsValidProperty, value); }
    }

    protected override void OnAttachedTo(Entry bindable)
    {
       bindable.TextChanged += bindable_TextChanged;
    }

    private void bindable_TextChanged(object sender, TextChangedEventArgs e)
    {
       IsValid = e.NewTextValue?.Length >= MinLength;
    }

    protected override void OnDetachingFrom(Entry bindable)
    {
       bindable.TextChanged -= bindable_TextChanged;
    }
 }

But I'm kind of confused about how to bind to the new BindableProperty in XAML.

    // Add to Page attributes
    xmlns:behavior="clr-namespace:Mobile.Behavior"

<Entry Text="{Binding EntryField}">
    <Entry.Behaviors>
        <behavior:MaxLengthCheckValidator MaxLength="10" IsValid="{Binding Source={x:Reference this}, BindingContext.IsUsernameValid, Mode=OneWayToSource}" />
    </Entry.Behaviors>
</Entry>

I don't understand the part about the IsValid binding.

I am new to Xamarin.Forms and I'm still struggling with bindings a bit, and this is confusing me - it looks to me like maybe it's connecting with the entry text field in the source (with "x:Reference this"), but what is the "BindingContext.IsUsernameValid" supposed to represent?

I thought the BindingContext is the parent object and the binding should connect to the property/child of that object, but I don't understand how it's being used here with a behavior - what is that object supposed to be? There's no complete sample in GitHub, so I can't tell if that was supposed to be the "IsValid" property instead (there are other errors in here - see ">= MinLength"), or if I'm missing part of the code, or what.

I could use some help figuring out the correct structure of the binding and would really appreciate some clarification.

StackLayout width larger that display width

$
0
0

Hi all!
I need to have a StackLayout or Grid with a width larger that device width.

<StackLayout x:Name="slParent" 
                 Orientation="Horizontal" 
                 HorizontalOptions="FillAndExpand"
                 VerticalOptions="FillAndExpand"
                 BackgroundColor="Red" >
<StackLayout x:Name="slOne" 
                     Orientation="Vertical" 
                     BackgroundColor="Yellow" 
                     WidthRequest="300" />
<StackLayout x:Name="slTwo" 
                     Orientation="Vertical" 
                     BackgroundColor="Orange" 
                     WidthRequest="300" />
</StackLayout>

slTwo is beyond visible area, but width of slParent is equal to the width of the screen.
I tried to use Grid instead of StackLayout but i had the same result.
What do i do wrong?

Service Stop and Restart Alone

$
0
0

Well Before than nothing i want say that I don't speak English very well, sorry if I write anything wrong..

Well My problem is the next, i am working with a services, want a timer that count the time that my app is working, I created a Service of this form:

And this is the task that i want to do:

when i run the app the service execute correctly, and the process too, and if I close the app all continue working fine.

Past a few time how 40 seconds or less with the app closed the process stopped. The Service continue but the process not.

In knows that the problem is with this:

But with 'ContinuationMask' is the unique form that i can get the process executing, With NotSticky, RedeliverIntent, Sticky or StickyCompatibility, I can't get the object of the process executting in the Service.

I Don't know what to do..

How to find the cause of: Xamarin.Forms targets have been imported multiple times

$
0
0

I'm working my way thru the book "Creating Mobile Apps with Xamarin Forms" and a lot of the sample code requires some work to get it running, which is all very educational and helps me learn and remember. However I can't find the cause of this one;
Chapter 20, MandelbrotProgress, gives me an error in the Xamarin.Formsbook.Toolkit project:

Xamarin.Forms targets have been imported multiple times. Please check your project file and remove the duplicate import(s).

Can somebody point me at the root cause of this please. I cannot find any obvious duplicates in the project file, but there are some error conditions defined in there which I am suspicious of.

Also, is there a specific forum or support area for the above mentioned book?

Viewing all 91519 articles
Browse latest View live


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