none
class not recognized in the namespace

    Question

  • I have a data model being used by several pages in my application.  I created a new page on which I want to use a different model.  So I copied the original data model and changed the names.  So everything is the same in these files except one uses "SampleData" and the new uses "SampleProduct".

    In the new page, when I'm assigning the binding, when I use SampleProduct, I get the message that the SampleProductSource is not in the namespace.  If I change to SampleDataSource, no problem.

    Here's the code that does not work:

    namespace Z_Tracker.Data
    {
        /// <summary>
        /// Base class for <see cref="SampleProductItem"/> and <see cref="SampleProductGroup"/> that
        /// defines properties common to both.
        /// </summary>
        [Windows.Foundation.Metadata.WebHostHidden]
        public abstract class SampleProductCommon : Z_Tracker.Common.BindableBase

    ...
       public sealed class SampleProductSource
        {
            private static SampleProductSource _SampleProductSource = new SampleProductSource();

    The code that does work:

    namespace Z_Tracker.Data
    {
        /// <summary>
        /// Base class for <see cref="SampleDataItem"/> and <see cref="SampleDataGroup"/> that
        /// defines properties common to both.
        /// </summary>
        [Windows.Foundation.Metadata.WebHostHidden]
        public abstract class SampleDataCommon : Z_Tracker.Common.BindableBase

    ...

        public sealed class SampleDataSource
        {
            private static SampleDataSource _sampleDataSource = new SampleDataSource();

    The code from the xaml page that works with one but not the other;

    <Page.Resources>

            <!-- Collection of items displayed by this page -->
            <CollectionViewSource
                x:Name="itemsViewSource"
                Source="{Binding Items}"
                d:Source="{Binding AllGroups[0].Items, Source={d:DesignInstance Type=data:SampleProductSource, IsDesignTimeCreatable=True}}"/>
        </Page.Resources>


    Stephen

    Saturday, September 15, 2012 12:35 AM

Answers

  • I assume you are demonstrating this for a Grid App template. What you do:

    - goto SampleDataSource
    - right click 'FindReferences'
    - double click on all references in Find Symbol Results lines [7 of them I believe]
    - adapt SampleDataSource -> SampleProductSource, in particular in 'LoadState' methods

    ---

    Note: FindReferences might omit XAML references to SampleDataSource. In that case,  EDIT[MenuBar]>Find and Replace > FindInFiles > EntireSolution.

    Saturday, September 15, 2012 8:47 AM

All replies

  • I assume you are demonstrating this for a Grid App template. What you do:

    - goto SampleDataSource
    - right click 'FindReferences'
    - double click on all references in Find Symbol Results lines [7 of them I believe]
    - adapt SampleDataSource -> SampleProductSource, in particular in 'LoadState' methods

    ---

    Note: FindReferences might omit XAML references to SampleDataSource. In that case,  EDIT[MenuBar]>Find and Replace > FindInFiles > EntireSolution.

    Saturday, September 15, 2012 8:47 AM
  • Thanks!  Not sure why I was having the problem, but it seems to have gone away.

    Stephen

    Wednesday, September 19, 2012 11:23 PM