WinRT AppBar button message attaching not works when open first time

Topics: Actions & Coroutines, Bugs
May 29, 2013 at 8:00 PM
Hello.
First, thanks to all folks who developed such nice library. You ROCK!
So here is my question.
On page I have AppBar defined like this:
<Page.BottomAppBar>
        <AppBar x:Name="BottomAppBar">
            <Grid HorizontalAlignment="Right" >
                <local:AppBarView Caliburn:Bind.Model="{Binding AppBarViewModel}" />
            </Grid>
        </AppBar>
    </Page.BottomAppBar>


*** AppBarView ***
    <StackPanel Orientation="Horizontal">
        <Button Name="Play"  Style="{StaticResource PlayAppBarButtonStyle}" />
    </StackPanel>
In AppBarViewModel I have method called PLAY

So First time I open my appbar button handler not called. But if I hide appbar and open again, button will work well.
Not sure why this happens.
Could you please help me?
May 30, 2013 at 4:12 AM
My guess would be a function of mixing viewmodel first with view-first? And the initialization of the viewmodel isn't happen correctly.
May 30, 2013 at 8:12 PM
Hello, thank you for response.

I use ShellView as Master, and change ActiveItem in it.
So on page I have next hierarchy:
ShellView -> StartView -> AppBarView.
In StartView I have ViewModel for AppBar. It set's correct (not null), but binding to appbar still not works first time.
After reopen all works as well.

May be you can provide simple example of app with separate viewmodel for appbar. It would be very helpful.
Thank you.