Getting Started
Hello World without a ViewModel
Start here if you just want to get pixels on the screen. This version uses XML for the view and regular code-behind to update a named label.
View
<?xml version="1.0" encoding="utf-8"?>
<UserControl xmlns="urn:inkkslinger-ui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="InkkSlinger.HelloWorldView"
Background="#101822"
Padding="24">
<Border Background="#142231"
BorderBrush="#28445F"
BorderThickness="1"
CornerRadius="14"
Padding="20">
<StackPanel>
<Label x:Name="MessageLabel"
Text="Hello from XML"
FontSize="24"
FontWeight="SemiBold"
Foreground="#F4FAFF" />
<Label Text="This version uses code-behind only."
Margin="0,8,0,0"
Foreground="#9FC0D8" />
</StackPanel>
</Border>
</UserControl>
Code-behind
namespace InkkSlinger;
public partial class HelloWorldView : UserControl
{
public HelloWorldView()
{
InitializeComponent();
if (MessageLabel != null)
{
MessageLabel.Text = "Hello from InkkSlinger.";
}
}
}
When to use this style: use code-behind only when the screen is tiny, when you are proving out the pipeline, or when the state does not justify a separate view model yet.