Windows Store Browse Button - xaml

I want to create a simple Browse button like that found on the Windows 8.1 Reader app:
However, after searching for an hour I'm still no wiser. There must be a standard Button style for circle buttons? And where would I find the browse icon?

Not sure this is the most elegant XAML in the world, but it gets the job done.
<Button Style="{StaticResource TextBlockButtonStyle}">
<Button.RenderTransform>
<ScaleTransform ScaleX="2" ScaleY="2" />
</Button.RenderTransform>
<Grid>
<Rectangle Fill="DimGray" />
<Grid Margin="7,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="22" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe UI Symbol" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,-2,0,0" />
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe UI Symbol" FontSize="12" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock Grid.Column="1" Text="Browse" FontWeight="Light" Margin="4,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" />
</Grid>
</Grid>
</Button>
Here's the result:
Best of luck!

you should see this
AppBar button style images
Symbol enumeration
Modern UI
Icons

Related

How can I stop Android ScrollViewer to scroll itself to its first button child

I have a pretty simple page with a header, a footer, and scrollable content. My iOS and UWP app seems to work fine. When I enter the page iOS and UWP starts with the ScrollView Scrolled at the top, but Android seems to scroll down until you can see at least one button.
My page looks something like this (Header, big scrollable content and footer):
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Height="64"
Background="Blue">
<TextBlock Text="Header"
Margin="20" />
</Grid>
<ScrollViewer Grid.Row="1">
<StackPanel>
<TextBlock Text="Top"
VerticalAlignment="Top"
Height="500" />
<TextBlock Text="Content"
FontSize="66"
Margin="0,0,0,300" />
<Button Content="button"
Margin="0,0,0,300"/>
<TextBlock Text="Bottom"
VerticalAlignment="Bottom" />
</StackPanel>
</ScrollViewer>
<Grid Height="44"
Background="Green"
Grid.Row="2">
<TextBlock Text="Footer"
Margin="10" />
</Grid>
</Grid>
This arises from an interaction between the native Android scroll viewer (which is implicitly nested inside the Xaml ScrollViewer), which tries to scroll elements into view when they receive focus, and the Button, which takes focus when the Page first loads.
As a workaround to disable this behavior, you can use the BringIntoViewOnFocusChange property:
<ScrollViewer Grid.Row="1"
BringIntoViewOnFocusChange="False">
<StackPanel>
<TextBlock Text="Top"
VerticalAlignment="Top"
Height="500" />
<TextBlock Text="Content"
FontSize="66"
Margin="0,0,0,300" />
<Button Content="button"
Margin="0,0,0,300"/>
<TextBlock Text="Bottom"
VerticalAlignment="Bottom" />
</StackPanel>
</ScrollViewer>

wp8 listbox scrolling doesn't work

I have list box in my WP8 and I can't scroll to down.When I try to scroll down the whole list moves to down .I dont know how to explain it but it does what it shouldn't do. it is like i drag list down.i just want to scroll
here is my xaml code
<Grid x:Name="columngrid" >
<ListBox Name="URLListBox" >
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Background="Transparent" Margin="0,0,0,3" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock x:Name="surename" Grid.Column="0" Text="{Binding text}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Tag="{Binding b1Tag}" Grid.Column="1" Content="download" Height="72" Name="button1" Width="100" FontSize="15" Click="addButton_Click"/>
<Button Tag="{Binding b1Tag}" Grid.Column="2" Content="play" Height="72" Name="play_Click" Width="100" FontSize="15" Click="play_Click"/>
<Button Tag="{Binding b1Tag}" Grid.Column="3" Content="pause" Height="72" Name="pause_Click" Width="100" FontSize="15" Click="pause_Click"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
I think the problem is that your listbox is sizing to the content.
When this happens it wont scroll when you attempt to scroll it. It will follow your finger slightly, then bounce back to the top.
In reality what is happening is the listbox is the same size as all the content so it thinks you're at the bottom of the list.
The way to fix this is to manually set the size of the listbox to be the dimensions of the screen.
Something like Margin="0,0,0,0" width="480" height="800"

Windows Phone Context Menu Item Text Not Appearing

I have a Windows Phone 8 app using XAML/C#. My app has an ItemsControl that relies on a data template. My DataTemplate looks like the following:
<DataTemplate x:Key="myTemplate">
<Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="{Binding DisplayName}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextLargeStyle}" TextTrimming="WordEllipsis" >
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<toolkit:MenuItem x:Name="customerMenuItem" Foreground="White" Header="View Customer Profile" Click="customerMenuItem_Click" Tag="{Binding Path=CustomerName}" />
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
</TextBlock>
<TextBlock Text="{Binding Summary}" TextWrapping="NoWrap" Grid.Row="1" Style="{StaticResource PhoneTextSmallStyle}" />
</Grid>
<StackPanel Orientation="Horizontal" Grid.Column="1"><!-- Stuff here --></StackPanel>
</Grid>
</DataTemplate>
This DataTemplate is referenced in the main part of my XAML as shown here:
<Grid x:Name="ContentPanel" Grid.Row="1" Grid.ColumnSpan="2" Margin="12,0,12,0">
<ScrollViewer>
<ItemsControl x:Name="myItemsControl" ItemTemplate="{StaticResource myTemplate}" ItemsSource="{Binding Customers}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</ScrollViewer>
</Grid>
Please note, the "toolkit" namespace comes from clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit. When I hold my finger (or mouse) on the TextBlock, a context menu appears. However, I never see the words "View Customer Profile". I just see a block box that represents the context menu itself. I know that the item is there though. I know because the customerMenuItem_Click event successfully fires. I have a MessageBox in there that shows the value of the Tag. That value is always correct. For some reason though the menu item text is not appearing. What am I doing wrong?
You put Foreground = "White". Context menu is on white background. That is why you don't see your menu item.

Windows Store-app with login-screen

I need my program to start up with an login-screen, but I can not figure out how to make it look pretty.
I tried with a code, that looks like the following, but I do not think it is the "true way" to do it
<Page.Resources>
<Grid Style="{StaticResource LayoutRootStyle}">
<TextBlock x:Name="pageTitle" Grid.Column="1" Text="{StaticResource AppName}" Style="{StaticResource PageHeaderTextStyle}"/>
</Grid>
<TextBlock HorizontalAlignment="Left" Margin="647,31,0,0" Grid.Row="1" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
<TextBox HorizontalAlignment="Left" Margin="634,62,0,0" Grid.Row="1" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Margin="647,128,0,0" Grid.Row="1" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
<TextBox HorizontalAlignment="Left" Margin="634,167,0,0" Grid.Row="1" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top"/>
<Button Content="Button" HorizontalAlignment="Left" Margin="632,243,0,0" Grid.Row="1" VerticalAlignment="Top"/>
Can anybody tell me how to create a pretty login-screen as start-screen
I have though of a dialog, as it should not be possible to go back to it, but how can I create it with an empty background?
UPDATE
Thanks to DanielRozo in his answer below, my code now looks like this
<Popup IsOpen="True" Margin="200" Height="260" Width="900">
<Grid Height="250">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="Login" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Top" Height="50" />
<TextBlock Style="{StaticResource ResourceKey=SubheaderTextStyle}" Text="" Margin="0,63,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
<TextBox Name="InputUsername" Margin="0,63,0,0" HorizontalAlignment="Right" Height="40" Width="650"/>
<TextBlock Style="{StaticResource ResourceKey=SubheaderTextStyle}" Text="" Margin="0,138,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<PasswordBox Name="InputPassword" Margin="0,0,138,0" HorizontalAlignment="Right" VerticalAlignment="Top" Height="40" Width="650" />
<Button Name="Login" Content="" Margin="200,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
<Button Name="Cancel" x:Uid="LoginPopupCancel" Content="" Margin="300,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
</Grid>
</Popup>
But it does not work, when I rotate the screen, so I created this question
I also needs help to figure out how to set the page to a login-page
How about using the Popup class? I think it's a better approach of what you want. Something like:
<Popup Margin="200" IsOpen="True">
<Grid Margin="0" Height="322" Width="865">
<TextBlock Text="App Name Login" Style="{StaticResource HeaderTextStyle}" Margin="252,4,200,266"></TextBlock>
<TextBlock Text="User" Style="{StaticResource ResourceKey=SubheaderTextStyle}" Margin="244,63,498,223"/>
<TextBox x:Name="user" Margin="440,62,180,216"></TextBox>
<TextBlock Text="Pass" Style="{StaticResource ResourceKey=SubheaderTextStyle}" Margin="244,137,498,149"/>
<TextBox x:Name="pass" Margin="440,138,180,138"></TextBox>
<Button Name="Login" Content="Login" Margin="613,230,0,54"></Button>
<Button Name="Cancel" Content="Cancel" Margin="489,230,0,54"></Button>
</Grid>
</Popup>
Actually, I'd highly suggest the Web Auth Broker. If the user is auth'd using their LiveID, the WAB will provide you that credential, allowing you to not have to have credential re-entry for connected accounts. :)
I know that you've already marked another question as answer, but if you need to log in users into your app I think you should definitely take a look at the SplashScreen API. Overriding the default splashscreen, you'll have the users being always prompted with the username/password fields every time the app starts; moreover, you can never go back to the splashscreen, which is exactly what you say you need.
You should look at this sample: http://code.msdn.microsoft.com/windowsapps/Splash-screen-sample-89c1dc78 . I also suggest you to download Evernote from the market: trying an app made with the Splashscreen API may give you a better idea of what I'm saying.

Page.Frame.Navigate overlay old page

When I call Page.Frame.Navigate is i possible to navigate to a page smaller than screen size and make it lay over the page i just navigated from in any simple way? The ideal solution would not involve a large framework and the need to rewrite large parts of the application. I am looking for this effect: Windows 8 Music App
I guess I could make a hack by passing a snapshot of the page being navigated from to the new page and using this as a backdrop but I would prefer a cleaner solution. I guess I also could access the navigation stack from the new page and render the old behind.
You could use the Popup element, as William Melani stated. Here's an example:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<Button x:Name="btnPopup" Content="Open Popup" Click="btnPopup_Click_1" Grid.Row="0"></Button>
<Popup IsLightDismissEnabled="True" x:Name="popup1" Grid.Row="1" HorizontalAlignment="Center">
<StackPanel Background="Black">
<Border Background="Blue" BorderThickness="2">
<StackPanel>
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Text="User:" VerticalAlignment="Center" Margin="0,0,10,0" FontSize="20" />
<TextBox Height="40" Width="250" FontSize="20" />
<TextBlock Text="Mail:" VerticalAlignment="Center" Margin="0,0,10,0" FontSize="20" />
<TextBox Height="40" Width="250" FontSize="20" />
</StackPanel>
<Button HorizontalAlignment="Right" Margin="10">Accept</Button>
</StackPanel>
</Border>
</StackPanel>
</Popup>
And the button event:
private void btnPopup_Click_1(object sender, RoutedEventArgs e)
{
popup1.IsOpen = true;
}
Design isn't really my thing.