Skip to content

Instantly share code, notes, and snippets.

View alex.cs
// For users without passwords
public class BaseRegisterVm
{
public Constants.AuthenticationType UserType { get; set; }
public BaseRegisterVm()
{
UserType = Constants.AuthenticationType.Windows;
}
@julesx
julesx / frametest.xaml
Created Jun 2, 2017
Frame differences between iOS and Android
View frametest.xaml
<StackLayout Orientation="Vertical" Margin="0,10,0,0">
<Label Text="FUNCTIONS" FontSize="Micro" FontAttributes="Bold" HorizontalOptions="Center" Margin="0,0,0,2" />
<Frame Margin="10,0,10,10" Padding="20,5">
<ListView ItemsSource="{Binding MenuItems}" Footer="{Binding}" HasUnevenRows="True">
<ListView.Behaviors>
<behavior:ListBoxDeselectSelectedItemBehavior />
View DroidRenderer.cs
[assembly: Xamarin.Forms.ExportRenderer(typeof(LandscapePage), typeof(LandscapePageRenderer))]
namespace Mobile.Core.Droid.Renderers
{
public class LandscapePageRenderer : PageRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
((FormsAppCompatActivity)Context).RequestedOrientation = ScreenOrientation.Landscape;
View MainActivity.cs
using Android.App;
using Android.Content.PM;
using Android.OS;
using HockeyApp.Android;
using FFImageLoading.Forms.Droid;
using HockeyApp.Android.Utils;
using Plugin.Media;
using Plugin.Permissions;
namespace Merrit.Droid
View RepeaterView.cs
public class RepeaterView : StackLayout
{
public static readonly BindableProperty ItemTemplateProperty =
BindableProperty.Create("ItemTemplate", typeof(DataTemplate), typeof(RepeaterView));
public static readonly BindableProperty ItemsSourceProperty =
BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(RepeaterView), Enumerable.Empty<object>(), BindingMode.OneWay, null, ItemsChanged);
public IEnumerable ItemsSource
{
View AccessorizedCellRenderer.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using CoreGraphics;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(MyTextCell), typeof(AccessorizedTextCellRenderer))]
View AndroidDocumentViewer.cs
public class DocumentViewer : IDocumentViewer
{
public void ShowDocumentFile(string filepath, string mimeType)
{
var uri = global::Android.Net.Uri.Parse("file://" + filepath);
var intent = new Intent(Intent.ActionView);
intent.SetDataAndType(uri, mimeType);
intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);
Forms.Context.StartActivity(intent);
}
View test.cs
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class PickerListCell
{
public PickerListCell()
{
InitializeComponent();
MyPicker.Unfocused += MyPicker_Unfocused;
}
View test.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:InstitutionConnect;assembly=InstitutionConnect"
xmlns:converters="clr-namespace:InstitutionConnect.Converters"
xmlns:oxy="clr-namespace:OxyPlot.Xamarin.Forms;assembly=OxyPlot.Xamarin.Forms"
x:Class="InstitutionConnect.Layouts.PaymentDashboardPage">
<ContentPage.Resources>
<ResourceDictionary>
View RepeaterView.cs
public class RepeaterView : StackLayout
{
public static readonly BindableProperty ItemTemplateProperty =
BindableProperty.Create("ItemTemplate", typeof(DataTemplate), typeof(RepeaterView));
public static readonly BindableProperty ItemsSourceProperty =
BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(RepeaterView), Enumerable.Empty<object>(), BindingMode.OneWay, null, ItemsChanged);
public IEnumerable ItemsSource
{
You can’t perform that action at this time.