I am trying to follow the article here to add a custom control to my project so that I can call it ("promptForPhotosetName") like so:
Popup popTart = new Popup();
popTart.Child = new promptForPhotosetName();
popTart.IsOpen = true;
I added a Custom Control to my project based on Templated Control.
My custom control class (which IS in the Photrax namespace) contains this constructor:
public promptForPhotosetName()
{
this.DefaultStyleKey = typeof(promptForPhotosetName);
}
I have this in \Themes\Generic.xaml, which is the other file (along with promptForPhotsetName.cs) that was created when I added the Custom Control:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Photrax">
<Style TargetType="local:promptForPhotosetName">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:promptForPhotosetName">
<StackPanel Orientation="Vertical">
<ListBox >
<ListBoxItem>
<StackPanel Orientation="Horizontal">
<Image Source="Windows 8.jpg" Height="200" Width="300" Stretch="Fill"></Image>
<Image Source="Windows_8.jpg" Height="200" Width="300" Stretch="Fill"></Image>
<Image Source="windows8(1).jpg" Height="200" Width="300" Stretch="Fill">
</Image>
</StackPanel>
</ListBoxItem>
</ListBox>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
Yet I get this error: The name "promptForPhotosetName" does not exist in the namespace "using:Photrax"." on both this line of XAML:
<Style TargetType="local:promptForPhotosetName">
...and this one:
<ControlTemplate TargetType="local:promptForPhotosetName">
Why? The class promptForPhotosetName IS indeed in the Photrax namespace!