Hi,
how can I add the new xamColorPicker in a Cell of a Grid. Id' like to have it in each Cell of a column. Is this possible?
Thanks for helping!Gawain
Hello Gawain,
You can host a xamColorPicker just like any control in a XamDataGrid's cell. You can see samples of putting an Image in a Cell in the XamFeatureBrowser samples, or you can use this blog post by Andrew Smith : http://blogs.infragistics.com/blogs/andrew_smith/archive/2009/03/27/hosting-wpf-controls-in-a-xamdatagrid-cell.aspx
the sample is not really working with the latest versions. Can you please give me the basic code structure for my issue?
Is it possible to tell us what is not working with the latest versions? The host editor is an inherited ValueEditor and the samples in the XamFeatureBrowser are updated with every version.
the sample still uses version 9.1, which I don't have. After importing 10.1 into the project I get the following compiling error:
Error 1 FieldSettings.EditorStyle's TargetType setting can only be null or a type that derives from ValueEditor or is a base class of ValueEditor, ControlHostEditor is invalid.Parametername: FieldSettings.EditorStyle ...\HostAnyControl\HostAnyControl\Window1.xaml 61 37 HostAnyControl
I have attached a sample project with a XamColorPicker inside a XamDataGrid's cell
Hi Alex,
I have tried running this sample and I get the following exception as soon as I move the mouse cursor over the xamColorPicker control:
System.ArgumentException was unhandled Message=Value does not fall within the expected range. Source=mscorlib StackTrace: at System.StubHelpers.ObjectMarshaler.ConvertToNative(Object objSrc, IntPtr pDstVariant) at MS.Internal.Automation.UiaCoreProviderApi.RawUiaRaiseAutomationPropertyChangedEvent(IRawElementProviderSimple provider, Int32 id, Object oldValue, Object newValue) at System.Windows.Automation.Provider.AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(IRawElementProviderSimple element, AutomationPropertyChangedEventArgs e) at System.Windows.Automation.Peers.AutomationPeer.RaisePropertyChangedEvent(AutomationProperty property, Object oldValue, Object newValue) at Infragistics.AutomationPeers.XamColorPickerAutomationPeer.RaiseSelectionPropertyChangedEvent(Nullable`1 oldValue, Nullable`1 newValue) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\AutomationPeers\XamColorPickerAutomationPeer.cs:line 257 at Infragistics.AutomationPeers.XamColorPickerAutomationPeer.OwningColorPicker_SelectedColorChanged(Object sender, SelectedColorChangedEventArgs e) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\AutomationPeers\XamColorPickerAutomationPeer.cs:line 470 at Infragistics.Controls.Editors.XamColorPicker.OnSelectedColorChanged(SelectedColorChangedEventArgs args) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\XamColorPicker.cs:line 917 at Infragistics.Controls.Editors.XamColorPicker.SelectedColorPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\XamColorPicker.cs:line 438 at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.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.Controls.Editors.XamColorPicker.set_SelectedColor(Nullable`1 value) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\XamColorPicker.cs:line 416 at Infragistics.Controls.Editors.XamColorPicker.SoftSelectNewColor(Nullable`1 color) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\XamColorPicker.cs:line 116 at Infragistics.Controls.Editors.XamColorPicker.ColorStripManager_HoverColorItemChanged(Object sender, SelectedColorItemChangedEventArgs e) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\XamColorPicker.cs:line 1002 at Infragistics.Controls.Editors.Primitives.ColorStripManager.OnHoverColorItemChanged(ColorItem oldColorItem, ColorItem newColorItem) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\ColorStripManager.cs:line 250 at Infragistics.Controls.Editors.Primitives.ColorStripManager.set_HoverColorItem(ColorItem value) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\ColorStripManager.cs:line 78 at Infragistics.Controls.Editors.Primitives.ColorStripManager.ColorStrip_HoverColorItemChanged(Object sender, SelectedColorItemChangedEventArgs e) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\ColorStripManager.cs:line 323 at Infragistics.Controls.Editors.Primitives.ColorStrip.OnHoverColorItemChanged(ColorItem oldColorItem, ColorItem newColorItem) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\ColorStrip.cs:line 523 at Infragistics.Controls.Editors.Primitives.ColorStrip.set_HoverColorItem(ColorItem value) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\ColorStrip.cs:line 152 at Infragistics.Controls.Editors.Primitives.ColorItem.set_IsHover(Boolean value) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\ColorItem.cs:line 124 at Infragistics.Controls.Editors.Primitives.ColorItemBox.OnMouseEnter(MouseEventArgs e) in e:\Work\2\165\Sources\RELEASE\XAML\2010.2\Source\Infragistics.Silverlight.XamColorPicker\ColorBoxItem.cs:line 155 at System.Windows.UIElement.OnMouseEnterThunk(Object sender, MouseEventArgs e) at System.Windows.Input.MouseEventArgs.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.RaiseEvent(RoutedEventArgs e) at System.Windows.MouseOverProperty.FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, Boolean oldValue) at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action`2 originChangedAction) at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action`2 originChangedAction) at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action`2 originChangedAction) at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action`2 originChangedAction) at System.Windows.ReverseInheritProperty.OnOriginValueChanged(DependencyObject oldOrigin, DependencyObject newOrigin, IList`1 otherOrigins, DeferredElementTreeState& oldTreeState, Action`2 originChangedAction) at System.Windows.Input.MouseDevice.ChangeMouseOver(IInputElement mouseOver, Int32 timestamp) at System.Windows.Input.MouseDevice.PreNotifyInput(Object sender, NotifyInputEventArgs e) 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.InvokeImpl(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 XamDataGrid_ColorPicker.App.Main() in C:\Documents and Settings\japayne\Desktop\Code Snippets\Color Pickers\XamDataGrid_ColorPicker1\XamDataGrid_ColorPicker\obj\x86\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.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
This happens with 10.2, 10.2.2001, 10.2.2045 and 10.3. Any ideas what this is?
Thanks,
Jason
Hello Jason.
I downloaded and ran the sample that Alex attached to this thread. I was able to run it with no exceptions at all. I can drop the color picker down and select a value as well as hover the mouse over the cells and it all works fine. I tested it at the release build of 10.2 and ran it on a Windows XP virtual machine as well as my Windows 7 desktop and it worked both times.
What operating system are you running? Is there anything else unique about your PC that might have an impact?
Sincerely,
CharlieSenior Developer Support EngineerMCTS
This appears to have been addressed by development issue 82804 and the fix is in the latest service release for 2011 Volume 2 which you can download from they my keys and downloads page as long as your product key is registered.
Let me know if you have any questions with this matter.
I am also facing problem with Infragistics.Controls.Editors.XamMultiColumnComboEditor 11.2 version
Top-level ExceptionType: System.ArgumentExceptionMessage: Value does not fall within the expected range.Source: mscorlibStack Trace: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo) at MS.Internal.Automation.UiaCoreProviderApi.CheckError(Int32 hr) at System.Windows.Automation.Provider.AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(IRawElementProviderSimple element, AutomationPropertyChangedEventArgs e) at System.Windows.Automation.Peers.AutomationPeer.RaisePropertyChangedEvent(AutomationProperty property, Object oldValue, Object newValue) at Infragistics.AutomationPeers.XamComboEditorAutomationPeer`2.RaiseSelectionPropertyChangedEvent(Int32 oldValue, Int32 newValue) at Infragistics.AutomationPeers.XamComboEditorAutomationPeer`2.SelectedItems_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item) at System.Collections.ObjectModel.Collection`1.Add(T item) at Infragistics.Controls.Editors.ComboEditorBase`2.SelectItem(Object data, Int32 index, Boolean clearRestOfSelection) at Infragistics.Controls.Editors.ComboEditorBase`2.SelectItem(T item, Boolean clearRestOfSelection) at Infragistics.Controls.Editors.ComboEditorBase`2.OnComboEditorItemClicked(T comboEditorItem) at Infragistics.Controls.Editors.XamMultiColumnComboEditor.OnComboEditorItemClicked(ComboRow comboEditorItem) at Infragistics.Controls.Editors.ComboCellControl.OnMouseLeftButtonDown(MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseLeftButtonDownThunk(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.OnMouseDownThunk(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)
Hi Charlie,
We are experiencing the same problem with the xamColorPicker on Windows 7. Is there any updates on this issue?
Erik
I have created TFS issue #59706 for this.
I did some debugging with this and it appears to be a bug in our color picker and I am going to create a development issue for it. The only possible workaround would be to derive from the color picker and then override the OnCreateAutomationPeer method and return null. We don't have a definite workaround at this time, but this is a possibility. I will log this with oru developers and give you the TFS work item number.