Skip to content

Instantly share code, notes, and snippets.

@tomwis
tomwis / build.cake
Last active February 4, 2018 14:04
var target = Argument("target", "TaskName");
Task("TaskName")
.Does (() =>
{
// Tu wpisujemy co zadanie będzie robić
});
RunTarget(target);
var picker = new Picker()
{
DisplayPropertyName = nameof(PickerItem.DisplayName), // we właściwości DisplayName mamy nazwę pliku z obrazkiem lub nazwę z Asset Catalogu
ContentType = PickerDisplayContentType.Image, // Domyślna wartość to PickerDisplayContentType.Text
ContentImageSize = new CGSize(32, 32), // Domyślna wartość to 32x32
ContentImageAlignment = UIControlContentHorizontalAlignment.Center // Domyślna wartość to UIControlContentHorizontalAlignment.Left
};
Add(picker);
var set = this.CreateBindingSet<MyView, MyViewModel>();
var picker = new Picker()
{
DisplayPropertyName = nameof(PickerItem.DisplayName)
};
Add(picker);
var set = this.CreateBindingSet<MyView, MyViewModel>();
set.Bind(picker).For(v => v.ItemsSource).To(vm => vm.PickerItems);
set.Bind(picker).For(v => v.SelectedItem).To(vm => vm.SelectedItem).TwoWay();
set.Apply();
$red = "#ff0000";
Label {
// ...
TextColor: $red
}
// na stronie z ammy ui
using AmmyUIExmaple.Converters
Frame {
// ... inne właściwości
BackgroundColor: bind Category convert (EntryCategory category) => EntryCategoryToColorConverter.Convert(category)
}
// gdzieś w innym pliku .cs
public static class EntryCategoryToColorConverter
@tomwis
tomwis / Ammy.mixin
Last active October 29, 2017 17:29
mixin TwoRows(height1, height2) for Grid {
RowDefinitions: [
RowDefinition { Height: $height1 }
RowDefinition { Height: $height2 }
]
}
Grid {
#TwoRows("*", 25)
}
Image {
#Cell(1, 0)
Source: "icon.png"
}
Grid {
#TwoRows(25, "*")
}
Label {
#Cell(1, 0)
Text: "Hello!"
}
ContentPage "AmmyUITest1.Ammy.MainPage" {
Label {
Text: "Welcome to Xamarin Forms!"
VerticalOptions: Center
HorizontalOptions: Center
}
}
<?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:local="clr-namespace:AmmyUITest1"
x:Class="AmmyUITest1.MainPage">
<Label Text="Welcome to Xamarin Forms!"
VerticalOptions="Center"
HorizontalOptions="Center" />