Skip to main content

Microsoft Silverlight

Unanswered Question Error Please Help! Error 1 undeclared prefix [Line: 6 Position: 76] RSS Feed

(0)

matt.raffel
matt.raffel

Member

Member

1 points

13 Posts

Error Please Help! Error 1 undeclared prefix [Line: 6 Position: 76]

 I am getting this error:   Error    1    undeclared prefix [Line: 6 Position: 76]   

And it is keeping me from being able to use the designer.  I do not understand why and really could some help understanding what is the problem.   This is the xaml below.  It's pretty simple.

 

<UserControl
x:Class="Greed.Application.DefaultWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="1024"
Height="768"
>

<Border
x:Name="LayoutRoot"
BorderBrush="Silver"
BorderThickness="5"
CornerRadius="5"
>
</Border>
</UserControl>
 
 

 Thnx

Matt

jay nanavati
jay nana...

Contributor

Contributor

3388 points

624 Posts

Re: Error Please Help! Error 1 undeclared prefix [Line: 6 Position: 76]

Can you describe your project structure? There should be problem with Greed.Application.DefaultWindow name space.

Jay K Nanavaty
www.technologyopinion.com
Mark as answer if it helps. It will also help others...

matt.raffel
matt.raffel

Member

Member

1 points

13 Posts

Re: Error Please Help! Error 1 undeclared prefix [Line: 6 Position: 76]

 What information is needed to help describe the project structure?

 

Matt

matt.raffel
matt.raffel

Member

Member

1 points

13 Posts

Re: Error Please Help! Error 1 undeclared prefix [Line: 6 Position: 76]

 So in looking around project structure, I looked at my "app" code:

  

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Greed.Data.Converters;assembly=Greed.Data"
x:Class="Greed.Application.App"
>
<Application.Resources>
<converters:BoolToVisibleConverter x:Key="BoolToVisibleConverter" />
</Application.Resources>
</Application>
 

I found my problem.   I do not understand why but the problem has to the with the BoolToVisibleConverter.   Removing the resource allowed the designer to show for my UserControl (code first post).

 This is the converter code: 

namespace Greed.Data.Converters
{
public class BoolToVisibleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool objectValue = System.Convert.ToBoolean(value);

if (true == objectValue)
return Visibility.Visible;

return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
Visibility visibility = (Visibility)value;
if (Visibility.Visible == visibility)
return true;

return false;
}
}

}

 

I know that converters in silverlight are not the same as in wpf.  But I thought this was an ok converter.   Any ideas why this might be a problem?

Thnx

Matt

 

 

 

Amanda Wang - MSFT
Amanda W...

All-Star

All-Star

17241 points

1,466 Posts

Re: Error Please Help! Error 1 undeclared prefix [Line: 6 Position: 76]

 Hi Matt,

You can try to refer below bold code to refer your converter.

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Greed.Data.Converters"
x:Class="Greed.Application.App" >
<Application.Resources>
<converters:BoolToVisibleConverter x:Key="BoolToVisibleConverter" />
</Application.Resources>
</Application>

 

Amanda Wang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

matt.raffel
matt.raffel

Member

Member

1 points

13 Posts

Re: Error Please Help! Error 1 undeclared prefix [Line: 6 Position: 76]

I didn't state in my previous post that the converter class was in a separate assembly.   Looking at your changes, I'm guessing you assumed it was in the same assembly as the application...correct?

Matt

matt.raffel
matt.raffel

Member

Member

1 points

13 Posts

Re: Error Please Help! Error 1 undeclared prefix [Line: 6 Position: 76]

 It's been awhile since I had to deal with this issue, however I believe the problem is you cannot declare converters in the app xaml.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities