0
votes

I know that in Windows Phone 8.1 we have a new kind of ApplicationBar that comes from the RT framework but I'm developing a Silverlight app and so I have no access to the new bar.

In Windows Phone 8 I used external libs like the Cimbalino Toolit, and now I'm trying to use the same library on 8.1 with no success, even if the author says that the lib is compatible with 8.1.

Here's my simple code (taken from the samples on the lib's site):

...
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:behaviors="clr-namespace:Cimbalino.Toolkit.Behaviors;assembly=Cimbalino.Toolkit"
...

<i:Interaction.Behaviors>
    <behaviors:ApplicationBarBehavior>
        <behaviors:ApplicationBarIconButton Command="{Binding AddItemCommand, Mode=OneTime}" IconUri="/Images/appbar.add.rest.png" Text="add" IsVisible="{Binding IsSelectionDisabled}" />
        <behaviors:ApplicationBarIconButton Command="{Binding EnableSelectionCommand, Mode=OneTime}" IconUri="/Images/appbar.manage.rest.png" Text="select" IsVisible="{Binding IsSelectionDisabled}" />                
    </behaviors:ApplicationBarBehavior>
</i:Interaction.Behaviors>

This works on 8 but it gives this error on 8.1:

Cannot add instance of type 'Cimbalino.Toolkit.Behaviors.ApplicationBarBehavior' to a collection of type 'System.Windows.Interactivity.BehaviorCollection'

Do you have any idea on how to solve this or if there's some kind of alternative to this toolkit?

1
Seems to be working fine to me... I do see a Resharper error showing up, but it builds and runs perfectly both on Emulator and Device!Pedro Lamas
Was there ever any fix on this? @PedroLamas (awesome work by the way, in general) doesn't see an issue, but I'm running into this problem with my WP8.0 (SL) App on version 1.24. The Phone Toolkit from last year works fine, but binding the Appbar as a commandparameter sparks an infinite loop. Was hoping this was fixed but I can't even ruin due to the above error.Poken1151
@PedroLamas I am also seeing this error. Any ideas on a solution? Thanks!Gary Ewan Park
@GaryEwanPark I know you already fixed this but for just whoever has this type of issue: try attaching the behavior to the Page and not on the LayoutRoot element! :)Pedro Lamas

1 Answers

0
votes

Using the code in you XMAL like:

<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
    <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
    <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
    <shell:ApplicationBar.MenuItems>
        <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
        <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
    </shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>

Good Luck!