Skip to content

Instantly share code, notes, and snippets.

@slide
Created March 3, 2022 15:09
Show Gist options
  • Save slide/685d0fbb31593660bc1905d7d1900b81 to your computer and use it in GitHub Desktop.
Save slide/685d0fbb31593660bc1905d7d1900b81 to your computer and use it in GitHub Desktop.
Uno Platform Resource Issue
<Application
x:Class="Iron.Uno.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Iron.Uno">
<Application.Resources>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<local:ViewModelLocator x:Key="ViewModelLocator"/>
</Application.Resources>
</Application>
<Page
x:Class="Iron.Uno.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Iron.Uno"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
DataContext="{Binding Main, Source={StaticResource ViewModelLocator}}"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<TextBlock Text="{Binding WelcomeText}" Margin="20" FontSize="30" />
</Grid>
</Page>
using System;
using System.Collections.Generic;
using System.Text;
namespace Iron.Uno.ViewModels
{
public class MainViewModel
{
public string WelcomeText => "Hello, Slide!";
}
}
using Iron.Uno.ViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace Iron.Uno
{
public class ViewModelLocator
{
public MainViewModel Main => new MainViewModel();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment