This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel; | |
using System.Runtime.CompilerServices; | |
using MyWandle.Core.Enums; | |
namespace MyApp.Core.Models | |
{ | |
public class MediaAsset : INotifyPropertyChanged | |
{ | |
private bool _isSelected; | |
public string Id { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Specialized; | |
using System.ComponentModel; | |
using MvvmHelpers; | |
namespace MyApp.Controls | |
{ | |
public class ItemsChangeObservableRangeCollection<T> : | |
ObservableRangeCollection<T> where T : INotifyPropertyChanged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<Application xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:converter="clr-namespace:MyApp.Converter;assembly=MyApp" | |
x:Class="MyApp.App"> | |
<Application.Resources> | |
<ResourceDictionary> | |
<converter:ItemTappedEventArgsConverter x:Key="ItemTappedEventArgsConverter" /> | |
<converter:FirstValidationErrorConverter x:Key="FirstValidationErrorConverter" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Label | |
Grid.Column="0" | |
FontFamily="{StaticResource MaterialFontFamily}" | |
Style="{StaticResource IconStyle}" | |
Text="{Binding Direction, Converter={StaticResource DirectionIconConverter}}" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DirectionIconConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
var direction = value.ToString().ToLower(); | |
switch (direction) | |
{ | |
case "north": | |
return IconConstants.ArrowUpBoldCircle; | |
case "south": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ListView> | |
<ListView.ItemTemplate> | |
<DataTemplate> | |
<ViewCell> | |
<Grid | |
Padding="5" | |
BackgroundColor="{Binding ., Converter={StaticResource AlternateRowColourConverter}, ConverterParameter={x:Reference ItemsToFit}}" | |
HorizontalOptions="FillAndExpand"> | |
<!-- your stuff here --> | |
</Grid> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AlternateRowColourConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
if (value == null || parameter == null) return Color.LightGray; | |
var index = ((ListView)parameter).ItemsSource.Cast<object>().ToList().IndexOf(value); | |
if (index % 2 == 0) | |
{ | |
return "#eaecef"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<ResourceDictionary | |
x:Class="MyApp.Styles.Indicator" | |
xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"> | |
<ControlTemplate x:Key="MainTemplate"> | |
<Grid BindingContext="{TemplateBinding BindingContext}"> | |
<ContentPresenter Grid.Row="0" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringHasValueConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
if (value == null) return false; | |
return !string.IsNullOrEmpty(value.ToString()); | |
} | |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EventToCommandBehavior : BindableBehavior<Xamarin.Forms.View> | |
{ | |
public static BindableProperty CommandProperty = | |
BindableProperty.CreateAttached( | |
"Command", | |
typeof(ICommand), | |
typeof(EventToCommandBehavior), | |
null, | |
BindingMode.OneWay); |
NewerOlder