Skip to main content

Microsoft Silverlight

Answered Question "AG_E_PARSER_BAD_PROPERTY_VALUE" What is it?RSS Feed

(1)

gnogna82
gnogna82

Member

Member

0 points

4 Posts

"AG_E_PARSER_BAD_PROPERTY_VALUE" What is it?

Hi All,

I am creating my custom control. In file mycustomcontrol.vb:

Partial Public Class MyCustomControl
Inherits Control
...
Public ReadOnly TitleProperty As DependencyProperty = DependencyProperty.Register("Title", GetType(String()), GetType(MyCustomControl()), Nothing)

Public Property Title() As String
Get
Return CType(GetValue(TitleProperty), String)
End Get
Set(ByVal value As String)
SetValue(TitleProperty, value)
End Set
End Property

And in my generic.xaml:

...<TextBlock x:Name="TitleBlock" Grid.Row="1" Grid.Column="1" Margin="3" FontFamily="Verdana" FontSize="16"
Foreground="#FFFFFFFF" Text="{TemplateBinding Title}" HorizontalAlignment="Center" VerticalAlignment="Center"/>...

But when I try to reference it in my page.xaml like this:

 <dr:CustomEntryControl Title="blah"></dr:CustomEntryControl>

I receive this error:

 Error 1 AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 22 Position: 37] ...Page.xaml ...

Obviously the help doesn' help at all, and after googling a lot I found nothing. Any ideas?

Best regards,
Dario Rossa

Jim Mangaly
Jim Mangaly

Contributor

Contributor

2622 points

381 Posts

Re: &quot;AG_E_PARSER_BAD_PROPERTY_VALUE&quot; What is it?

What do you have in line 22 of Page.xaml?

Jim (http://jimmangaly.blogspot.com/)

Please MARK the replies as answers if they answered your question

http://www.identitymine.com/

gnogna82
gnogna82

Member

Member

0 points

4 Posts

Re: &quot;AG_E_PARSER_BAD_PROPERTY_VALUE&quot; What is it?

Hi Jim,

sorry, I didn't tell, line 22 of page.xaml doesn't exist! It has only 16 lines. The one I posted is line 14:

 <dr:CustomEntryControl Title="blah"></dr:CustomEntryControl> 

it doesn't matter whatever I set the property, the error keeps showing. I guess it has something to do with my VB code, since Karen Corby's example works smooth (it is C#). But I cannot realize what, since the help doesn't help and the error cannot be found in Google. Quite strange.

Below is a screenshot:

Best regards,
Dario Rossa

Jim Mangaly
Jim Mangaly

Contributor

Contributor

2622 points

381 Posts

Re: &quot;AG_E_PARSER_BAD_PROPERTY_VALUE&quot; What is it?

Hi Dario,

I'm not very familiar with VB.Net. But I think the problem is with the way you have defined your DependencyProperty. Try changing it to this:

Public ReadOnly TitleProperty As DependencyProperty = DependencyProperty.Register("Title", GetType(String), GetType(MyCustomControl), Nothing)

Basically just remove the brackets that follow String and MyCustomControl

Jim (http://jimmangaly.blogspot.com/)

Please MARK the replies as answers if they answered your question

http://www.identitymine.com/

hari4u
hari4u

Member

Member

39 points

78 Posts

Re: Re: &amp;quot;AG_E_PARSER_BAD_PROPERTY_VALUE&amp;quot; What is it?

hi ,

you might miss events which are declared in xaml but not in xaml.vb ,

or u might have a property which is not defined in your project or as in xaml control properties.

I think the problem is with dr content ..make sure you add correct namespace of  dr in your present xaml page..

Hari. 

gnogna82
gnogna82

Member

Member

0 points

4 Posts

Re: Re: &amp;quot;AG_E_PARSER_BAD_PROPERTY_VALUE&amp;quot; What is it?

Hi Jim, hi Hari,

thank you very much both for your help. This is the syntax I finally used:

Public ReadOnly TitleProperty As DependencyProperty = DependencyProperty.Register("Title", GetType(String), GetType(CustomEntryControl), Nothing)

Public
Property Title() As String
Get
Return CType(GetValue(TitleProperty), String)
End Get
Set(ByVal value As String)
SetValue(TitleProperty, value)
End Set
End Property

Unfortunately the problem persisted, so I started randomly delving in the rest of the code in the hunt of the culprit, and surprise! Now it magically disappeared, and I cannot recall what did fix it! I someone encounters the same issue please let me know and I can send the entire code. I wish you a good day!

Best regards,
Dario Rossa

ivanatilca
ivanatilca

Member

Member

113 points

110 Posts

Answered Question

Re: Re: &amp;quot;AG_E_PARSER_BAD_PROPERTY_VALUE&amp;quot; What is it?

The age parse error cames up when u are not declaring an event in the code behind and it is in the xaml part... as i can see u have no declared event... try to remove de

XMLS:dr="" in your Usercontrol header... and the CustomEntrycontrol to checkout if that's the problem... if it is... then this event is missing in Entrycontrol.xaml...

Age parse error does not tell u that the error is in a clr u are calling but in the line where it is loaded...

Hope it help...

 Remember to click on right answer if this helps

Ivana A. Tilca | Microsoft Student Partner | Channel 8 editor | Microsoft

http://ivanatilca.com.ar
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities