This is a migrated thread and some comments may be shown as answers.

XamlParseException Occured

10 Answers 93 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 2
Adam asked on 16 May 2012, 04:19 PM
I'm getting the XamlParseException error when I try to add a RadListBox to my user control via XAML.Not a lot to the code here,

<telerik:RadListBox x:Name="lstTitle" Grid.Column="8" telerik:StyleManager.Theme="Transparent">
                    <telerik:RadListBoxItem Content="Test"/>
</telerik:RadListBox>

The exception is attached.

The regular ListBox works fine but the Telerik ListBox throws the error.

Also, I can add the RadListBox from code behind and I do NOT get the error.

Thoughts?

Thanks,
Adam

10 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 17 May 2012, 12:13 PM
Hello Adam,

Can you please give us some more details about which version of RadControls is used? Moreover, is this a Silverlight 4 or 5?

Greetings,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 2
answered on 17 May 2012, 01:13 PM
Certainly,
We're running Silverlight 4. Telerik Controls version 2012.1.326.1040

It looks like the regular list box is going to work just fine but was curious about the error.

Thx
Adam
0
Accepted
Georgi
Telerik team
answered on 18 May 2012, 01:05 PM
Hello Adam,

We were able  to reproduce it with Silverlight 4 plugin. The issue is logged here in our Public Issue Tracking System. There you can track the progress of fixing it. Also your Telerik points have been updated for the report.

Greetings,
Georgi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 2
answered on 18 May 2012, 01:47 PM
Thanks Georgi.

Adam
0
Karen
Top achievements
Rank 1
answered on 26 May 2015, 05:29 PM

I am getting the same error with Silverlight 5 and the latest version of the UI for Silverlight. Your link to the Public Issue Tracking Forum no longer works. My list box has draggable items, and if I comment out the draganddrop portion of the xaml I don't get the error.

System.Windows.Markup.XamlParseException occurred
  Message= [Line: 0 Position: 0]
  LineNumber=0
  LinePosition=0
  StackTrace:
       at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
  InnerException: System.Windows.Markup.XamlParseException
       Message= [Line: 0 Position: 0]
       LineNumber=0
       LinePosition=0
       StackTrace:
            at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
            at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
            at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
            at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
            at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
            at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
            at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
            at Telerik.Windows.Controls.ItemsControl.PrepareContentControl(Object item, ContentControl element)
            at Telerik.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(DependencyObject element, Object item)
            at Telerik.Windows.Controls.Primitives.ListControl.PrepareContainerForItemOverride(DependencyObject element, Object item)
            at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
            at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
            at System.Windows.Controls.VirtualizingStackPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled)
            at System.Windows.Controls.VirtualizingStackPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized)
            at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint)
            at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       InnerException: 

Nothing is on the stack that I can debug without debugging into .Net internals. I do not want to post the code publicly, can I email it to you? 

0
Georgi
Telerik team
answered on 27 May 2015, 06:59 AM
Hello Karen,

First of all we are sorry for the not working link as this is due to migration from the PITS system to the new Feedback portal. Also, please note that the initial issue was fixed in the Q2 2012 SP version of the controls and we are not able to reproduce it ever since.

So as this could be the same exception caused from the DragAndDrop for example and therefore we have tired several scenarios in order to reproduce it, but still no luck.
Nevertheless I am attaching my test project and it would be great if you can check it out and let me know if I am not missing something.
Also does this happens again only with static items (defined in xaml)?

Looking forward to your reply.


Regards,
Georgi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Karen
Top achievements
Rank 1
answered on 27 May 2015, 12:40 PM

Georgi,

Your listbox items don't have the capture drag/drop property set, mine do:

<Style x:Key="DraggableQAListBoxItem" TargetType="ListBoxItem">
<Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
</Style>

 ...

<telerik:RadListBox x:Name="QuickAlertsListBox" d:LayoutOverrides="GridBox" Foreground="{x:Null}"
ItemContainerStyle="{StaticResource DraggableQAListBoxItem}" AllowDrop="True"
ScrollViewer.VerticalScrollBarVisibility="Auto" Grid.Row="1" BorderBrush="{x:Null}"
Background="{StaticResource AppBackground}" Margin="0,0,0,0" Width="170" HorizontalAlignment="Left">
<drag:ListBoxDragDrop.Behavior>
<drag:ListBoxDragDropBehavior />
</drag:ListBoxDragDrop.Behavior>

 

That is a different type of drag and drop behavior, correct? This is legacy code, I didn't write it, but it used to work.

0
Georgi
Telerik team
answered on 28 May 2015, 11:59 AM
Hello Karen,

Please note, that  you can find the setting of the AllowCapturedDrag in the RadListBox style located in the App.xaml file of the sent project.

So we have notice that probably(TargetType="ListBoxItem") you are using Microsoft ListBoxItem inside RadListBox and we recommend using the RadListBoxItem instead.

Also there are two different drag and drop behaviors:
  • ListBoxDragDrop.Behavior - intended for providing drag and drop functionality via the Telerik DragAndDropManager for the Microsoft ListBox.
  • RadListBox.DragDropBehavior - intended for providing drag and drop functionality via the Telerik DragAndDropManager for the RadListBox.

Therefore we recommend using the RadListBox with the  RadListBox.DragDropBehavior as shown in this help article.

Hope this is helpful and if you have any other questions, please don't hesitate to contact us.

Regards,

Georgi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Karen
Top achievements
Rank 1
answered on 28 May 2015, 03:39 PM
Thanks, Georgi, that was the problem. Shouldn't there be some type of warning on the "bad xaml" for that TargetType parameter?
0
Georgi
Telerik team
answered on 29 May 2015, 09:07 AM
Hi Karen,

I am glad that we were able to locate the source of the issue. So usually the XamlParseException is indication of a "bad xaml", but nevertheless we will check if we can add some precautions for this scenario.

Thank you for the feedback and if you have any questions or ideas for improvements, please don't hesitate to write us.

Regards,
Georgi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListBox
Asked by
Adam
Top achievements
Rank 2
Answers by
George
Telerik team
Adam
Top achievements
Rank 2
Georgi
Telerik team
Karen
Top achievements
Rank 1
Share this question
or