-
StackOverflow 文件
-
uwp 教程
-
UWP(StaticResource ThemeResource)和 ResourceDictionary 中的資源
-
1.資源詞典
來自 MainPage.xaml 的片段
<Page
x:Class="MyNewApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyNewApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<!-- Creates a resource dictionary in the page context -->
<ResourceDictionary>
<!-- This is a solid color brush resource
NOTE: Each resource inside a resource dictionary must have a key -->
<SolidColorBrush x:Key="ColorRed">Red</SolidColorBrush>
</ResourceDictionary>
</Page.Resources>
<!-- Using ThemeResource in here to access a resource already defined -->
<Grid Background="{ThemeResource ColorRed}">
</Grid>
</Page>