I have used 76*76 png file for bottom bar icon in my windows universal app.
Below is my xaml for mobile bottom bar
<Page.BottomAppBar>
<CommandBar RequestedTheme="Dark" Background="#FFF3A716">
<AppBarButton x:Uid="AppBarHome" Click="AppBarButton_Click">
<AppBarButton.Icon>
<BitmapIcon HorizontalAlignment="Center" VerticalAlignment="Center" UriSource="/Assets/Images/home-icon.png">
</BitmapIcon>
</AppBarButton.Icon>
</AppBarButton>
</CommandBar>
</Page.BottomAppBar>
And this is my bottom bar for tablet app:
<Page.BottomAppBar>
<CommandBar Name="BtmBar" Closed="CommandBar_Closed" RequestedTheme="Dark" Background="#FFF3A716" IsOpen="True" IsSticky="True">
<AppBarButton x:Uid="AppBarHome" Click="AppBarButton_Click">
<AppBarButton.Icon>
<BitmapIcon HorizontalAlignment="Center" VerticalAlignment="Center" UriSource="/Assets/Images/home-icon2.png">
</BitmapIcon>
</AppBarButton.Icon>
</AppBarButton>
</CommandBar>
</Page.BottomAppBar>
home-icon is 76*76 and home-icon2 is 96*96.
I have tried 76*76 icon for both also but in phone it seems ok and in tablet it is blurred.
How can I get rid of this blurry issue?
You have to make more than one scale and let Windows -auto- choose the perfect one .. This image may help you : http://i.stack.imgur.com/x2yGW.jpg .
Ref: AppBar button icon not fitting inside elipse
Scaling Ref : How to create multi scaled image assets for a WP 8.1 Store app
Related
I am working on a windows phone 8.1 app, where I am not able to change the Pivot Text Header Color.
I have use below code in my pivot section, but here I can't use multi color in text blocks.
<Pivot.HeaderTemplate>
<DataTemplate>
<Grid Height="40">
<TextBlock Text="{Binding}"
Foreground="Black"
FontSize="28"
VerticalAlignment="Bottom"/>
</Grid>
</DataTemplate>
</Pivot.HeaderTemplate>
Note : I need a solution for windows phone 8.1 and also I want to change the text color not the background color.
If you want different colours in every textbox have a look at this, you'll have to use a converter
How to highlight dates in a TextBlock MVVM Light
This is my code XAML, i just want to change background color of the labels and buttons inside
<Page.BottomAppBar>
<CommandBar Background="#FF3965FF">
<AppBarButton Label="estação" Icon="Map" Click="Bar_Localizar" Foreground="White" BorderBrush="White" Background="White"/>
<CommandBar.SecondaryCommands>
<AppBarButton Label="traçar rotas" Icon="Add" Click="bar_tracar_rotas" Foreground="White"/>
<AppBarToggleButton Label="tráfego" Checked="ToggleButton_OnChecked" Unchecked="ToggleButton_OnUnchecked"/>
<AppBarToggleButton Label="mapa aéreo" Checked="mapa_checked" Unchecked="mapa_unchecked"/>
<AppBarButton Label="voltar" Icon="Add" Click="bar_voltar"/>
<AppBarButton Label="Sair" Icon="Add" Click="bar_sair"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
I try to use Foreground="White" but doesn't works!
The AppBar is system UI and you are not allowed to change colors of individual buttons. If you want you can change the backgrounf color of whole application bar (use Background property) and color of all buttons (use Foreground property). This should work:
<Page.BottomAppBar>
<CommandBar Background="#FF3965FF" Foreground="White">
<AppBarButton Label="estação" Icon="Map" Click="Bar_Localizar"/>
</CommandBar>
</Page.BottomAppBar>
Remember also to perform suitable changes for all themes (Light/Dark/Contrast) allowed by your app.
If you need something more customizable, then probably you will have to build own control that will mimic the AppBar.
I have a page with too many richtext boxes and when scrolling if user place his finger on top of rtb form doesn't scroll, user has to place his finger on empty place.
Is there any possible way to stop that behavior?
I am working on a winrt universal application, question is specifically for windows phone project.
UPDATED:
Actually I am using component one library, and for some reason I want to use its richtextbox control just like a richtextblock. Below is xaml:
<as:C1RichTextBox x:Name="rtbBox" Grid.Row="0" Background="Transparent"
BorderBrush="Transparent" BorderThickness="0" Xaml:C1NagScreen.Nag="True" IsReadOnly="True" IsTapEnabled="False" DisableSelection="True" HideCaret="True"/>
<Grid Grid.Row="0" Height="Auto" Background="Transparent"></Grid>
<Image Margin="0,0,0,20" Width="200" Grid.Row="2" Source="{Binding InstallationInstructionPic1Bind}"/>
<as:C1RichTextBox x:Name="rtb1Detail" Grid.Row="3" Background="Transparent"
BorderBrush="Transparent" BorderThickness="0" Xaml:C1NagScreen.Nag="True"
NavigationMode="Always"
/>
These border and background properties are just to make its look more like a textblock, and to stop editing I have marked isReadonly property to true in .cs file. I have also placed transparent gridview above my first rtb to scroll and that works but there are some links in some of the rtb's and if I place grid view on top of all rtb I'll not be able to click these links. Ask anything if its not clear.
I'm creating an image gallery that users can view by swiping an image to the left or right (horizontally) to see the next (or previous) image. Ideally, the image would snap into place like a hub section. I don't want to use a hub, however, due to memory concerns, as well as a hub isn't meant for this purpose.
I'm getting the first image to load, but I cannot swipe or move to another image in the collection. The first image loads, and I cannot slide it left or right.
Any help or suggestions would be appreciated.
Here's my relevant code:
ViewModel
Images = (await _service.GetImages(sectionId))
.Where(i => "Image".Equals(i.Type))
.SelectMany(sr => sr.Images
.Where(ii => "Standard Resolution".Equals(ii.Type))
.ToList();
(This above code successfully returns a list of image objects.)
XAML
<Grid x:Name="ImagesLayout" Grid.Row="1" Height="250">
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Visible"
ItemsSource="{Binding Images}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source="{Binding Url}" Stretch="Fill" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
Here's a good article that outlines exactly how to implement an image carousel for Windows Phone 8.1. http://www.captechconsulting.com/blogs/windows-81-image-carousel
I'm trying to implement a custom popup menu for one of my app bar icon button (something like the PhoneFlipMenu tool). I'm using a vertical StackPanel for that:
<StackPanel x:Name="popupMenuListCommands" Grid.Row="1"
Orientation="Vertical" VerticalAlignment="Bottom"
Background="{StaticResource PhoneDisabledBrush}"
Visibility="Collapsed">
<TextBlock Text="menu item 1" Style="{StaticResource PopupMenuListCommand}" />
<TextBlock Text="menu item 2" Style="{StaticResource PopupMenuListCommand}" />
</StackPanel>
It is shown when the user presses the app bar button:
void appBarIconButtonList_Click(object sender, EventArgs e)
{
popupMenuListCommands.Visibility = Visibility.Visible;
ApplicationBar.IsVisible = false;
}
There are 2 problems:
1) How can I retrieve the effective color of the application bar to use it in my stack panel? ApplicationBar.BackgroundColor returns #00000000, but obviously the effective color of the app bar background is not this. For instance, it is a dark gray when the dark phone theme is on.
If we cannot retrieve this color dynamically, perhaps, we just need to hard code 2 color values for the dark and white themes. Then the question is what are their values?
2) How to use the color retrieved on the previous step to make the stack panel non-transparent? Now I see the main content under it even if I specify the background brush explicitly.
App bar uses a default phone color according to the theme. So, instead of using the app bar color why not use the default theme color? That will also do the same. http://www.jeff.wilcox.name/2012/01/phonethememanager/ this will help you.
For dark theme the color is rgb (31, 31, 31).
For light theme the color is rgb (221,221,221).
Hope this helped.
Cheers
You can get the application bar color from the app resource named "PhoneChromeBrush".
So all you need to do is set the stack panel background to this brush.
<StackPanel x:Name="popupMenuListCommands" Grid.Row="1"
Orientation="Vertical" VerticalAlignment="Bottom"
Background="{StaticResource PhoneChromeBrush}"
Visibility="Collapsed">
<TextBlock Text="menu item 1" Style="{StaticResource PopupMenuListCommand}" />
<TextBlock Text="menu item 2" Style="{StaticResource PopupMenuListCommand}" />
This way you don't have to worry about the phone dark or light theme.