Skip to content

Instantly share code, notes, and snippets.

View shawyunz's full-sized avatar
🚀
Crafting Brilliance w/ .NET

Shaw Yu shawyunz

🚀
Crafting Brilliance w/ .NET
View GitHub Profile

Display your images

single

<p align="center">
	<img align="center" src=".\demo\v4.gif" width="340" />
</p>
@shawyunz
shawyunz / model.cs
Created June 7, 2022 04:25
model class with INotifyPropertyChanged implementation
public class Item : INotifyPropertyChanged
{
private string text;
public event PropertyChangedEventHandler PropertyChanged;
public string Description { get; set; }
public string Id { get; set; }
public string Text
<StackLayout BindableLayout.ItemsSource="{Binding List}">
<BindableLayout.ItemTemplate>
<DataTemplate>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
TargetType="{x:Type local:CustomView}"
@shawyunz
shawyunz / rotation.cs
Created December 2, 2020 08:36
An infinite rotation animation
//from https://forums.xamarin.com/discussion/43068/can-visualelement-rotateto-be-used-to-create-an-infinite-rotation-animation
private async Task RotateElement(VisualElement element, CancellationToken cancellation)
{
while (!cancellation.IsCancellationRequested)
{
await element.RotateTo(360, 800, Easing.Linear);
await element.RotateTo(0, 0); // reset to initial position
}
}
@shawyunz
shawyunz / ImageFont
Created November 1, 2020 22:10
Use custom font in an image
<Image>
<Image.Source>
<FontImageSource Glyph="&#xf30c;"
FontFamily="{OnPlatform iOS=Ionicons, Android=ionicons.ttf#}"
Size="44" />
</Image.Source>
</Image>
var ListB = ListA.Select(a => new ObjB() { Prop1 = a.Prop1, Prop2 = a.Prop2 }).ToList();
#Move the mouse every 5 min
Add-Type -AssemblyName System.Windows.Forms
while (1) {
Start-Sleep -Seconds 300
$Pos = [System.Windows.Forms.Cursor]::Position
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point((($Pos.X) + 1) , $Pos.Y)
}
#Run the script: ./ShakeMouse.ps1
//in AssemblyInfo.cs
//[assembly: ExportFont("FA5Brands.otf", Alias = "FA5Brands")]
<Label
Text="&#xf232;"
FontFamily="FA5Brands"
/>
var MainPage = (MasterDetailPage)Application.Current.MainPage;
var detail = (NavigationPage)MainPage.Detail;
detail.BarBackgroundColor = Color.Accent;
detail.BarTextColor = Color.Coral;