locked
Make AppBar uncloseable RRS feed

  • Question

  • Hi,

    I have an app bar at the top of a page, with a stack panel and theres a few buttons in the stack panel layout in horizontal orientation.

    I have got the app bar sticky and open by default but i require the app bar to appear permanently and not able to be closed.

    The app bar also overlays the first items in the page which i cant have.

    Ideally i would just use the stack panel at the top of the page and not ahve an app bar, however when i just use a stackpanel it compromises the scrolling on the grid on my page and i cant reach objects out of the screen by scrolling.

    here is basic example of the page

    <appbar>

    <StackPanel <button/> <Button/> </StackPanel>

    </appbar>

    <ScrollViewer>

    <Grid>

    //Heaps of objects dynamically created in side grid

    </grid>

    </ScrollViewer>

    Any help appreciated

    cjm

    Thursday, November 7, 2013 3:32 AM

Answers

  • Sure it will. Only the contents of the ScrollViewer will scroll.

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0">
            <AppBarButton />
            <AppBarButton />
        </StackPanel>
        <ScrollViewer Grid.Column="1">
            <Grid>
                <!-- Heaps of objects --!>
            </Grid>
        </ScrollViewer>
    </Grid>
    --Rob

    • Marked as answer by c.j.mcnaught Thursday, November 7, 2013 4:59 AM
    Thursday, November 7, 2013 4:28 AM
    Moderator

All replies

  • Create a Grid with two rows: one for the StackPanel with the "AppBar" and one for the ScrollViewer and the rest of the controls. This will prevent the top stack panel from interfering with the ScrollViewer.

    --Rob

    Thursday, November 7, 2013 4:05 AM
    Moderator
  • i need the stackpanel with the buttons to remain at the top of the screen as i scroll down

    Not sure if this method will achieve that?

    Thursday, November 7, 2013 4:09 AM
  • Hello c.j.mcnaught, 

    for appbar stickly & open by default, add property to your appbar : 

    IsOpen="true" IsSticky="True"

    & for right click, disable right click to your page.

    Thursday, November 7, 2013 4:25 AM
  • Sure it will. Only the contents of the ScrollViewer will scroll.

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0">
            <AppBarButton />
            <AppBarButton />
        </StackPanel>
        <ScrollViewer Grid.Column="1">
            <Grid>
                <!-- Heaps of objects --!>
            </Grid>
        </ScrollViewer>
    </Grid>
    --Rob

    • Marked as answer by c.j.mcnaught Thursday, November 7, 2013 4:59 AM
    Thursday, November 7, 2013 4:28 AM
    Moderator
  • thanks rob i will give it a try and see how we go
    Thursday, November 7, 2013 4:33 AM
  • Initially it didnt not scroll for me because i had Height=Auto in the RowDefinition for the row that contained the scroll viewer
    Thursday, November 7, 2013 4:59 AM