Dynamic icons in ApplicationBar
It's possible to have dynamic icons in ApplicationBar with dynamic images loaded from url?
I tried this:
xaml:
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="" Text="Button 1"/>
<shell:ApplicationBarIconButton IconUri="" Text="Button 2"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
cs:
var myIcon = ApplicationBar.Buttons[1] as ApplicationBarIconButton;
myIcon.IconUri = new Uri(iconImageUrl, UriKind.Absolute);
I'm getting error: Path cannot be absolute.
Chage the second parametr to UriKind.Relative if the uri is relative - looks like this one:
"/Images/icon.png"
I think the best idea is to save your image in isolated storage and call it with UriKind.Relative.
Full setting appbar IconUri, see:
Related
Default Emojis are working fine in my Xamarin.Forms app and it's colorful. When I add Twitter color fonts its become B/W (black-white). This Procedure I followed.
Initialization
[assembly: ExportFont( "TwitterColorEmoji.ttf", Alias = "TwitterColorEmoji" )]
Here is the example code in xaml
<!-- This is not working -->
<Label x:Name="emojilbl" Text="\U+1F1E9" Margin="20,0,0,0"></Label>
<Label
x:Name="emoji2lbl"
Text="🇦🇨"
Margin="20,0,0,0"
TextColor="#5EE514"
FontSize="40"
FontFamily="TwitterColorEmoji"></Label>
<!-- This is not working -->
<Image BackgroundColor="Black">
<Image.Source>
<FontImageSource
FontFamily="TwitterColorEmoji"
Glyph="🇦🇨"
Size="40"
>
</FontImageSource>
</Image.Source>
</Image>
<!-- This is working fine with default font -->
<Label Text="🇦🇨" Margin="20,0,0,0" FontSize="40"/>
Why emoji is not showing its own color.
Thank for the help in advanced.
Solved issue by changing "Embedded resource" to "Resource" option.
I'm trying to have a 'drop down button'.
I don't know if the is the good naming, but I need to have :
But I really have no idea how to do it, or even how this is named.
Any idea ?
It's not exactly what is on your mock, but what about MenuFlyout? It's almost the same and you don't need any magic for that. Plus it feels native for UWP users:
<StackPanel>
<Button Content="Button 1">
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="Action 1"/>
<MenuFlyoutItem Text="Action 2"/>
<MenuFlyoutItem Text="Action 3"/>
</MenuFlyout>
</Button.Flyout>
</Button>
<Button Content="Button 2"/>
<Button Content="Button 3"/>
</StackPanel>
There is API addition with DropDownButton in Windows 10 SDK Preview Build 17686 (line 487).
public class DropDownButton : Button
Been a while, but for anyone wondering, the image drawn more accurately represents a tree hierarchy then anything else
Try "TreeView" from there its standard intuitive coding
in windows phone 8 when i uncomment the following code the application bar appears in the bottom of the page i need to make it appears at the top of the page
phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" >
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
ApplicationBar always appears on the bottom. If you need something like the ApplicationBar positioned on top, you need to write this yourself.
I am facing following exception during redirecting from one page to my another page.
Cannot create instance of type 'Microsoft.Phone.Shell.PhoneApplicationService' [Line: 38 Position: 23]
code below on first page:
NavigationService.Source = (new Uri("/SecondPage.xaml?selectedItem=" + myId, UriKind.RelativeOrAbsolute));
with the help of above uri i am calling my second page. according to some some solutions provided in stackOverflow, I have issue in my xaml page i am pasting below my piece of code of xaml page.
SupportedOrientations="PortraitOrLandscape"
shell:SystemTray.IsVisible="True" Loaded="PhoneApplicationPage_Loaded"
tools:TiltEffect.IsTiltEnabled="True" Orientation="Portrait" >
<phone:PhoneApplicationPage.Resources>
<shell:ApplicationBar x:Key="SettingsBar" IsVisible="True" Mode="Default">
<shell:ApplicationBarIconButton x:Name="btnHome" IconUri="Images/home.png" Text="home" Click="btnHome_Click" />
<shell:ApplicationBarIconButton x:Name="cot" IconUri="Images/toc.png" Text="toc" Click="btnToc_Click"/>
<shell:ApplicationBarIconButton x:Name="zoom" IconUri="Images/zoom.png" Text="zoom" Click="btnZoom_Click"/>
<shell:ApplicationBarIconButton x:Name="setting" IconUri="Images/settings.png" Text="settings" Click="btnSettings_Click" />
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem x:Name="SettingBar_wb" Click="AppMenu_wb_Click" Text="See Wordbank" />
<shell:ApplicationBarMenuItem x:Name="SettingBar_sn" Click="AppMenu_sn_Click" Text="See Notes, " />
<shell:ApplicationBarMenuItem x:Name="SettingBar_hight" Click="AppMenu_hight_Click" Text="See Highlight" />
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
<shell:ApplicationBar x:Key="AnnotatorBar" IsVisible="True" >
<shell:ApplicationBarIconButton x:Name="notes" IconUri="Images/notes.png" Text="note" Click="btnNote_Click" />
<shell:ApplicationBarIconButton x:Name="myhights" IconUri="Images/myghights.png" Text="highlight" Click="btnHighlight_Click"/>
<shell:ApplicationBarIconButton x:Name="definsed" IconUri="Images/definesed.png" Text="Define" Click="btnDefine_Click"/>
<shell:ApplicationBarIconButton x:Name="webs" IconUri="Images/webs.png" Text="wordbank" Click="btnWordbank_Click" />
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem x:Name="AppMenu_SeeWordBank" Click="AppMenu_SeeWordBank_Click" Text="See Wordbank" />
<shell:ApplicationBarMenuItem x:Name="AppMenu_SeeNotes" Click="AppMenu_SeeNotes_Click" Text="See Notes, " />
<!--following is line 38 -->
<shell:ApplicationBarMenuItem x:Name="AppMenu_SeeHighlights" Click="AppMenu_SeeHighlights_Click" Text="See Highlight" />
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
Facing exception in App.g.cs
System.Windows.Application.LoadComponent(this, new System.Uri("/dbok;component/App.xaml", System.UriKind.Relative));
Yes, i have resolved the issue, it was my very small mistake and i really feeling bad for it because it was minor one mistake.
I did create a instance of the App class in my helper class so as you know App.xaml executes extremely first time so according to framework two instances of the App.xaml can not created.
I have modified my helper class.
From
App myApp = new App();
to
//Following is the right way to access the properties from the App.xaml page.
App thisApp = (App)System.Windows.Application.Current;
When I try to use "App Bar" with page that had "ListPicker" , ListPicker disappearing ?!
List Picker:
<toolkit:ListPicker
x:Name="listPicker"
ItemTemplate="{StaticResource PickerItemTemplate}"
FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}"
Header="Sound"
FullModeHeader="CHOOSE AN ITEM"
CacheMode="BitmapCache"
/>
App Bar :
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar/save.png" Text="Add" Click="ApplicationBarIconButton_Click"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
Can you be a bit more specific about what your problem is? It's not very clear.
If you're talking about the ListPicker not showing up, it's most likely an issue with the rest of your XAML and how you inserted the items. To my knowledge there's nothing wrong with the code you've put up.