mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
UWP tabbed page with icons
This commit is contained in:
parent
e4c47aca9e
commit
e901a1f231
5 changed files with 60 additions and 2 deletions
|
@ -2,7 +2,13 @@
|
|||
x:Class="Bit.UWP.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP"
|
||||
xmlns:local="using:Bit.UWP"
|
||||
RequestedTheme="Light">
|
||||
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Styles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
|
|
@ -43,6 +43,8 @@ namespace Bit.UWP
|
|||
rootFrame.NavigationFailed += OnNavigationFailed;
|
||||
Xamarin.Forms.Forms.Init(e);
|
||||
|
||||
((Style)Resources["TabbedPageStyle"]).Setters[0] = ((Style)Resources["TabbedPageStyle2"]).Setters[0];
|
||||
|
||||
if(e.PreviousExecutionState == ApplicationExecutionState.Terminated)
|
||||
{
|
||||
//TODO: Load state from previously suspended application
|
||||
|
|
23
src/UWP/IconConverter.cs
Normal file
23
src/UWP/IconConverter.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace Bit.UWP
|
||||
{
|
||||
public class IconConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if(value != null && value is Xamarin.Forms.FileImageSource)
|
||||
{
|
||||
return ((Xamarin.Forms.FileImageSource)value).File;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
22
src/UWP/Styles.xaml
Normal file
22
src/UWP/Styles.xaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:uwp="using:Xamarin.Forms.Platform.UWP"
|
||||
xmlns:local="using:Bit.UWP">
|
||||
|
||||
<local:IconConverter x:Key="IconConverter" />
|
||||
|
||||
<Style x:Key="TabbedPageStyle2" TargetType="uwp:FormsPivot">
|
||||
<Setter Property="HeaderTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image Source="{Binding Icon, Converter={StaticResource IconConverter}}" Width="24" Height="24" />
|
||||
<TextBlock Name="TabbedPageHeaderTextBlock" Text="{Binding Title}"
|
||||
Style="{ThemeResource BodyTextBlockStyle}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
|
@ -95,6 +95,7 @@
|
|||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="IconConverter.cs" />
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -136,6 +137,10 @@
|
|||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Acr.UserDialogs">
|
||||
|
|
Loading…
Reference in a new issue