I am working on a Windows Phone app and I have encountered an "issue". I have a BottomAppBar control on my View and some AppBarButton controls inside the command bar. I would like to "hide" the BottomAppBar in such way that only those three dots on the right side are displayed and the user would have to slide the BottomAppBar control up to see its contents.
I have tried to:
Set the IsOpen property of the CommandBar to False - didn't work
Set all the AppBarButton controls visibility to Collapsed - showed only the empty BottomAppBar
I am not very good at explaining myself, therefore I will add a couple of images from another app on my phone, just to show exactly what I would like to obtain:
you can set the ClosedDisplayMode=Minimal
<Page.BottomAppBar>
<CommandBar ClosedDisplayMode="Minimal">
<CommandBar.SecondaryCommands>
<AppBarButton IsCompact="True" Label="About"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
Related
I don't know if I'm missing something but I doubt it, and to me it looks more like a bug, but I thought I'd check here first just in case.
This is the code I have:
<Page.BottomAppBar>
<CommandBar x:Name="bottomAppBar"
Background="{ThemeResource SystemControlBackgroundAccentBrush}"
Visibility="Collapsed"
IsOpen="False"
ClosedDisplayMode="Compact"
IsSticky="False">
<AppBarButton x:Name="btnSearch" Label="Search"
Icon="Find" Foreground="White" />
</CommandBar>
</Page.BottomAppBar>
When displayed in portrait mode on my phone, it always shows the command bar and when I rotate my phone (landscape), it hides it ok.
Strangely enough the XAML Editor always shows the command bar, no matter what orientation the editor is set to.
This problem occurs on both the emulator and the actual phone.
I haven't tried it via code-behind yet as I'm using MVVM and I'd like to bind a property to the Visibility or the IsOpen properties but will try it later and if required, I will but hopefully, it won't come down to this.
Any ideas?
Thanks.
Thierry
I tested this code in the Windows 10 Mobile emulator build 10586. The command bar is not display in portrait and landscape.
In the Internet Explorer App, there is a little bar on the bottom that is used to open the app/command bar.
It also shows up in the mail app:
I have just a simple CommandBar at the moment, which is completely hidden until the user right-clicks or swipes from the bottom:
<Page.BottomAppBar>
<CommandBar>
<AppBarButton x:Name="Button_Save" Icon="Save" Label="Save" Click="Button_Save_Click"/>
<CommandBar.SecondaryCommands>
<AppBarButton Icon="Crop" Label="Canvas Size"></AppBarButton>
<AppBarButton Label="Grid Size" Icon="ViewAll"></AppBarButton>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
Rather than just creating my own control, it would be nice if there was one that already existed for me to use. I don't know the name of this "Command bar grip" so I cant seem to find much information on it. If it does exist, what's the name of it? And if not, any ideas on how to make one? I would probably just use a rectangle and add the little "..." on the side.
I have seen it in some apps apart from Microsoft, but there appears to be no information on the control.
There isn't a standard control for this. The in-box AppBar on Windows 8.1 either hides or shows and doesn't have an intermediate hint mode.
You can implement it yourself by creating a panel at the bottom of the page animating its position so it is either fully visible or shows only the ellipses. This can be done fairly easily by setting visual states for the visible and hinting states and switching to the visible state when the control receives focus or pointer input. As Robert Hartley suggests, the ellipses can be found in the Segoe UI Symbol font at 0xE10C ("More")
<TextBlock Text="" HorizontalAlignment="Right" VerticalAlignment="Top" FontFamily="Segoe UI Symbol"/>
I haven't used it, but Dave Smits provided a sample AppBarHint control which implements a hinting app bar for Windows. You might want to take a look at how he did that too.
I have a very simple Windows Phone 8.1 app. This app has two screens, and for simplicity's sake and because I have some common functions, I've implemented both of these screens within MainPage.xaml. I want to bind the visibility of the AppBar buttons to these screens / panels. Here's what I tried
<Page.BottomAppBar>
<CommandBar>
<CommandBar.PrimaryCommands>
<AppBarButton Icon="Add" IsCompact="False" Visibility="{Binding ElementName=ViewItemsPanel, Path=Visibility}" Label="Add" Click="AddButton_Click" />
<AppBarButton Icon="Cancel" IsCompact="False" Visibility="{Binding ElementName=EditItemPanel, Path=Visibility}" Label="Cancel" Click="CancelButton_Click" />
<AppBarButton Icon="Save" IsCompact="False" Visibility="{Binding ElementName=EditItemPanel, Path=Visibility}" Label="Save" Click="SaveButton_Click" />
</CommandBar.PrimaryCommands>
<CommandBar.SecondaryCommands>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
Unfortunately this doesn't work - all three buttons are visible on both screens. I could create a dynamic property in code-behind for each of these but I thought there might be a nice elegant way to do something like this - is it possible?
The AppBar isn't in the same namespace as the page and so the bindings to the page's elements resolve. This is the case for any binding of the AppBar to the page.
You can set the AppBar's DataContext to the page in the page Loaded event and then bind to properties on the page.
you could create a grid panel to mimic the app bar, name the grid drop the app bar buttons in it and collapse or make visible as needed. Might not be the most elegant way to do it but it will get the job done.
You can create several app bars in your code behind and set the ApplicationBar property of you page to the appbar you like to display.
I used this solution in a pivot view with 3 pages
var applicationBars = new List<Microsoft.Phone.Shell.ApplicationBar>();
private void MainPivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch (mainPivot.SelectedIndex)
{
case 0: ApplicationBar = applicationBars[0]; break;
case 1: ApplicationBar = applicationBars[1]; break;
case 2: ApplicationBar = applicationBars[2]; break;
...
}
}
I have been trying to create buttons on Windows Phone 8, which don't look like buttons, but just look like text, however, I haven't been able to find this question answered anywhere else. I am trying to create something like what Microsoft have used below for the camera roll, albums and date buttons below. Is anybody able to explain how I can do this, or maybe link me to a tutorial or something that I may have missed while searching? Thank you.
Windows phone uses XAML code to create UIElements. Very similar to WPF, you can use almost any UIElement as a button. This is because each element has a large amount of events that can be tracked. Think of it as a layered cake. If you have a textblock inside of a listbox inside of a grid, similar to what you see above. Then when someone clicks on the textblock it will try to handle the event. If it isn't set to handle it then the listbox tries. If the listbox cant then the grid tries and so on. What you are looking for is the tap event in the textblock. Google textblock tap event.
<Grid x:Name="LayoutRoot" Background="Transparent">
<ListBox>
<StackPanel>
<TextBlock Tap="title_Tap_1" Name="title">title</TextBlock>
private void title_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
{
//Your code here
}
I tend to use a ListBoxItem to wrap a TextBlock. It allows you to use the TiltEffect from the wpToolkit to show interaction and also exposes a Tap event for the ListBoxItem
<ListBoxItem toolkit:TiltEffect.IsTiltEnabled="True" Tap="On_Tap">
<TextBlock>Hello World</TextBlock>
</ListBoxItem>
I don't know for Windows Phone 8 because I haven't written any app yet. I think that this is like Windows Phone 7 , 7.1 that I used to write code. This control that you see is a ListBox and inside there are ListBoxItems. ListBoxItem can be anything (it can be used as a container to insert anything inside it.). Hope it helps.
The easiest way is to use HyperlinkButton instead of classic Button. In that print screen I doubt there's a list for only like... 3 buttons (hyperlinkbuttons).
Controls in the xaml world are look-less: use a button in your ItemTemplate and turn the border off. Then you can use the command property of the button for binding to your VM, or if you are not using MVVM use the Click event of the button and handle it in the code behind.
I have searched for other answers, but none are clear enough.
I have a problem where whenever I click on a textbox that I set the InputScope to "number", the number pad comes up but the box I was typing in disappears..
Here is a screenshot and my code.
(I am also overriding the light/dark theme on windows phone to do it)
<TextBox InputScope="Number" Height="72" HorizontalAlignment="Left"
Margin="159,190,0,0" Name="aTextBox" VerticalAlignment="Top" Width="227"
TextChanged="aTextBox_TextChanged" Foreground="Black" BorderThickness="0"
Background="White" />
Your problem appears to be that there is a different visual state for when the TextBox has input focus, which matches the phone theme you're trying to override. If you want to fight against the system theme, you'll need to retemplate the TextBox.
In Blend, in the Objects and Timeline window, right-click on the TextBox and select Edit Template | Edit a Copy...
In the dialog that appears, name your new style / template and where you want to create it in the XAML. Click OK.
You are now in template edit mode. (If you want to exit this mode, click the Return scope button at the top of the Objects and Timeline window)
Click on the States tab (or go to Window | States if not visible) and you can see all the different visual states for each mode of the TextBox (focused, unfocused, etc). As you click on each one, you'll see the TextBox in the designer change. Select each state and change the colors to what you want them to be.
Specifically, note how in the Focused state, the TextBox background becomes transparent by default. This is your issue. Change it to what you want it to be.
Finally, I want to recommend that you don't try to override the Light / Dark theme on Windows Phone, unless you are replacing it outright with your own branding / color scheme. It's a lot of work and it could annoy and confuse users who are used to seeing the theme they have chosen.
Good luck!
Try like this:
<TextBox Text="NumericTextBox">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Number" />
</InputScope>
</TextBox.InputScope>