UWP: Simple Events
Thursday, July 19, 2018
Notes [07/19/2018] Note: This post refers to the library Microsoft.NETCore.UniversalWindowsPlatform, version 6.2.0-Preview1-26502-02. Events Some problems are just made so much easier in XAML based apps if you use the Event pub/sub model. We’ll structure our events the way the excellent Template10 does: One event One EventRaised method Untyped Events These events carry no information aside form the fact that it occurred. In the class that the event originates from: public class MyEventPublisherClass { /* This the event that will be subscribed to. */ public event EventHandler MyEvent; /* This is a convenience function that calls the event. */ void RaiseMyEvent() => MyEvent?.Invoke(this, new EventArgs { }); } This is an untyped event, so we use the Event version of an empty constructor with the new EventArgs {} syntax. The base EventArgs class contains no other fields. …
UWP: ListView Row Height
Thursday, July 19, 2018
Notes [07/19/2018] Note: This post refers to the library Microsoft.NETCore.UniversalWindowsPlatform, version 6.2.0-Preview1-26502-02. ListView Row Height When dealing with ListViews in UWP, sometimes more information density is desired, and the quickest way to get that density is to adjust the row height of each item in the ListView. By default in a new ListView, information density is low and look like this: Any control that inherits from ItemsPanel in UWP Xaml must have their row heights adjusted by overriding the style parameter in the parent object: …
Bin and Obj Are the Devil
Tuesday, June 19, 2018
the first in what is likely a series on cache invalidation being hard. tl;dr - close Visual Studio and delete your obj/ and bin/ directories if your project isn’t building and giving cryptic errors. Your project was working fine, but now all of a sudden it can’t find a reference whose location didn’t change. Or it won’t build because something is out of date. Or the version is incorrect. Maybe your project is suddenly throwing errors like cannot find source file or xxx does not exist in namespace yyy. Or maybe System.String can't be found, or byte[] is not a valid type, or System.ValueTuple2 cannot be found. …