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

RadCheckBoxElement does not show difference when tristate and set to ToggleState.Indeterminate

8 Answers 277 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 1
Jack asked on 12 Nov 2008, 11:42 AM
Hello Telerik team.

NOTE: this issue appies to  RadCheckBox (and derived/related) in general.

I've noticed that when using a RadCheckBox in either a winform or a as RadCheckBoxkElement (as custom cell edit control in a grid cell) it shows a checkmark when it is set the value Indeterminate.

This occurs as well as for invokation by the user as well as programatically.

MS's checkbox has a nice square to indicate that the value of the checkbox is indeterminate. So Telerik showing a checkmark for both checked and indeterminate is quite confusing to a user.

On a usercontrol / winform the workaround is simple: Just use the MS checkbox instead.
However, as a RadCheckBoxElement in a gridview, there is no workaround for this....??????:


Please let me know how I can use the RadCheckBoxElement in the radgridview cell and see the differnce between Checked, Unchecked and Indeterminate visually.

Kind regards,

Jack

8 Answers, 1 is accepted

Sort by
0
Jack
Top achievements
Rank 1
answered on 18 Nov 2008, 01:00 PM
A response to my message would be nice! ;-)
0
Nikolay
Telerik team
answered on 18 Nov 2008, 03:14 PM
Hi Jack,

Please excuse me for the delayed response.

We realize that the third visual state is an important feature for RadCheckBox. Therefore, we will implement it in one of our next releases. For the time being there is a workaround that you can use. This workaround concerns creating your custom grid cell and inserting a Microsoft checkbox in it. In addition, since it is a ThreeState checkbox, you should make your own implementation for the values kept in the cells. I am using a GridViewDecimalColumn to store values -1, 0 and 1 which are transformed to the check states.
A sample project is attached to demonstrate the approach.

I hope this helps. If you have additional questions, feel free to contact me.

Greetings,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Leonardo Bertini
Top achievements
Rank 1
answered on 25 Jun 2009, 09:50 PM
Hi Nikolay,

Your work-around doesn't work if I enable the Filtering option. I also tryed to disable the filtering just for the checkbox column, but just if I disable all the entire filtering mode works, otherwise not.

Any ideas to solve the issue?

Many thanks for your help!

The error occurs on this line:

((System.ComponentModel.ISupportInitialize)(this.radGridViewEvents)).EndInit();

Here it is the stack trace error:

System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="Telerik.WinControls.GridView"
  StackTrace:
       at Telerik.WinControls.UI.GridViewRowInfo.get_Item(String colName)
       at Telerik.WinControls.Data.DataAccessComponent.get_Item(GridViewRowInfo row, GridViewDataColumn column)
       at Telerik.WinControls.UI.GridViewTemplate.get_Item(GridViewRowInfo row, GridViewDataColumn column)
       at Telerik.WinControls.UI.GridDataCellElement.get_Value()
       at Telerik.WinControls.UI.GridDataCellElement.SetContent()
       at Telerik.WinControls.UI.GridRowElement.UpdateContent()
       at Telerik.WinControls.UI.GridTableBodyElement.UpdateRow(Int32 position, GridViewRowInfo rowInfo)
       at Telerik.WinControls.UI.GridTableBodyElement.UpdateRowElements(IEnumerable`1 rows, RectangleF clientRect, Single& y, Int32& position, Int32 startIndex, Int32& added, Single left, Single width)
       at Telerik.WinControls.UI.GridTableBodyElement.ArrangeOverride(SizeF finalSize)
       at Telerik.WinControls.RadElement.ArrangeCore(RectangleF finalRect)
       at Telerik.WinControls.RadElement.Arrange(RectangleF finalRect)
       at Telerik.WinControls.UI.GridTableElement.ArrangeOverride(SizeF finalSize)
       at Telerik.WinControls.RadElement.ArrangeCore(RectangleF finalRect)
       at Telerik.WinControls.RadElement.Arrange(RectangleF finalRect)
       at Telerik.WinControls.RootRadElement.ArrangeOverride(SizeF finalSize)
       at Telerik.WinControls.RootRadElement.ArrangeCore(RectangleF finalRect)
       at Telerik.WinControls.RadElement.Arrange(RectangleF finalRect)
       at Telerik.WinControls.ComponentLayoutElementTree.PerformInnerLayout(Boolean performMeasure, Int32 x, Int32 y, Int32 width, Int32 height)
       at Telerik.WinControls.ComponentLayoutElementTree.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
       at Telerik.WinControls.RadControl.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
       at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
       at System.Windows.Forms.Layout.DefaultLayout.xLayoutDockedControl(IArrangedElement element, Rectangle newElementBounds, Boolean measureOnly, Size& preferredSize, Rectangle& remainingBounds)
       at System.Windows.Forms.Layout.DefaultLayout.LayoutDockedControls(IArrangedElement container, Boolean measureOnly)
       at System.Windows.Forms.Layout.DefaultLayout.xLayout(IArrangedElement container, Boolean measureOnly, Size& preferredSize)
       at System.Windows.Forms.Layout.DefaultLayout.LayoutCore(IArrangedElement container, LayoutEventArgs args)
       at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
       at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
       at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
       at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
       at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
       at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
       at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
       at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
       at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
       at System.Windows.Forms.Control.ControlCollection.Add(Control value)
       at Telerik.WinControls.RadControl.RegisterHostedControl(RadHostItem hostElement)
       at Telerik.WinControls.RadHostItem.PerformRoutedEventAction(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadHostItem.OnTunnelEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadElement.RaiseTunnelEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadElement.RaiseTunnelEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadElement.SetParent(RadElement parent)
       at Telerik.WinControls.RadElement.ChangeCollection(RadElement child, ItemsChangeOperation changeOperation)
       at Telerik.WinControls.RadElementCollection.OnInsertComplete(Int32 index, Object value)
       at System.Collections.CollectionBase.System.Collections.IList.Add(Object value)
       at Telerik.WinControls.RadElementCollection.Add(RadElement value)
       at Telerik.WinControls.UI.GridRowElement.CreateCells()
       at Telerik.WinControls.UI.GridRowElement.Initialize(GridViewRowInfo rowInfo)
       at Telerik.WinControls.UI.GridFilterRowElement.Initialize(GridViewRowInfo rowInfo)
       at Telerik.WinControls.UI.GridTableBodyElement.UpdateRow(Int32 position, GridViewRowInfo rowInfo)
       at Telerik.WinControls.UI.GridTableBodyElement.UpdateRowElements(IEnumerable`1 rows, RectangleF clientRect, Single& y, Int32& position, Int32 startIndex, Int32& added, Single left, Single width)
       at Telerik.WinControls.UI.GridTableBodyElement.ArrangeOverride(SizeF finalSize)
       at Telerik.WinControls.RadElement.ArrangeCore(RectangleF finalRect)
       at Telerik.WinControls.RadElement.Arrange(RectangleF finalRect)
       at Telerik.WinControls.UI.GridTableElement.ArrangeOverride(SizeF finalSize)
       at Telerik.WinControls.RadElement.ArrangeCore(RectangleF finalRect)
       at Telerik.WinControls.RadElement.Arrange(RectangleF finalRect)
       at Telerik.WinControls.RootRadElement.ArrangeOverride(SizeF finalSize)
       at Telerik.WinControls.RootRadElement.ArrangeCore(RectangleF finalRect)
       at Telerik.WinControls.RadElement.Arrange(RectangleF finalRect)
       at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()
       at Telerik.WinControls.RadElement.UpdateLayout()
       at Telerik.WinControls.RadControl.EndInit()
       at Telerik.WinControls.UI.RadGridView.EndInit()
       at Goldbet.GBGrabber.Client.WindowsForms.frmFollowerConfigurator.InitializeComponent() in D:\Projects\GBGrabber\GBGrabber.Client.WindowsForms\frmFollowerConfigurator.Designer.cs:line 572
       at Goldbet.GBGrabber.Client.WindowsForms.frmFollowerConfigurator..ctor() in D:\Projects\GBGrabber\GBGrabber.Client.WindowsForms\frmFollowerConfigurator.cs:line 22
       at Goldbet.GBGrabber.Client.WindowsForms.frmMain.radButtonElementFollower_Click(Object sender, EventArgs e) in D:\Projects\GBGrabber\GBGrabber.Client.WindowsForms\frmMain.cs:line 98
       at Telerik.WinControls.RadItem.OnClick(EventArgs e)
       at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e)
       at Telerik.WinControls.RadItem.DoClick(EventArgs e)
       at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)
       at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
       at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at Telerik.WinControls.RadControl.WndProc(Message& m)
       at Telerik.WinControls.UI.RadRibbonBar.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at Goldbet.GBGrabber.Client.WindowsForms.Program.Main() in D:\Projects\GBGrabber\GBGrabber.Client.WindowsForms\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(Assembly 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)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

0
Leonardo Bertini
Top achievements
Rank 1
answered on 25 Jun 2009, 10:29 PM
I've found the problem.... Even if the Filtering enable is set to false for the column, the CreateCell however fires!

I add && !(e.Row is GridFilterRowElement) in the CreateCell event wrap method:

private void radGridViewEvents_CreateCell(object sender, GridViewCreateCellEventArgs e)
        {
            if ((e.Column is GridViewDecimalColumn)
                && !(e.Row is GridTableHeaderRowElement)
                && !(e.Row is GridFilterRowElement)
                && ((GridViewDataColumn)e.Column).UniqueName == "Followed")
            {
                e.CellType = typeof(MyGridDataCheckBoxCell);
            }
        }


Now I will try to make my Custom Filter Row Element.


Thank you
0
Leonardo Bertini
Top achievements
Rank 1
answered on 26 Jun 2009, 12:41 AM
Another problem....

How to get the event ValueChanging of the grid working again with the custom GridDataCellElement ? Now it doesn't fire anymore if I change the checkbox...


Help me please..

Thank you
0
Nikolay
Telerik team
answered on 01 Jul 2009, 04:55 PM
Hi Leonardo Bertini,

Thank you for the question.

Indeed, my workaround is not supposed to work for a filtering cell. You need to make your own custom implementation for filtering enabled by a custom type of checkbox cell.

As to the ValueChanging event, in order to fire it for your custom checkbox cell element, you should make you custom RadGridView class inheriting from RadGridView. Then, in this class you should have a public method which is calling the OnValueChaning method of RadGridView. Your public method will be called from the MouseDown event handler of the custom cell's checkbox. I am attaching a sample project which demonstrates this scenario.

I hope this helps. If you have additional questions, feel free to contact me.

All the best,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jaymie
Top achievements
Rank 1
answered on 09 Feb 2010, 08:42 PM
I have just encountered the OP's problem.
I have a tri-state RadCheckBox on my win form and when it enters the third state, it just shows a tick.
Is this still not fixed?
0
Nikolay
Telerik team
answered on 15 Feb 2010, 09:39 AM
Hi Jaymie,

Indeed, the squarish look of RadCheckBox in Indeterminate state and a three-state checkbox in RadGridView are still not implemented in favor of other important features which are listed in our Roadmap for WinForms. We, however, understand the importance of a three-state RadCheckBox as a separate control or in combination with RadGridView, so we will consider implementing in at the first possible moment.

For the time being, you can change the checkmark's colors of RadCheckBox control by creating a custom theme in Visual Style Builder. You should create "ToggleState = Indeterminate" states for RadCheckmark's FIllPrimitive and CheckPrimitive. Then, you can set appropriate colors for these elements and you will have a custom color scheme for the Indeterminate state. You can refer to this article for additional information. I am attaching a sample custom RadCheckBox theme which you can use as a base for your custom color settings.

Kind regards,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Jack
Top achievements
Rank 1
Answers by
Jack
Top achievements
Rank 1
Nikolay
Telerik team
Leonardo Bertini
Top achievements
Rank 1
Jaymie
Top achievements
Rank 1
Share this question
or