In Visual Studio 2015 with latest updates installed, doing a project for Windows 10 UAP. I create a User Control like this:
<UserControl
x:Class="App3.CustomControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App3"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid>
<GridView x:Name="gridView" ItemsSource="{Binding Elements}">
<GridView.ItemTemplate>
<DataTemplate>
<Grid Width="50" Height="50" Background="Bisque">
<TextBlock Text="{Binding}"/>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</Grid>
Code Behind:
namespace App3{
public sealed partial class CustomControl : UserControl
{
public CustomControl()
{
this.InitializeComponent();
this.DataContext = new MainViewModel();
}
}
}
MainViewModel
public class MainViewModel
{
public List<int> Elements { get; set; }
public MainViewModel()
{
Elements = Enumerable.Range(0, 100).ToList();
}
}
I add that user control to the MainPage and I execute the app. I see 100 elements in the screen. Great! But since I cannot be executing and compiling millions of times I expect the design time data to help me.
When editing the UserControl I don't see anything! But when in the MainPage I see the elements being loaded.
I expect to see in the same UserControl the data being loaded since that's where I want to design, edit styles or load data.
Any help? Thanks.