Possible to Bind a ConverterParameter in RadComboBox?

2 posts, 0 answers
  1. Kelly
    Kelly avatar
    73 posts
    Member since:
    Apr 2011

    Posted 02 Dec 2011 Link to this post

    Hello,

    I'm trying to bind the SelectedItem of the RadComboBox. I need to pass the ItemsSource of the combobox to the Converter used for Selected Item. Everyt time I try to bind anything to the ConverterParameter, I get the following when parsing the xaml in InitializeComponent:

    {System.Windows.ApplicationUnhandledExceptionEventArgs}
        base {System.EventArgs}: {System.Windows.ApplicationUnhandledExceptionEventArgs}
        ExceptionObject: {System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Windows.Markup.XamlParseException: Provide value on 'System.Windows.Data.Binding' threw an exception. [Line: 101 Position: 98] ---> System.InvalidOperationException: Operation is not valid due to the current state of the object.
       at MS.Internal.XamlManagedRuntimeRPInvokes.TryApplyMarkupExtensionValue(Object target, XamlPropertyToken propertyToken, Object value)
       at MS.Internal.XamlManagedRuntimeRPInvokes.SetValue(XamlTypeToken inType, XamlQualifiedObject& inObj, XamlPropertyToken inProperty, XamlQualifiedObject& inValue)
       --- End of inner exception stack trace ---
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at AttnHistory.Views.HistoryView.InitializeComponent()
       at AttnHistory.Views.HistoryView..ctor()
       --- End of inner exception stack trace ---
       at System.Windows.Navigation.PageResourceContentLoader.EndLoad(IAsyncResult asyncResult)
       at System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)
       at System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result)
       at System.Windows.Navigation.PageResourceContentLoader.<>c__DisplayClass4.<BeginLoad>b__0(Object args)}
        Handled: false

    My latest attempt at binding is:
    <telerik:RadComboBox ItemsSource="{Binding Periods}"
              DisplayMemberPath="Header"
              SelectedItem="{Binding CurrentView.Period, Mode=TwoWay,
                        Converter={StaticResource PeriodConverter}, ConverterParameter={Binding Periods}}">

    No errors if I leave out the ConverterParameter, but then my Converter won't function correctly.  The same binding works correctly for the ItemsSource.

    Thank you,

    KO
  2. Kelly
    Kelly avatar
    73 posts
    Member since:
    Apr 2011

    Posted 02 Dec 2011 Link to this post

    Never mind, after much looking I found out this cannot be done in Silverlight. I'll find a hack of some kind. Thanks.
  3. DevCraft banner
Back to Top