Permalink
Browse files

Now we have things, but they all display black

  • Loading branch information...
1 parent e9cdc7e commit a36d04fe0ba6f2d8b04dd082390d005e6ca5f7c1 @druttka committed Jun 30, 2016
@@ -0,0 +1,6 @@
+namespace DataTemplates
+{
+ public class BlueThing : Thing
+ {
+ }
+}
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
- <ProjectGuid>{ef7630c2-e2fb-4421-ace5-640f33f16972}</ProjectGuid>
+ <ProjectGuid>{EF7630C2-E2FB-4421-ACE5-640F33F16972}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataTemplates</RootNamespace>
@@ -16,9 +16,7 @@
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-
<PackageCertificateKeyFile>DataTemplates_TemporaryKey.pfx</PackageCertificateKeyFile>
-
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
@@ -97,18 +95,20 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
+ <Compile Include="BlueThing.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
+ <Compile Include="MainPageViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="RedThing.cs" />
+ <Compile Include="Thing.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
-
<None Include="DataTemplates_TemporaryKey.pfx" />
-
</ItemGroup>
<ItemGroup>
<Content Include="Properties\Default.rd.xml" />
@@ -130,11 +130,9 @@
<SubType>Designer</SubType>
</Page>
</ItemGroup>
-
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
-
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -143,4 +141,4 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+</Project>
@@ -7,7 +7,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
+ <Page.DataContext>
+ <local:MainPageViewModel x:Name="ViewModel"></local:MainPageViewModel>
+ </Page.DataContext>
+
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
-
+ <ListView ItemsSource="{x:Bind ViewModel.Items}">
+
+ </ListView>
</Grid>
</Page>
@@ -0,0 +1,36 @@
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace DataTemplates
+{
+ public class MainPageViewModel : INotifyPropertyChanged
+ {
+ private IEnumerable<Thing> _items;
+
+ public MainPageViewModel()
+ {
+ Items = new Thing[]
+ {
+ new BlueThing { Text = "I'm blue, dabadee dabadi" },
+ new RedThing { Text = "Red, red wine" }
+ };
+ }
+
+ public IEnumerable<Thing> Items
+ {
+ get { return _items; }
+ set
+ {
+ if (_items == value)
+ {
+ return;
+ }
+
+ _items = value;
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Items)));
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+}
@@ -0,0 +1,6 @@
+namespace DataTemplates
+{
+ public class RedThing : Thing
+ {
+ }
+}
@@ -0,0 +1,7 @@
+namespace DataTemplates
+{
+ public class Thing
+ {
+ public string Text { get; set; }
+ }
+}

0 comments on commit a36d04f

Please sign in to comment.