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
*** | |
In Shared code: | |
public class WebViewPage : ContentPage | |
{ | |
} | |
... | |
await Navigation.PushAsync (new WebViewPage()); |
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
<StackLayout VerticalOptions="Center"> | |
<Label x:Name="lblText" Text="0" HorizontalOptions="Start" FontSize="Micro" HorizontalTextAlignment="Center" VerticalOptions="EndAndExpand" > | |
<Label.Margin> | |
<OnPlatform x:TypeArguments="Thickness"> | |
<On Platform="iOS" Value="15,0" /> | |
<On Platform="Android" Value="10,0" /> | |
</OnPlatform> | |
</Label.Margin> | |
</Label> | |
<Slider x:Name="mySlider" Maximum="10000" Minimum="100" HorizontalOptions="FillAndExpand" ValueChanged="Handle_ValueChanged" > |
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
class EmptyCollectionContractResolver : DefaultContractResolver { | |
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) { | |
JsonProperty property = base.CreateProperty(member, memberSerialization); | |
Predicate<object> shouldSerialize = property.ShouldSerialize; | |
property.ShouldSerialize = obj => (shouldSerialize == null || shouldSerialize(obj)) && !IsEmptyCollection(property, obj); | |
return property; | |
} | |
private bool IsEmptyCollection(JsonProperty property, object target) { |
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" | |
x:Class="MyApp.LayoutPage"> | |
<ContentPage.Content> | |
<StackLayout> | |
<Image Source="icon.png" /> | |
</StackLayout> | |
</ContentPage.Content> | |
</ContentPage> |
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
void Slider_ValueChanged(object sender, Xamarin.Forms.ValueChangedEventArgs e) | |
{ | |
var newStep = Math.Round(e.NewValue / 100); | |
mySlider.Value = newStep * 100; | |
lblText.Text = mySlider.Value.ToString(); | |
lblText.TranslateTo(mySlider.Value * ((mySlider.Width - 40) / mySlider.Maximum) , 0, 100); | |
} |
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 ListViewPageViewModel : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged; | |
protected void OnPropertyChanged([CallerMemberName]string propertyName = "") => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | |
private IList<Birds> birdsList; | |
bool isRefreshing; | |
private bool isEmpty; | |
public bool IsEmpty |
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 Birds | |
{ | |
public string Title { get; set; } | |
public string Description { 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
public class Converter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | |
{ | |
return !(bool)value; | |
} | |
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | |
{ | |
return !(bool)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
<ContentView.Content> | |
<StackLayout VerticalOptions="Center" HorizontalOptions="Center"> | |
<Image Source="empty.png"/> | |
<Label Text="There is nothing in here." FontSize="Medium" TextColor="{DynamicResource TextColorLight}"/> | |
</StackLayout> | |
</ContentView.Content> |
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"?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:control="clr-namespace:XFEmptyViewSample.Controls" | |
xmlns:helper="clr-namespace:XFEmptyViewSample.Helpers" | |
xmlns:viewmodel="clr-namespace:XFEmptyViewSample.ViewModels" | |
x:Class="XFEmptyViewSample.Views.ListViewPage" Title="Birds"> | |
<ContentPage.BindingContext> | |
<viewmodel:ListViewPageViewModel/> | |
</ContentPage.BindingContext> |
OlderNewer