Skip to content

Instantly share code, notes, and snippets.

View jfversluis's full-sized avatar

Gerald Versluis jfversluis

View GitHub Profile
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace CarouselViewSample
{
public partial class App : Application
{
public App()
{
@jfversluis
jfversluis / MainPage.xaml
Created December 13, 2019 19:32
Xamarin.Forms CarouselView sample code
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="CarouselViewSample.MainPage">
<StackLayout HorizontalOptions="Center" VerticalOptions="Center" HeightRequest="100">
<CarouselView x:Name="TheCarousel">
<CarouselView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Hey...</x:String>
<x:String>Psssst...!</x:String>
<x:String>Did you check out...</x:String>
<x:String>The awesome new CarouselView</x:String>
@jfversluis
jfversluis / HtmlLabel.xaml
Created August 30, 2019 09:00
HTML Content in a Xamarin.Forms Label with CDATA tag
<Label>
<Label.Text>
<x:String>
<![CDATA[
<h1>Hello world!</h1><br/>SecondLine
]]>
</x:String>
</Label.Text>
</Label>
@jfversluis
jfversluis / HtmlLabel.xaml
Created August 30, 2019 08:55
Showing HTML in a Xamarin.Forms label with a HTML encoded string
<Label TextType="Html">
<Label.Text>
&lt;h1&gt;Hello World!&lt;/h1&gt;&lt;br/&gt;SecondLine
</Label.Text>
</Label>
zxing.Options.DelayBetweenAnalyzingFrames = 5;
zxing.Options.DelayBetweenContinuousScans = 5;
@jfversluis
jfversluis / TabbedRenderer.cs
Created March 4, 2019 14:20
Set the UnselectedTabColor and SelectedTabColor in the UWP renderer
void UpdateSelectedTabColors()
{
// Retrieve all tab header textblocks
var allTabHeaderTextBlocks = Control.GetDescendantsByName<WTextBlock>(TabBarHeaderTextBlockName).ToArray();
// Loop through all pages in the Pivot control
foreach (Page page in Control.Items)
{
// Fetch just the textblock for the current page
var tabBarTextBlock = allTabHeaderTextBlocks[Control.Items.IndexOf(page)];
@jfversluis
jfversluis / TabbedRenderer.cs
Created March 4, 2019 14:17
Set the UnselectedTabColor and SelectedTabColor in the iOS renderer
void UpdateSelectedTabColors()
{
if (Tabbed == null || TabBar == null || TabBar.Items == null)
return;
if (Tabbed.IsSet(TabbedPage.SelectedTabColorProperty) && Tabbed.SelectedTabColor != Color.Default)
TabBar.SelectedImageTintColor = Tabbed.SelectedTabColor.ToUIColor();
else
TabBar.SelectedImageTintColor = null;
namespace Xamarin.Forms.Controls
{
public class RootTabbedContentPage : TabbedPage
{
public RootTabbedContentPage ()
{
var tabOne = new ContentPage {
Title = "Testing 123",
Content = new AwesomeContent()
};
@jfversluis
jfversluis / MyTabbedPage.cs
Last active March 4, 2019 13:57
Setting the UnselectedTabColor and SelectedTabColor in Xamarin.Forms
Color TabbedPage.UnselectedTabColor { get; set; } //Bindable Property
Color TabbedPage.SelectedTabColor { get; set; } //Bindable Property
@jfversluis
jfversluis / MyTabbedPage.cs
Created March 4, 2019 13:47
Setting the tab selected and unselected color on Android
On<Android>().SetBarItemColor(Color.Red); // Unselected image+text color
On<Android>().SetBarSelectedItemColor(Color.White); // Selected image+text color