I've just moved from Windows Phone 8.1 Silverlight to Windows Phone Store apps. I've the following XAML for an app page:
<Page
x:Class="WebClip.HubPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WebClip"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:data="using:WebClip.Data"
mc:Ignorable="d">
<Grid x:Name="LayoutRoot">
<Hub x:Name="Hub"
Header="web clip"
Background="{ThemeResource HubBackgroundImageBrush}">
<HubSection x:Name="TileSelectorView"
Header="TILE SELECTOR">
<DataTemplate>
<ListView x:Name="TileList"/>
</DataTemplate>
</HubSection>
<HubSection x:Name="BrowserView"
Header="BROWSER">
<DataTemplate>
<WebView x:Name="BrowserBox"/>
</DataTemplate>
</HubSection>
</Hub>
</Grid>
</Page>
Earlier, in Silverlight, I can access an element like TileList directly to do something like:
TileList.ItemsSource = <SomeItemSourceList>;
But now I'm unable to do that in the backend C# code. The TileList in itself is not accessible. However, TileSelectorView and BrowserView (ref: code above) are accessible.
I found these two questions where Jerry had answered to something similar:
- How to accessing Elements in XAML DataTemplate Listview without interacting with it
- How do I access a control inside a XAML DataTemplate?
However, I'm not able to replicate them. There is no Items property under my TileSelectorView to iterate through.
What am I doing wrong? How do I get about this?