Skip to main content

Microsoft Silverlight

Answered Question ParserError- Unknown element: ButtonRSS Feed

(0)

ritesh totlani
ritesh t...

Member

Member

2 points

7 Posts

ParserError- Unknown element: Button

Hi, I am using Silverlight 3. I am creating a Silverlight web script application. I have made sure that Silverlight 3 is installed. Please let me know any reason for this issue

anil_litam
anil_litam

Member

Member

558 points

262 Posts

Re: ParserError- Unknown element: Button

Hi,

Is XAML showing this error..?

Please share your XAML code for better understanding..

ritesh totlani
ritesh t...

Member

Member

2 points

7 Posts

Re: Re: ParserError- Unknown element: Button

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24979 points

2,434 Posts

Microsoft

Re: Re: ParserError- Unknown element: Button

Hi Ritesh,

How's your issue going now?   Please compare your code with the below sample.

<UserControl x:Class="SLProjectTest.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
  <Grid x:Name="LayoutRoot">
        <Button Content="btn" Width="150" Height="30"></Button>
  </Grid>
</UserControl>

Best regards,

Jonathan 

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

ritesh totlani
ritesh t...

Member

Member

2 points

7 Posts

Re: Re: ParserError- Unknown element: Button

Hi Jonathon,

The issue is still not fixed. I am creating a Silverlight script application for which it is failing.  

   
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 

xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

mc:Ignorable="d"

Background="LightYellow" > 
<Grid.RowDefinitions>

<RowDefinition Height="40" /> 
<RowDefinition Height="40" />

<RowDefinition Height="20" /> 
</Grid.RowDefinitions>

<Grid Grid.Row="0" MouseLeftButtonUp="onMouseEnter" > 
<Grid.RowDefinitions>

<RowDefinition Height="20" /> 
<RowDefinition Height="20" />

</Grid.RowDefinitions> 
<TextBox Grid.Row="0"

Width="80"

Text="GP 1"

Visibility="Visible" /> 
<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

Grid.Row="1"

Width="80"

Content="GP 1"

Visibility="Visible" /> 
</Grid>

<Grid Grid.Row="1"> 
<Grid.RowDefinitions>

<RowDefinition Height="20" /> 
<RowDefinition Height="20" />

</Grid.RowDefinitions> 
<TextBlock Grid.Row="0"

Width="80"

Text="GP 2"

Visibility="Visible" /> 
<TextBlock Grid.Row="1"

Width="80"

Text="102"

Visibility="Visible" /> </Grid> 
</Grid>
 

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24979 points

2,434 Posts

Microsoft

Re: Re: ParserError- Unknown element: Button

Hi Ritesh,

Copied your code to my test sample and it works on my computer.   Please take a look at the video tutorials here.

Best regards,

Jonathan

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

ritesh totlani
ritesh t...

Member

Member

2 points

7 Posts

Re: Re: ParserError- Unknown element: Button

hi Jonathan, Are you testing this in "Silverlight Script Web" or a "Silverlight application". It is working in "Silverlight application" on my side. I have any other query for the SIlverlight. Is it possible to create custom controls in Silverlight on the runtime on the server side.

Wolf Schmidt (MSFT)
Wolf Sch...

Member

Member

489 points

79 Posts

Microsoft
Answered Question

Re: ParserError- Unknown element: Button

Button is one of the objects that will require managed activation to use. This means that your application needs to not be using the web script application template; that template specifically avoids the settings that cause the SL runtime to load any of the managed/CLR components.

The list of objects that you can use without the managed activation is finite. For the most part it's the object set as documented in the existing MSDN reference section for JavaScript API for Silverlight: http://msdn.microsoft.com/en-us/library/bb980170(VS.95).aspx - there are also a few cases where maybe the parser w/o managed activation can create objects but you then get dead-ended because of how the runtime acts - an example of that case is <Style>.

If you can't go to managed runtime for whatever reason (some particular scenario, or you're writing a splash screen) your best bet may be to simulate a button with the panels you have available and handle MouseLeftButton down for click-type event.

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24979 points

2,434 Posts

Microsoft
Answered Question

Re: Re: ParserError- Unknown element: Button

Hi Ritesh,

Ah.  You are using Silverlight Script Web and Button is not supported in your scenario.  Silverlight 1.0 is not commended.  We can create a Silverlight 3 application.  At the meanwhile, Javascript can be used to interact with our Silverlight application.

http://timheuer.com/blog/archive/2008/03/09/calling-javascript-functions-from-silverlight-2.aspx

http://weblogs.asp.net/mschwarz/archive/2007/06/01/call-scribtable-methods-from-javascript-with-silverlight.aspx

Best regards,

Jonathan 

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

slyi
slyi

Participant

Participant

828 points

256 Posts

Re: Re: ParserError- Unknown element: Button

In the JS object model your selection of controls is limited. What you can do is to extract the template of button using delay's SilverlightDefaultStyleBrowser and then style the usercontrol as button.

JS button sample on http://cid-289eaf995528b9fd.skydrive.live.com/self.aspx/Public/SLjQueryBinding.zip

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities