Windows Universal App Shared Library Code doesn't get referenced properly in XAML of platform specific projects

I'm having an issue with a Universal Windows App and viewing a UserControl in Design view and Blend.

I have a BaseUserControl and some ValueConverters in the in the Shared Library. I reference the value converters in the App.xaml and the BaseUserControl is the Base for a specific UserControl I want to use Blend to help design.

I'm currently getting design-time errors in the Visual Studio XAML designer and in Blend:

The name "BaseUserControl" does not exist in the namespace "using:MyProject.Controls".

The designer view and Blend shows a box with the message:

Invalid Markup - Check the Error List for more information

I can build the project and run it and everything shows up and works fine.

How can I get the Shared Library code to be recognized in the Designer/XAML View and Blend?

UserControl is defined like so:

<controls:BaseUserControl x:Class="MyProject.Controls.Menu.LeftNavigation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:MyProject.Controls.Menu" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:MyProject.Controls" mc:Ignorable="d" Background="#232323" d:DesignHeight="800" d:DesignWidth="110" > ... </controls:BaseUserControl>

The code behind is simply:

namespace MyProject.Controls.Menu { public sealed partial class LeftNavigation : BaseUserControl { public LeftNavigation() { this.InitializeComponent(); } } }

-------------Problems Reply------------

I notice that you use controls:BaseUserControl which expands to MyProject.Controls.BaseUserControl. However, in your Code Behind you have set the namespace to MyProject.Controls.Menu. This will prevent the designer from finding your control.

Change the controls tag to:

xmlns:controls="using:MyProject.Controls.Menu"

Alternatively, change the namespace in the code behind to MyProject.Controls and then you can leave the xmlns:controls tag alone.

Also, I have seen the designer fail to notice new controls in the shared library in Universal apps (now called Windows Apps) developed in Visual Studio 2013 even when the namespace is correct. This can happen if the shared library was stale when you added your xaml tag to the page. If this happens, remove any of your attempts to include controls:BaseUserControl in your xaml temporarily.

Then, clean the solution and rebuild it. This will allow the Shared Library to rebuild properly, exposing the new tag to the designer. Finally, add your tag back in after the build is successful and build again.

I hope that helps someone. I just struggled with this very issue today.

Category:c# Views:1 Time:2015-01-14

Related post

  • Reflection in Windows Universal Apps 2015-01-14

    I need to use the GetProperties method so I can test whether any properties in a particular class has a specified custom attribute. However it doesn't appear as though Windows Universal Apps supports this: obj.GetType().GetProperties() Raises the err

  • Modify Qt's shared library code while application starts 2012-01-30

    I'm trying to create some kind of a server which allows me to start Qt's applications on remote machine via web browser. I'm wondering it is possible to change/hide some symbols from Qt library (I thought about QApplication or QCoreApplication) witho

  • linux g++ linking 64 bit shared library code to static libraries 2010-08-23

    Context: I can create a shared object library which is linked to a static library without any problems on 32bit linux. When I attempt the same build on 64bit linux, I see this linker error: relocation R_X86_64_32S against `a local symbol' can not be

  • Windows Phone app sharing/syncing playlists to phone after GDR2 fixes 2012-06-13

    I read in the Windows Phone Blog (here) that playlist sharing is only available in the Windows Phone app for Windows 8 running x86. That makes very little sense considering you must have a Windows 8 x64 to run certain WP8 developing tools... but what

  • Git setup for a collection of apps sharing volatile code 2011-08-29

    We have 7 apps (websites) all sharing a common submodule. website1.git website2.git ... shared_engine.git I think the submodule concept of tracking a commit rather than HEAD is great. Nice and predicatable... great for deployment. But, for developmen

  • Unable to install Windows 8 apps. Error code 0x80246008 . 2012-03-27

    Hi, I am using windows 8. when i open some apps it is asking to update but these r not installing and givig that "this application was installed" when i click on view details it is giving an error code: 0x80246008 and giving same error to windows upd

  • Unbale to install Windows and App updates, error code 0X8007005 2014-02-16

    Original Title: Windows Update I have Windows 8 and have difficulties getting the windows updates especially the ones for MS Office. Also I am not able neither to open my apps or to update them. Error code 0X8007005. All my desktop functions and prog

  • how to fix windows 8 app store error code 0x8020002e 2014-04-16

    so, I bought a new all in one touch screen dell for my birthday last month and I'm using a WiFi connection from my t-mobile Samsung galaxy s4 unlimited plan. I cant download or install any games or apps from the app store. could my internet connectio

  • Windows Media Player Shared Library Is Not Detected by Windows 7 Laptop 2014-06-15

    Hey all. I am using a laptop Windows Media Player 12 (12.0.7601.17514) on Windows 7 Ultimate Service Pack 1 (6.1.7601). I was recently messing with the media streaming settings on my home desktop PC (same Windows 7 and Windows Media Player versions a

  • Compile header-only template library into a shared library? 2011-09-08

    We are in the process of designing a new C++ library and decided to go with a template-based approach along with some specific partial template specialisations for corner cases. In particular, this will be a header-only template library. Now, there i

  • "Xaml Parsing Failed" on Windows Store Apps User Control Project 2012-10-28

    I must be missing something simple/fundamental that I failed to reference a Windows Store Apps Class Library/Windows Runtime Component in my Windows Store Apps Project. I stripped everything down to it's bare-bone state. This is what I've got: The Us

  • How send email with attachment in windows universall app 2014-09-26

    How can i send an email with attachment in windows universal app (windows phone 8.1 and windows 8.1) Class Windows.ApplicationModel.Email.EmailMessage is available only for windows phone --------------Solutions------------- There is no direct, in-box

  • Problem with debuging shared library in eclipse 2011-04-10

    My project consists of several shared libraries and one executable. I tried to debug my code from shared library but debugger never stops on breakpoints and I get warnings for each breakpoint: "Breakpoint attribute Problem: Installation Failed.". Can

  • shared library address space 2011-11-07

    While I was studying about shared library I read a statement Although the code of a shared library is shared among multiple processes, its variables are not. Each process that uses the library has its own copies of the global and static variables tha

  • VBA Shared Library on Mac OS X 2012-11-18

    I am attempting to access code that resides in a shared library from PowerPoint VBA. I can access the shared library code from another application. my VBA code is as follows: Private Declare Function mymod CDecl Lib "\usr\lib\libmylib.dylib" Alias "m

  • Execution flow of dynamic library code stub 2014-05-17

    There are few questions on StackOverflow with the similar title but this question addresses different issue. I have created a simple fprintf program which prints a certain value in a file. I wanted to understand the execution flow of the program with

  • Replacement of NavigationService.Navigate in Universal App 2015-03-10

    I am working in migration of project from windows phone 8.1 to windows universal app. windows phone 8.1 NavigationService can be implemented in Universal App with several methods of Navigation like Frame.Navigate(typeof(MainPage)); or Frame.Navigate(

  • g++ Undefined Symbol Error using shared library 2012-04-01

    The symbol is in the file. I verified it using nm & grep but I still get the undefined symbol error when I run the compiled application. Other symbols in the shared library are working just fine. The header file declares it as extern and it is no

  • About Windows 8 App Resolution 2013-08-31

    Hi, I am developing windows 8 app. I have taken 5-6 controls on BasicPage.XAML. Now , When I change my resolution some controls get disappear. This happen only when I change my resolution. Please help me out. --------------Solutions------------- You

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.084 (s). 11 q(s)