I have a XamDataGrid where I'm trying to bind the ItemsSource for a XamMultiColumnComboEditor that gets created when the user enters edit mode. The dropdown values are dependent on things in other cells, so I have to take care of it in the code behind.
I assign the DataTemplates below in the FieldLayoutInitialized method. All is working except the binding to the ItemsSource.
<DataTemplate x:Key="DisplayTemplateKey">
<TextBlock Text="{editors:TemplateEditorValueBinding}" /> </DataTemplate> <DataTemplate x:Key="EditTemplateKey"> <ig:XamMultiColumnComboEditor ItemsSource="{Binding DropdownValues}" DisplayMemberPath="Value" DropDownButtonDisplayMode="MouseOver" CustomValueEnteredAction="Allow" EmptyText="Choose level..." SelectedItemsResetButtonVisibility="Collapsed" MinDropDownWidth="300" /> </DataTemplate>
There are not any binding errors in the output window, but the values are not shown.
DropdownValues is an IEnumerable of a simple data wrapper that just has a String Value in it. I am implementing INotifyPropertyChanged and calling RaisePropertyChanged on the setter for DropdownValues.
I have done Binding inside a DataTemplate before so I'm not sure why this is not working. The templates are defined in my UserControl's Resources block, maybe that is causing issues?
I tried moving the DataTemplates to the XamDataGrid Resources block or even the Grid Resources above that with no success (couldn't find resources from code behind).
Any help would be greatly appreciated.
Hello Jon,
I am just checking your progress on the issue that you are having.
If you require any further assistance please do not hesitate to ask.
Thank you for you posts.
I have been looking into it and I could not managed to reproduce the behavior that you have described. I set the MinDropDownWidth property of XamMultiColumnComboEditor and it works with the provided steps.I attached my sample application. If you are not able to reproduce the issue with the attached sample application, would you please modify it with the functionality, that you are using, so it reproduces the issue. This way I would be able to further investigate this for you and provide you with more detailed information on this matter. Would please provide me with more information about the version of assemblies that you are using? I created a short video to show you how it works on my side.
Looking forward to hearing from you.
UPDATE: The Add behavior was what I wanted, but there was a bug in my converter code.
As for the MinDropDownWidth crash, I did find a workaround by doing this.
private void XamMultiColumnComboEditor_OnDropDownOpening(object sender, CancelEventArgs e)
{ XamMultiColumnComboEditor editor = (XamMultiColumnComboEditor) sender; editor.MinDropDownWidth = 500; }
but a fix should be in order for that.
Thanks!
Jon
In addition to the bug above (I haven't tried this yet, but I imagine I can get around the bug above with a converter that forces the value to be at least 300 in the converter instead of using the property.), I am seeing another problem.
I have CustomValueEnteredAction="Allow" and I want the typed in value to be sent to the XamTextEditor, but I am receiving null in my converter. Any ideas? I did try using the "Add" value and wasn't seeing the behavior I wanted. Would you be able to modify the sample to show the requested behavior?
Thanks,
I ran into a bug when setting MinDropDownWidth.
On the sample you provided, just set
MinDropDownWidth="300"
and then run the program, open the dropdown, choose a value, and then click on another cell and you will get an exception.
System.ArgumentException was unhandled HResult=-2147024809 Message=-Infinity is not a valid value for property MinDropDownWidth. Source=InfragisticsWPF4.Controls.Editors.XamComboEditor.v14.2 StackTrace: at Infragistics.Controls.Editors.ComboEditorBase`2.OnMinDropDownWidthChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at Infragistics.Controls.Editors.ComboEditorBase`2.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue) at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot) at System.Windows.StyleHelper.ClearTemplateChain(HybridDictionary[] instanceData, FrameworkElement feContainer, FrameworkContentElement fceContainer, List`1 templateChain, FrameworkTemplate oldFrameworkTemplate) at System.Windows.StyleHelper.ClearGeneratedSubTree(HybridDictionary[] instanceData, FrameworkElement feContainer, FrameworkContentElement fceContainer, FrameworkTemplate oldFrameworkTemplate) at System.Windows.StyleHelper.DoTemplateInvalidations(FrameworkElement feContainer, FrameworkTemplate oldFrameworkTemplate) at System.Windows.Controls.Control.OnTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at Infragistics.Windows.Editors.ValueEditor.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at Infragistics.Windows.Editors.TextEditorBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.CoerceValue(DependencyProperty dp) at Infragistics.Windows.Editors.ValueEditor.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at Infragistics.Windows.Editors.TextEditorBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Infragistics.Windows.Editors.ValueEditor.EndEditMode(Boolean acceptChanges, Boolean force) at Infragistics.Windows.DataPresenter.DataPresenterBase.ClearActiveCell(Boolean shutdown, Boolean calledFromSetActiveCell) at Infragistics.Windows.DataPresenter.DataPresenterBase.OnActiveRecordCleared(Boolean update) at Infragistics.Windows.DataPresenter.DataPresenterBase.SetActiveRecord(Record record, Boolean scrollIntoView) at Infragistics.Windows.DataPresenter.DataPresenterBase.OnCoerceActiveRecord(DependencyObject target, Object value) at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, Object controlValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean skipBaseValueChecks) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Infragistics.Windows.DataPresenter.DataPresenterBase.Infragistics.Windows.Selection.ISelectionHost.ActivateItem(ISelectableItem item, Boolean preventScrollItemIntoView) at Infragistics.Windows.DataPresenter.CellValuePresenter.ActivateAndEnterEditMode() at Infragistics.Windows.DataPresenter.CellValuePresenter.ProcessPreviewMouseLeftButtonDown(MouseButtonEventArgs e) at Infragistics.Windows.Editors.ValuePresenter.OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) at System.Windows.UIElement.OnPreviewMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnPreviewMouseDownThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at MultiColumnComboEditorXDG.App.Main() in c:\Users\jon\Downloads\MultiColumnComboEditorXDG1\MultiColumnComboEditorXDG\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
Please advise if there is a workaround for this.