In my current layout, I want some data to be visible in the design view, so I read about DataContext and DesignData, and I can't use them correctly.
My MainPage.xaml starts as follows:
<phone:PhoneApplicationPage x:Class="AppStalker.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True" d:DataContext="{d:DesignData Source=./SampleData/SampleData.xml}">
My application compiles without warnings / errors, and I can see the data in the emulator. In any case, after creating the solution, VS 2012 complains that it cannot find C:\path\to\project\AppName\SampleData\SampleData.xml
I triple checked that I have no typos, and I also changed xml to xaml without effect. I also checked three times that the directory and file are displayed in the solution view.
Now it becomes interesting: if I change the path to Source=./App.xaml , it will not complain. If I change it to the MainPage.xaml link, it complains about some errors in the file. If I transfer my SampleData.xml to the same root directory as App.xaml , it still refuses to find them ...
I also changed the file assembly action to Resource , Embedded Resource , DesignData , but nothing changed.
I basically follow this LongListSelector Pass
Any ideas?
source share