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
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:local="clr-namespace:TeuNamespace.ateapastadosconverters" | |
x:Class="TeuNamespace.TuaPage"> | |
<!---Aqui vc registra um singleton do conversor e da uma chave pra usar ele no xaml---> | |
<ContentPage.Resources> | |
<ResourceDictionary> | |
<local:ByteToImageSource x:Key="byteToImgSource" /> | |
</ResourceDictionary> | |
</ContentPage.Resources> |
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 ByteToImageSourceConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
return ImageSource.FromStream(() => new MemoryStream((byte[])value));; | |
} | |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
return null; |
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 MovieViewModel : BaseViewModel | |
{ | |
private string name = string.Empty; | |
private string image = string.Empty; | |
public string Name | |
{ | |
get => name; | |
set => SetProperty(ref name, value); |
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 Text="{Binding Name}" | |
HorizontalOptions="FillAndExpand" | |
VerticalOptions="FillAndExpand" | |
TextColor="White"/> | |
<Image HorizontalOptions="FillAndExpand" | |
VerticalOptions="FillAndExpand" | |
Aspect="AspectFill" | |
Source="{Binding Path=Image}" /> |
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
namespace Xamarin.Theming.Droid | |
{ | |
[Activity(Label = "Xamarin.Theming", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, | |
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode)] | |
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity | |
{ | |
protected override void OnCreate(Bundle savedInstanceState) | |
{ | |
TabLayoutResource = Resource.Layout.Tabbar; | |
ToolbarResource = Resource.Layout.Toolbar; |
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
private const float DEFAULT_SIGMA = -6f; | |
internal static SKImageFilter ToSKDropShadow(this Color shadowColor, float distance) | |
{ | |
return SKImageFilter.CreateDropShadow( | |
distance, | |
distance, | |
DEFAULT_SIGMA, | |
DEFAULT_SIGMA, | |
shadowColor.ToSKColor(), | |
SKDropShadowImageFilterShadowMode.DrawShadowOnly); |
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 ItemsSource="{Binding ListaDeOpcoes}" local:ItemTappedAttached.Command="{Binding OpcaoSelecionadaCommand}> |
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 ItemTappedAttached | |
{ | |
public static readonly BindableProperty CommandProperty = | |
BindableProperty.CreateAttached ( | |
propertyName: "Command", | |
returnType: typeof(ICommand), | |
declaringType: typeof(ListView), | |
defaultValue: null, | |
defaultBindingMode: BindingMode.OneWay, | |
validateValue: null, |
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 sealed class MyViewModel : BaseViewModel | |
{ | |
... | |
public MyViewModel() | |
{ | |
MessagingCenter.Subscribe<NavigationEventArgs>(this, nameof(Page.OnAppearing), OnAppearing); | |
MessagingCenter.Subscribe<NavigationEventArgs>(this, nameof(Page.OnDisappearing), OnDisappearing); | |
} | |