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

'System.Windows.Controls.Panel.Children' is set more than once. [Line: 339 Position: 18]

11 Answers 269 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 21 Apr 2010, 04:12 AM
I resolved this by upgrading to the SL4 controls 

11 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 21 Apr 2010, 02:29 PM
I too saw this issue when using the Silverlight 3 controls. Upgrading to the SIlverlight 4 controls resulted in a different error for me:

Failed to create a 'System.Windows.DependencyProperty' from the text 'animation:AnimationManager.AnimationSelector'. [Line: 6 Position: 34]

So far I am only referencing Telerik.Windows.Controls and Telerik.Windows.Controls.Input. Is there another Silverlight 4 reference I need to add?

Thanks
0
Eric
Top achievements
Rank 1
answered on 21 Apr 2010, 02:38 PM
On this site I went to "your account" "downloads" "latest internal builds"

Get the SL4 zip file, unzip it to a new folder (I created one in program files\telerik)

In your project - delete the current references you have
add in new references for the same DLLs but from the above (new) folder

Save, exit vs2010, restart and run
My project is using 5 dlls (input, navigation, data, charting, controls) and I did not have to add anything else/new

On the silverlight tab of your client side project make sure the targer silverlight version is 4
0
Chris
Top achievements
Rank 1
answered on 21 Apr 2010, 03:22 PM
Hi,
I followed your instructions and still see the same error. It occurs right on the InitializeComponent(). I should probably have mentioned that I am still on the Release Candidate of Visual Studio 2010.
0
Eric
Top achievements
Rank 1
answered on 21 Apr 2010, 04:36 PM
I've installed the released version of 2010, toolkit etc.  takes hours but might be worth it.  Apart from that you probably need help from Telerik proper.
0
Valeri Hristov
Telerik team
answered on 26 Apr 2010, 11:19 AM
Hello Eric, Chris,

Silverlight 4 XAML parser is more "strict" than the Silverlight 3's parser and it throws exceptions for code that worked well in Silverlight 3. That's why you should use our Silverlight 4 assemblies in Silverlight 4 applications.

All the best,
Valeri Hristov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Simon Wolters
Top achievements
Rank 1
answered on 27 Apr 2010, 10:06 AM
I also get the exception after upgrading my projects from SL3 to SL4 and replacing all the assemblies and references with the v422 telerik release:
Failed to create a 'System.Windows.DependencyProperty' from the text 'animation:AnimationManager.AnimationSelector'.

The inner exception says:
{System.TypeInitializationException: Der Typeninitialisierer für "Telerik.Windows.Controls.Animation.AnimationManager" hat eine Ausnahme verursacht. ---> System.TypeLoadException: Der Typ 'System.Action' konnte nicht aus der mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -Assembly geladen werden.
   bei Telerik.Windows.Controls.Animation.AnimationManager..cctor()
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.Runtime.CompilerServices.RuntimeHelpers._RunClassConstructor(RuntimeType type)
   bei System.Windows.DependencyProperty.QueryRegisteredProperty(String name, Type ownerType)
   bei MS.Internal.ManagedTypeInfoProviderRPInvokes.LookupDependencyProperty(Type type, String name)
   bei MS.Internal.ManagedTypeInfoProviderRPInvokes.ResolveDependencyPropertyName(XamlTypeToken sTypeToken, String inPropertyName, XamlPropertyToken& outProperty, XamlTypeToken& outPropertyTypeToken)}






I removed all the mentioned extension properties for animations from my controls but still get the error. I guess the problem is that your themes are using these properties as well.
0
Valeri Hristov
Telerik team
answered on 27 Apr 2010, 11:01 AM
Hi Simon,

I already answered the following thread:
http://www.telerik.com/community/forums/silverlight/combobox/error-using-silverlight-4-controls.aspx

The exception should disappear if you update the Silverlight runtime to version 4.0.50401.

Kind regards,
Valeri Hristov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Simon Wolters
Top achievements
Rank 1
answered on 28 Apr 2010, 08:03 AM
Hi Valeri,

thank you - indeed the exception is gone after the SL runtime upgrade.
Now I unfortunately get the same exception as mentioned by the thread creator:
'System.Windows.Controls.Panel.Children' is set more than once.

I am using a custom theme that is based on the telerik v3.09 windows 7 theme. If I disable this theme and use your default theme, the solution works fine. Do you know which propertie(s) are causing this error in SL4? I'd rather fix those than reapply my custom theming to the new version.
0
Valeri Hristov
Telerik team
answered on 29 Apr 2010, 11:11 AM
Hello Simon,

The "'System.Windows.Controls.Panel.Children' is set more than once" exception is caused by invalid XAML: in Silverlight 4 setting attached properties inside the content of an element is considered an error, hence the exception. For example the following XAML is wrong:
<Grid>
    <Border />
    <VisualStyleManager.VisualStateGroups>
    ...
    </VisualStyleManager.VisualStateGroups>
    <StackPanel />
</Grid>

but the following is OK:
<Grid>
    <VisualStyleManager.VisualStateGroups>
    ...
    </VisualStyleManager.VisualStateGroups>
    <Border />
    <StackPanel />
</Grid>

note that to fix the problem, the attached property VisualStateGroups should be the first XML element inside the Grid element. This XAML used to work fine in Silverlight 3 and the early versions of Silverlight 4.

Sincerely yours,
Valeri Hristov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Simon Wolters
Top achievements
Rank 1
answered on 29 Apr 2010, 01:11 PM
That did the trick!

Thank you very much. The telerik support is really awesome.
0
Mike Lee
Top achievements
Rank 1
answered on 01 Sep 2010, 10:47 PM
Thanks for this solution.  We've been trying to figure this out for weeks, and thought we introduced a bad element into our theme.  Basically, we took the template for the radcombobox and moved the VisualStateManager to the top of the grid, and moved a border to the bottom to get rid of the error.  Thanks!

This snippet:
<vsm:VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="CommonStates">
        <VisualState x:Name="Normal" />
        <VisualState x:Name="MouseOver">
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonChrome" Storyboard.TargetProperty="RenderHighlighted">
                    <DiscreteObjectKeyFrame KeyTime="0:0:0">
                        <DiscreteObjectKeyFrame.Value>
                            <sys:Boolean>True</sys:Boolean>
                        </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
        <VisualState x:Name="Disabled">
            <Storyboard>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Opacity">
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.33" />
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
    </VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
 
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" />



- Mike
www.eikospartners.com
Tags
ComboBox
Asked by
Eric
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Eric
Top achievements
Rank 1
Valeri Hristov
Telerik team
Simon Wolters
Top achievements
Rank 1
Mike Lee
Top achievements
Rank 1
Share this question
or