Skip to content

Commit

Permalink
Merge pull request #22 from leealsheikh/Fix/DynamicResources
Browse files Browse the repository at this point in the history
  • Loading branch information
IeuanWalker committed May 12, 2020
2 parents 1d3593b + d0a9b5e commit e518b16
Show file tree
Hide file tree
Showing 23 changed files with 324 additions and 272 deletions.
2 changes: 1 addition & 1 deletion Breadcrumb/Breadcrumb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageId>Xamarin.Forms.Breadcrumb</PackageId>
<Version>2.4.0</Version>
<Version>2.5.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions Breadcrumb/Breadcrumb.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
<ContentView x:Class="Breadcrumb.Breadcrumb"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Name="this"
IsVisible="False">
<ContentView.Content>
<ScrollView x:Name="BreadCrumbsScrollView"
HorizontalScrollBarVisibility="{Binding ScrollBarVisibility, Source={x:Reference this}}"
HorizontalScrollBarVisibility="{Binding ScrollBarVisibility, Source={RelativeSource AncestorType={x:Type ContentView}}}"
Orientation="Horizontal">
<StackLayout x:Name="BreadCrumbContainer"
HorizontalOptions="FillAndExpand"
Expand Down
18 changes: 13 additions & 5 deletions Breadcrumb/Breadcrumb.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ public Breadcrumb()
Source = Separator,
VerticalOptions = LayoutOptions.Center
});
continue;
}
Expand Down Expand Up @@ -198,27 +200,33 @@ private PancakeView BreadCrumbLabelCreator(Page page, bool isLast, bool isFirst)
}
else
{
stackLayout.Children.Add(new Label
Label breadcrumbText = new Label
{
Text = page.Title,
FontSize = 15,
TextColor = isLast ? LastBreadcrumbTextColor : TextColor,
VerticalOptions = LayoutOptions.Center,
VerticalTextAlignment = TextAlignment.Center
});
};
breadcrumbText.SetBinding(Label.TextColorProperty, new Binding(isLast ? nameof(LastBreadcrumbTextColor) : nameof(TextColor), source: new RelativeBindingSource(RelativeBindingSourceMode.FindAncestor, typeof(Breadcrumb))));

stackLayout.Children.Add(breadcrumbText);
}


// Create PancakeView, and add StackLayout containing the selectedPage title
return new PancakeView
PancakeView container = new PancakeView
{
Padding = 10,
VerticalOptions = LayoutOptions.Center,
CornerRadius = isLast ? LastBreadcrumbCornerRadius : CornerRadius,
BackgroundColor = isLast ? LastBreadcrumbBackgroundColor : BreadcrumbBackgroundColor,
Content = stackLayout,
Margin = BreadcrumbMargin
};
container.SetBinding(PancakeView.BackgroundColorProperty, new Binding(isLast ? nameof(LastBreadcrumbBackgroundColor) : nameof(BreadcrumbBackgroundColor), source: new RelativeBindingSource(RelativeBindingSourceMode.FindAncestor, typeof(Breadcrumb))));



return container;
}

/// <summary>
Expand Down
13 changes: 2 additions & 11 deletions DemoApp/DemoApp.Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Runtime;
using Xamarin.Essentials;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

namespace DemoApp.Droid
{
[Activity(Label = "DemoApp", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
public class MainActivity : FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
Expand All @@ -18,16 +17,8 @@ protected override void OnCreate(Bundle savedInstanceState)
base.OnCreate(savedInstanceState);

Forms.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental", "FastRenderers_Experimental");
Platform.Init(this, savedInstanceState);
Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}

public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
{
Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);

base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}
Loading

0 comments on commit e518b16

Please sign in to comment.