Git Product home page Git Product logo

corcav.behaviors's People

Contributors

biste5 avatar corcav avatar corradocavalli avatar persalmi avatar snickler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

corcav.behaviors's Issues

TextCell MenuItem

Hi, it's possible possible event to command in TextCell MenuItem? Look my sample below


<TextCell Text="{Binding Product}" Detail="{Binding Detail}" TextColor="Blue">
                        <TextCell.ContextActions>
                            <MenuItem Text="Remover" IsDestructive="true" >
                                <behaviors:Interaction.Behaviors>
                                    <behaviors:BehaviorCollection>
                                        <behaviors:EventToCommand CommandNameContext="behaviors:RelativeContext Products}"
                                                                EventName="Clicked"
                                                                CommandName="RemoverItemPedidoCommand"
                                                                CommandParameter="{Binding Id}" />
                                    </behaviors:BehaviorCollection>
                                </behaviors:Interaction.Behaviors>
                            </MenuItem>                            
                        </TextCell.ContextActions>
</TextCell>

CurrentPageChanged event crashed the XF app

Hi @corcav

I have Tabbed page in my XF app

And If I attach behavior to CurrentPageChanged event, then my app at starting is crashes

See image with error below:

image

this is my xaml of tabbed page:

<TabbedPage  xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:views="clr-namespace:merchandise_app.Views;assembly=merchandise_app"
    xmlns:mvvm="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
    xmlns:behaviors="clr-namespace:Corcav.Behaviors;assembly=Corcav.Behaviors"
    x:Class="merchandise_app.Views.MasterDetail">
  <behaviors:Interaction.Behaviors>
    <behaviors:BehaviorCollection>
      <behaviors:EventToCommand EventName="CurrentPageChanged"  Command="{Binding NavigateCommand}" CommandParameter="PageChanged" />
    </behaviors:BehaviorCollection>
  </behaviors:Interaction.Behaviors>

EventToCommand EventName="TextChanged" crashes the application

See https://github.com/oskaremil/Corcav.Behaviors/commit/285e871e65cdce6faaec9dfc61a0e9b660694b2b

I made a small alteration in your Demo project

  1. Bind First Name Entry to FirstName property
  2. Changed the second EventToCommand to the controls TextChanged event
  3. Run

As firstName is set when the ViewModel is loaded, it will trigger the TextChanged event when the context is updated. That will cause an exception to be thrown:

09-01 15:16:32.435 I/MonoDroid(29060): UNHANDLED EXCEPTION:
09-01 15:16:32.437 I/MonoDroid(29060): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: No command available, Is Command properly properly set up?
09-01 15:16:32.437 I/MonoDroid(29060): at Corcav.Behaviors.EventToCommand.OnFired () <IL 0x0002d, 0x000db>
09-01 15:16:32.437 I/MonoDroid(29060): at (wrapper dynamic-method) object.lambda_method (System.Runtime.CompilerServices.Closure,object,Xamarin.Forms.TextChangedEventArgs) <IL 0x0000d, 0x0003f>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Entry.OnTextChanged (Xamarin.Forms.BindableObject,object,object) <IL 0x00027, 0x000f2>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty,Xamarin.Forms.BindableObject/BindablePropertyContext,object,bool,Xamarin.Forms.BindableObject/SetValueFlags,bool) <IL 0x00115, 0x004c1>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty,object,Xamarin.Forms.BindableObject/SetValueFlags,Xamarin.Forms.BindableObject/SetValuePrivateFlags) <IL 0x0016d, 0x0066b>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindingExpression.ApplyCore (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty,bool) <IL 0x00213, 0x00ab7>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindingExpression.Apply (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty) <IL 0x0007a, 0x002bf>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Binding.Apply (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty) <IL 0x0004b, 0x001ab>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.ApplyBindings (object,bool) <IL 0x00042, 0x0011b>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.ApplyBindings (object) <IL 0x00003, 0x00033>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject,object) <IL 0x00061, 0x001a3>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Element.OnBindingContextChanged () <IL 0x00018, 0x0009b>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.View.OnBindingContextChanged () <IL 0x0003b, 0x0017b>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject,object) <IL 0x00067, 0x001bb>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Element.set_Parent (Xamarin.Forms.Element) <IL 0x0006f, 0x00257>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element) <IL 0x00002, 0x00033>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Page.OnInternalAdded (Xamarin.Forms.VisualElement) <IL 0x00015, 0x000a6>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Page.InternalChildrenOnCollectionChanged (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs) <IL 0x00061, 0x00247>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs) <0x0007b>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction,object,int) <0x00083>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.InsertItem (int,Xamarin.Forms.Element) <0x000cb>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Collections.ObjectModel.Collection`1<Xamarin.Forms.Element>.Add (Xamarin.Forms.Element) <0x000c3>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.ContentPage.set_Content (Xamarin.Forms.View) <IL 0x0004a, 0x00127>
09-01 15:16:32.437 I/MonoDroid(29060): at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0x00012>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x0004a, 0x0017f>
09-01 15:16:32.437 I/MonoDroid(29060):   --- End of inner exception stack trace ---
09-01 15:16:32.437 I/MonoDroid(29060):   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00062] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, XmlName propertyName, System.Object value, Xamarin.Forms.BindableObject rootElement, INode node, Xamarin.Forms.Xaml.HydratationContext context, IXmlLineInfo lineInfo) [0x003e7] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x00215] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x000b5] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at Xamarin.Forms.Xaml.RootNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00067] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.String xaml) [0x000cd] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.Type callingType) [0x0002b] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[Settings] (Foo.BasMobile.Client.Views.Login.Settings view, System.Type callingType) [0x00000] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at Foo.BasMobile.Client.Views.Login.Settings.InitializeComponent () [0x00001] in C:\Workspace\Foo-Basmobile-client\Foo.BasMobile.Client\Foo.BasMobile.Client\obj\Debug\Foo.BasMobile.Client.Views.Login.Settings.xaml.g.cs:21 
09-01 15:16:32.437 I/MonoDroid(29060):   at Foo.BasMobile.Client.Views.Login.Settings..ctor () [0x00014] in C:\Workspace\Foo-Basmobile-client\Foo.BasMobile.Client\Foo.BasMobile.Client\Views\Login\Settings.xaml.cs:11 
09-01 15:16:32.437 I/MonoDroid(29060):   at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
09-01 15:16:32.437 I/MonoDroid(29060):   at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   --- End of inner exception stack trace ---
09-01 15:16:32.437 I/MonoDroid(29060):   at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x0001c] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x000af] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
09-01 15:16:32.437 I/MonoDroid(29060):   at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x0018b] in <filename unknown>:0 
09-01 15:16:32.442 W/art     (29060): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
09-01 15:16:32.443 D/AndroidRuntime(29060): Shutting down VM
An unhandled exception occured.

EventName values

I am attempting to use put cannot find all the available values for EventName property. ItemTapped appears to be the ONLY one that I can get to work. MouseClick and MouseDoubleClick do not work and cannot find a list ... anyone help?

Brad

Is there a way to pass along the EventArgs?

I would like to hook into the ListView ItemAppearing event, but I need access to the Item property of the ItemVisibilityEventArgs to know which item is appearing. Is there a way to pass that along to the command?

UWP Support

I believe we will need UWP support for Corcav.Behaviors. I'm attempting to add a UWP project to my existing Xamarin Forms solution and this is one of the NuGet packages that doesn't support it yet.

Output from VS:

Corcav.Behaviors 2.2.0 is not compatible with UAP,Version=v10.0.
Some packages are not compatible with UAP,Version=v10.0.
Corcav.Behaviors 2.2.0 is not compatible with UAP,Version=v10.0 (win10-arm).
Some packages are not compatible with UAP,Version=v10.0 (win10-arm).
Corcav.Behaviors 2.2.0 is not compatible with UAP,Version=v10.0 (win10-arm-aot).
Some packages are not compatible with UAP,Version=v10.0 (win10-arm-aot).
Corcav.Behaviors 2.2.0 is not compatible with UAP,Version=v10.0 (win10-x64).
Some packages are not compatible with UAP,Version=v10.0 (win10-x64).
Corcav.Behaviors 2.2.0 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
Some packages are not compatible with UAP,Version=v10.0 (win10-x64-aot).
Corcav.Behaviors 2.2.0 is not compatible with UAP,Version=v10.0 (win10-x86).
Some packages are not compatible with UAP,Version=v10.0 (win10-x86).
Corcav.Behaviors 2.2.0 is not compatible with UAP,Version=v10.0 (win10-x86-aot).
Some packages are not compatible with UAP,Version=v10.0 (win10-x86-aot).

argument exception adding behavior

Hi, I have a ViewModel based on MvvmLight ViewModelBase: In this viewmodel I have a list of objects and I need to call a method in the view model passing as parameter a value from the object in the list, just like in the demo, but when I set the CommandNameContext this way

CommandNameContext="{behaviors:RelativeContext MainContentPage}"
I obtain this error message.
System.ArgumentException: serviceProvider does not provide an IRootObjectProvider
Am I missing something?

No Property of name Interaction.Behaviors found

I tried a basic implementation of the EventToCommand.

Using VS2015, Xamarin.Forms 1.4.4.6392 (installed in PCL and platform-specific projects) and Corcav.Behaviors 2.0.0 (installed in PCL and platform-specific projects) I have this xaml:

<?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:login="clr-namespace:Client.ViewModels.Login;assembly=Client"
             xmlns:b="clr-namespace:Corcav.Behaviors;assembly=Corcav.Behaviors"
             x:Class="Client.Views.Login.Settings">
    <ContentPage.BindingContext>
        <login:SettingsViewModel/>
    </ContentPage.BindingContext>
    <b:Interaction.Behaviors>
      <b:EventToCommand EventName="Disappearing" Command="{Binding SaveCommand}"/>
    </b:Interaction.Behaviors>

    <StackLayout Orientation="Vertical">
        <!-- -->
    </StackLayout>

</ContentPage>

There seems to be a missing link somewhere...The project compiles but crashes when the application window is opening.

Exception from Windows Phone project:

Position 11:8. No Property of name Interaction.Behaviors found
   at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue(Object xamlelement, XmlName propertyName, Object value, BindableObject rootElement, INode node, HydratationContext context, IXmlLineInfo lineInfo)
   at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit(ElementNode node, INode parentNode)
   at Xamarin.Forms.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
   at Xamarin.Forms.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
   at Xamarin.Forms.Xaml.XamlLoader.Load(BindableObject view, String xaml)
   at Xamarin.Forms.Xaml.XamlLoader.Load(BindableObject view, Type callingType)
   at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TView](TView view, Type callingType)
   at Client.Views.Login.Settings.InitializeComponent()
   at Client.Views.Login.Settings..ctor()

A similar error when I start the Android project:

08-31 21:28:10.833 I/MonoDroid( 1829): UNHANDLED EXCEPTION:
08-31 21:28:10.835 I/MonoDroid( 1829): Xamarin.Forms.Xaml.XamlParseException: Position 11:8. No Property of name Interaction.Behaviors found
08-31 21:28:10.835 I/MonoDroid( 1829):   at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, XmlName propertyName, System.Object value, Xamarin.Forms.BindableObject rootElement, INode node, Xamarin.Forms.Xaml.HydratationContext context, IXmlLineInfo lineInfo) [0x004fc] in <filename unknown>:0 
08-31 21:28:10.835 I/MonoDroid( 1829):   at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x000cb] in <filename unknown>:0 
08-31 21:28:10.835 I/MonoDroid( 1829):   at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x000b5] in <filename unknown>:0 
08-31 21:28:10.835 I/MonoDroid( 1829):   at Xamarin.Forms.Xaml.RootNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00030] in <filename unknown>:0 
08-31 21:28:10.835 I/MonoDroid( 1829):   at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.String xaml) [0x000cd] in <filename unknown>:0 
08-31 21:28:10.835 I/MonoDroid( 1829):   at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.Type callingType) [0x0002b] in <filename unknown>:0 
08-31 21:28:10.835 I/MonoDroid( 1829):   at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[Settings] (Client.Views.Login.Settings view, System.Type callingType) [0x00000] in <filename unknown>:0 
08-31 21:28:10.835 I/MonoDroid( 1829):   at Client.Views.Login.Settings.InitializeComponent () [0x00001] in C:\Workspace\-client\Client\Client\obj\Debug\Client.Views.Login.Settings.xaml.g.cs:27 
08-31 21:28:10.835 I/MonoDroid( 1829):   at Client.Views.Login.Settings..ctor () [0x00008] in C:\Workspace\-client\Client\Client\Views\Login\Settings.xaml.cs:12 
08-31 21:28:10.835 I/MonoDroid( 1829):   at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
08-31 21:28:10.835 I/MonoDroid( 1829):   at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <filename unknown>:0 
08-31 21:28:10.838 W/art     ( 1829): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
08-31 21:28:10.838 D/AndroidRuntime( 1829): Shutting down VM

Updated Xamarin and Xamarin.Forms and now it's broken :(

I updated to Xamarin 4.2.1.73 today and Xamarin.Forms 2.3.3.175

And now I get this error:
Xamarin.Forms.Xaml.XamlParseException: Position 10:8. Type b:EventToCommand not found in xmlns clr-namespace:Corcav.Behaviors;assembly=Corcav.Behaviors

Documentation

I'd suggest adding a little more documentation to the ReadMe. It took me a while to figure out that my Forms PCL and my Android and iOS projects all need to reference the nuget package, not just the PCL.

The code examples are nice, though! Thanks for writing this!

EventToCommand.cs

if (this.Command == null)
throw new InvalidOperationException("No command available, Is Command properly set up?");

this crashes an application that uses late binding.
this should just be:
if (this.Command != null && (this.Command.CanExecute(returnParam))
{
this.Command.Execute(returnParam);
}
Application then actually works. And so does the behavior. RelativeContext doesn't help because it has no idea what viewmodel you'll be binding to

License

What license does Corcav.Behaviors use? I cannot find any license information here or on NuGet.

It is possible to add Behaviors to a Content Page ?

The ICommand is available in the BindingContext, SettingsViewModel

If I do this:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:login="clr-namespace:Reknes.WmsMobile.Client.ViewModels.Login;assembly=Reknes.WmsMobile.Client"
             xmlns:b="clr-namespace:Corcav.Behaviors;assembly=Corcav.Behaviors"
             x:Class="Reknes.WmsMobile.Client.Views.Login.Settings">
    <ContentPage.BindingContext>
        <login:SettingsViewModel />
    </ContentPage.BindingContext>

    <b:Interaction.Behaviors>
        <b:BehaviorCollection>
            <b:EventToCommand EventName="Disappearing" Command="{Binding SaveCommand}" />
        </b:BehaviorCollection>
    </b:Interaction.Behaviors>  

</ContentPage>

I get an exception, the command can not be found. The exception is thrown from https://github.com/corradocavalli/Xamarin.Forms.Behaviors/blob/master/Xamarin.Behaviors/Library/EventToCommand.cs:134 :

09-01 12:24:03.578 I/MonoDroid( 2971): UNHANDLED EXCEPTION:
09-01 12:24:03.578 I/MonoDroid( 2971): System.InvalidOperationException: No command available, Is Command properly properly set up?
09-01 12:24:03.578 I/MonoDroid( 2971): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x0004b>
09-01 12:24:03.578 I/MonoDroid( 2971): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr) [0x00083] in /Users/builder/data/lanes/2058/96592261/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1010
09-01 12:24:03.578 I/MonoDroid( 2971): at Android.Views.ViewGroup.RemoveAllViews () [0x00058] in /Users/builder/data/lanes/2058/96592261/source/monodroid/src/Mono.Android/platforms/android-22/src/generated/Android.Views.ViewGroup.cs:4526
09-01 12:24:03.578 I/MonoDroid( 2971): at Xamarin.Forms.Platform.Android.TabbedRenderer.SwitchContent (Xamarin.Forms.Page) <IL 0x0000d, 0x0005e>
09-01 12:24:03.578 I/MonoDroid( 2971): at Xamarin.Forms.Platform.Android.TabbedRenderer.OnElementPropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00026, 0x000ba>
09-01 12:24:03.578 I/MonoDroid( 2971): at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0004c, 0x000a2>
09-01 12:24:03.578 I/MonoDroid( 2971): at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0002f, 0x00066>
09-01 12:24:03.578 I/MonoDroid( 2971): at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0002f, 0x00066>
09-01 12:24:03.578 I/MonoDroid( 2971): at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0002f, 0x00066>
09-01 12:24:03.578 I/MonoDroid( 2971): at Xamarin.Forms.BindableObject.OnPropertyChanged (string) <IL 0x00012, 0x00090>
09-01 12:24:03.578 I/MonoDroid( 2971): at Xamarin.Forms.MultiPage`1<Xamarin.Forms.Page>.OnPropertyChanged (string) <0x00327>
09-01 12:24:03.578 I/MonoDroid( 2971): at Xamarin.Forms.MultiPage`1<Xamarin.Forms.Page>.set_CurrentPage (Xamarin.Forms.Page) <0x000a9>
09-01 12:24:03.578 I/MonoDroid( 2971): at Xamarin.Forms.Platform.Android.Platform/<>c__DisplayClass7.<AddTab>b__5 (object,Android.App.ActionBar/TabEventArgs) <IL 0x00019, 0x0004b>
09-01 12:24:03.578 I/MonoDroid( 2971): at Android.App.TabEventDispatcher.OnTabSelected (Android.App.ActionBar/Tab,Android.App.FragmentTransaction) [0x0000d] in /Users/builder/data/lanes/2058/96592261/source/monodroid/src/Mono.Android/src/Android.App/ActionBar.cs:89
09-01 12:24:03.578 I/MonoDroid( 2971): at Android.App.ActionBar/ITabListenerInvoker.n_OnTabSelected_Landroid_app_ActionBar_Tab_Landroid_app_FragmentTransaction_ (intptr,intptr,intptr,intptr) [0x00019] in /Users/builder/data/lanes/2058/96592261/source/monodroid/src/Mono.Android/platforms/android-22/src/generated/Android.App.ActionBar.cs:1318
09-01 12:24:03.578 I/MonoDroid( 2971): at (wrapper dynamic-method) object.51c22026-9565-40f7-bf2c-e47504747e4e (intptr,intptr,intptr,intptr) <IL 0x0001d, 0x00033>
09-01 12:24:03.579 D/AndroidRuntime( 2971): Shutting down VM
An unhandled exception occured.

If I do this:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:login="clr-namespace:Foo.BarMobile.Client.ViewModels.Login;assembly=Foo.BarMobile.Client"
             xmlns:b="clr-namespace:Corcav.Behaviors;assembly=Corcav.Behaviors"
             x:Class="Foo.BarMobile.Client.Views.Login.Settings">
    <ContentPage.BindingContext>
        <login:SettingsViewModel />
    </ContentPage.BindingContext>
    <ContentPage.Behaviors>
      <b:Interaction.Behaviors>
        <b:BehaviorCollection>
          <b:EventToCommand EventName="Disappearing" Command="{Binding SaveCommand}" />
        </b:BehaviorCollection>
      </b:Interaction.Behaviors>  
    </ContentPage.Behaviors>

</ContentPage>

I get another exception, this time it seems like it is coming from Xamarin:

09-01 12:31:07.944 I/MonoDroid( 3137): UNHANDLED EXCEPTION:
09-01 12:31:07.946 I/MonoDroid( 3137): Xamarin.Forms.Xaml.XamlParseException: Position 12:8. Type b:Interaction.Behaviors not found in xmlns clr-namespace:Corcav.Behaviors;assembly=Corcav.Behaviors
09-01 12:31:07.946 I/MonoDroid( 3137):   at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x0003e] in <filename unknown>:0 
09-01 12:31:07.946 I/MonoDroid( 3137):   at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x000b5] in <filename unknown>:0 
09-01 12:31:07.946 I/MonoDroid( 3137):   at Xamarin.Forms.Xaml.RootNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00030] in <filename unknown>:0 
09-01 12:31:07.946 I/MonoDroid( 3137):   at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.String xaml) [0x000a5] in <filename unknown>:0 
09-01 12:31:07.946 I/MonoDroid( 3137):   at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.Type callingType) [0x0002b] in <filename unknown>:0 
09-01 12:31:07.946 I/MonoDroid( 3137):   at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[Settings] (Foo.BarMobile.Client.Views.Login.Settings view, System.Type callingType) [0x00000] in <filename unknown>:0 
09-01 12:31:07.946 I/MonoDroid( 3137):   at Foo.BarMobile.Client.Views.Login.Settings.InitializeComponent () [0x00001] in C:\Workspace\Foo-Barmobile-client\Foo.BarMobile.Client\Foo.BarMobile.Client\obj\Debug\Foo.BarMobile.Client.Views.Login.Settings.xaml.g.cs:27 
09-01 12:31:07.946 I/MonoDroid( 3137):   at Foo.BarMobile.Client.Views.Login.Settings..ctor () [0x00008] in C:\Workspace\Foo-Barmobile-client\Foo.BarMobile.Client\Foo.BarMobile.Client\Views\Login\Settings.xaml.cs:9 
09-01 12:31:07.946 I/MonoDroid( 3137):   at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
09-01 12:31:07.946 I/MonoDroid( 3137):   at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <filename unknown>:0 
09-01 12:31:07.948 W/art     ( 3137): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
09-01 12:31:07.949 D/AndroidRuntime( 3137): Shutting down VM
An unhandled exception occured.

It is possible to add behaviors to a content page ?

Cannot install in PCL

I am trying to follow the below tutorial, but cannot install Corcav.Behaviors in the Xamarin.Forms PCL project. It is installed in the Tutorial's Github Xamarin PCL project, and I've got it installed for Android and UWP, just not in my PCL. I'm getting the error below. Any ideas?

http://blog.qmatteoq.com/prism-for-xamarin-forms-basic-navigation-and-dependency-injection-part-2/

Severity Code Description Project File Line Suppression State
Error Could not install package 'Corcav.Behaviors 2.3.2'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.