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

setting content causing ArgumentException

1 Answer 58 Views
TransitionControl
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Big G
Top achievements
Rank 1
Big G asked on 06 Feb 2013, 09:47 AM
ok I had a RadTransitionControl that when I click a button I set its content which im guessing should force it to play an animation/transition

so here it what I do and what happens

spRunMenu.Visibility = System.Windows.Visibility.Visible;
rtcRunMenu.Content = spRunMenu;

spRunMenu is a stackpanel containing buttons.
rtcRunMenu is the RadTransitionControl

I get the following message when setting the content.

System.ArgumentException was unhandled by user code
  HResult=-2147024809
  Message=Value does not fall within the expected range.
  Source=System.Windows
  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)
       at System.Windows.Controls.ContentControl.set_Content(Object value)
       at MyRun.MainPage.sbShowMenu_Completed(Object sender, EventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
  InnerException:

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 11 Feb 2013, 11:53 AM
Hello Gareth,

Thank you for contacting us.

This behavior is normal. The Content property is used to display a certain object and place it inside the DataTemplate specified as ContentTemplate. In order to set a StackPanel inside the TransitionControl, you need to use the ContentTemplate property and set a new DataTemplate to it. Here is an example, if you add a template to the resources of the page:
<DataTemplate x:Name="template1">
    <StackPanel>
        <Button Content="one" Click="Button_Click"/>
        <Button Content="{Binding}"/>
    </StackPanel>
</DataTemplate>

You can then use it and set it as ContentTemplate to the TransitionControl:
transitionControl.ContentTemplate = this.Resources["template1"] as DataTemplate;
transitionControl.Content = "button 1";

I hope this information helps. Let me know if I can assist you further.

Regards,
Todor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
TransitionControl
Asked by
Big G
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or