Copyright © HL Interactive 2015, Thomas Hagström, Horisontvägen 85, Stockholm, Sweden
Xamarin.Forms boilerplate functions to facilitate project creation
AppService
and SpeechService
Common converters such as BoolToInvertedConverter
. Also:
Converts the supplied byte
array to an ImageSource
Converts a two-letter ISO country code to the equalant flag ImageSource
Allows using image folders on Windows while the removing the folder path on iOS and Android.
There is also an static method to use from code:
ImageToPlatformConverter.ImageToPlatformString(uriOrSource);
Prevents DateTime?
from being breaking Xamarin Forms by returning DateTime.Now
instead of null
.
Common extension methods. You should see this pop up in intellisense on Application
, Object
, Page
, String
, View
etc.
GetSetting and SaveSetting
Awaitable Tasks to read/write from Xamarin setting storage.
WriteDebug
Wraps static method AppService.WriteDebug
that takes a string or Exception
to write debug trace humanized.
Pure Xamarin.Forms Views with no platform specific implentation.
Import the namespace to start using them:
<ContentPage
xmlns:hli="clr-namespace:HLI.Forms.Core.Controls;assembly=HLI.Forms.Core">
</ContentPage>
Creates a simple bar chart from ItemsSource
using ValuePath
and LabelPath
to determine object members to display.
<hli:HliBarChart ItemsSource="{Binding CostPerWeekItems}" ValuePath="Cost" LabelPath="Week" IsPercent="True" BarScale="2" />
Allows binding a Picker
to an ItemsSource
of objects and using DisplayMemberpath
with SelectedValuePath
Also supports binding the selected object using SelectedItem
.
Based on bindable picker written by Simon Villiard
<hli:HliComboBox ItemsSource="ItemsSource="{Binding Countries}"" DisplayMemberpath="Name" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" />
Displays feedback to the user when a HliFeedbackMessage
is published through MessagingCenter
using hte key Constants.FeedbackKeys.Message
XAML
<hli:HliFeedbackView />
Code
MessagingCenter.Send(new HliFeedbackMessage(HliFeedbackMessage.FeedbackType.Error, "We're sorry!"), Constants.FeedbackKeys.Message);
Display a button with Image
content optionally using an ImageConverter
<hli:HliImageButton Image="myImage.png" />
A simple listview for a smaller collection when ListView
is not required.
Binds ItemsSource
using ItemTemplate
<hli:HliItemsView ItemsSource="MyItems">
<hli:HliItemsView.ItemTemplate>
<DataTemplate>
<! View content >
</DataTemplate>
</hli:HliItemsView.ItemTemplate>
</hli:HliItemsView>
Displays Text
as a simple clickable link. Supports Command
and ClickedEvent
A view that displays UnfocusedView
when unfocused and FocusedPage
when the user is editing using Navigation.PushModalAsync
.
The FocusedPage
has a CloseButton
you can customize.
here is also a OnClosed
event and ClosedCommand
you can subscribe to.
<hli:HliPlaceholderView>
<hli:HliPlaceholderView.UnfocusedView>
<Label Text="Read more!"></Label>
</hli:HliPlaceholderView.UnfocusedView>
<hli:HliPlaceholderView.FocusedPage>
<ContentPage BackgroundColor="White" Padding="20">
<Grid BackgroundColor="Gray" Padding="20" HorizontalOptions="Fill" VerticalOptions="Fill">
<ScrollView HorizontalOptions="Fill" VerticalOptions="Fill">
<Label TextColor="White" Margin="10,0,0,0"
HorizontalOptions="Fill" VerticalOptions="Fill"
Text="Odio velit duis! Habitasse mauris scelerisque vel quis, in in? Tristique nisi auctor pulvinar non pellentesque quis nec! Adipiscing urna egestas massa et, enim! Nisi et, pulvinar tristique integer nascetur! Ac cum. Aliquet, dictumst scelerisque. Eu! Ultrices rhoncus ut nec etiam vut, diam placerat sed? Integer ultrices amet sed scelerisque et. Duis adipiscing tincidunt tincidunt turpis, quis diam, placerat quis! In magnis ac in, sed aliquam, sit eu mus habitasse dictumst mattis! Ac nec turpis scelerisque! Velit et. Mid et! Lectus mattis duis porta! Augue risus et augue, diam amet. Ut pellentesque, porta, odio! Adipiscing mauris, sagittis a a augue porttitor, enim pulvinar dapibus? Aenean amet tincidunt et habitasse montes aenean. Scelerisque! Etiam natoque cras duis amet proin lectus in."
LineBreakMode="WordWrap">
</Label>
</ScrollView>
</Grid>
</ContentPage>
</hli:HliPlaceholderView.FocusedPage>
</hli:HliPlaceholderView>
A view that respons to orientation changes and either display the PortraitContent
or LandscapeContent
Download the nuget package through Package Manager Console:
install-package HLI.Forms.Core
- Projects
- Packages
- HLI.Core
- System.Linq.Expressions
- System.Linq.Queryable
- Xamarin.Forms
- Tools
- Windows 8.1 SDK
- Windows 10 SDK
The project is configured to automatically generate a *.nupkg upon build using Visual Studio 2017 CsProj MSBuild.
- HLI.Forms.Core - solution root folder
- HLI.Forms.Core - main project
- Controls - Xamarin.Forms
Views
(above) - Converters - see above
- Extensions - see above
- Interfaces
- Models - HLi models specific to project
- Resources - Colors, localization, GFX etc
- Services - see above
- Controls - Xamarin.Forms
- HLI.Forms.Core - main project
- VS2017 CsProj NetStandard 1.4