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

Possible to Bind a ConverterParameter in RadComboBox?

1 Answer 49 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kelly
Top achievements
Rank 1
Kelly asked on 02 Dec 2011, 09:37 PM
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

1 Answer, 1 is accepted

Sort by
0
Kelly
Top achievements
Rank 1
answered on 02 Dec 2011, 11:01 PM
Never mind, after much looking I found out this cannot be done in Silverlight. I'll find a hack of some kind. Thanks.
Tags
ComboBox
Asked by
Kelly
Top achievements
Rank 1
Answers by
Kelly
Top achievements
Rank 1
Share this question
or