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

Exception on MouseDown.

3 Answers 38 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kevin Happe
Top achievements
Rank 1
Kevin Happe asked on 21 Jun 2010, 07:50 PM
I am getting the following exception on a mouse down in the grid.   I am using the 2010 sp2 version.  The grid has 80 columns or so and when I scroll way to the right or scroll way to the left, I quite often get an exception clicking on a checkbox column.

 http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50524.0&File=mscorlib.dll&Key=Arg_NullReferenceException   at Telerik.Windows.Controls.GridView.GridViewDataControl.get_IsInEditMode()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnCurrentCellInfoChanging(GridViewCellInfo oldCell, GridViewCellInfo newCell)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.set_CurrentCellInfo(GridViewCellInfo value)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.BeginEdit(GridViewCell gridViewCell)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnCellMouseDown(GridViewCell cell)
   at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonDown(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)


anyone have any clues???



<telerikGrid:RadGridView x:Name="theGrid" Grid.Row="3"

AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserInsertRows="False" FrozenColumnCount="3" CanUserReorderColumns="False"

ShowGroupPanel="False" DataLoaded="theGrid_DataLoaded" ScrollMode="RealTime"

telerik:Theming.Theme="Windows7" RowLoaded="theGrid_RowLoaded"

AlternationCount="2" AlternateRowBackground="#ebf1e9"

EditTriggers="CellClick" HorizontalAlignment="Stretch">

<telerikNavigation:RadContextMenu.ContextMenu >

<telerikNavigation:RadContextMenu ItemClick="contextMenu_ItemClick" Opened="contextMenu_Opened">

<telerikNavigation:RadContextMenu.Items>

<telerikNavigation:RadMenuItem Header="Autofill Column" />

</telerikNavigation:RadContextMenu.Items>

</telerikNavigation:RadContextMenu>

</telerikNavigation:RadContextMenu.ContextMenu>

</telerikGrid:RadGridView>

 


3 Answers, 1 is accepted

Sort by
0
Yordanka
Telerik team
answered on 22 Jun 2010, 10:26 AM
Hi Kevin Happe,

Unfortunately, we are not able to reproduce the described exception. Could you please open a support ticket and attach your project there ? This way we will be able to see and debug the problem.

Greetings,
Yordanka
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
0
Kevin Happe
Top achievements
Rank 1
answered on 22 Jun 2010, 02:17 PM

Here is some more information before I open a ticket.
I am using a mouse down event to handle checkbox clicks.

 

GridViewColumns.Add(

new GridViewDataColumn()

 

{

Header = alg,

DataMemberBinding =

new Binding(string.Format("StateOptions[{0}].BooleanValue", colNbr))

 

{

Mode =

BindingMode.TwoWay

 

},

IsReadOnly =

false,

 

MaxWidth = 100,

DataType =

Type.GetType("System.Boolean"),

 

CellStyle = centerStyle,

});

 


// code behind

 

this.AddHandler(GridViewCell.MouseLeftButtonDownEvent, new MouseButtonEventHandler(MouseDownOnCell), true);

 

private

 

void MouseDownOnCell(object sender, MouseEventArgs args)

 

{

 

try

 

 

 

 

{

 

GridViewCell cell = ((UIElement)args.OriginalSource).ParentOfType<GridViewCell>();

 

 

if (cell != null)

 

{

 

if (cell.DataColumn.DataType == typeof(bool))

 

{

 

StateOption option = GetStateOptionForCell(cell);

 

 

if (option != null && option.IsReadOnly == false)

 

option.BooleanValue = !option.BooleanValue;

 

return;

 

}

}

}

 

catch (Exception)

 

{

}

}

0
Yordanka
Telerik team
answered on 23 Jun 2010, 02:48 PM
Hi,

Could you upgrade your version with our latest internal build (618) and check if the problem still occurs? If so, please send small example application where we can reproduce and debug this exception. 

Greetings,
Yordanka
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
Kevin Happe
Top achievements
Rank 1
Answers by
Yordanka
Telerik team
Kevin Happe
Top achievements
Rank 1
Share this question
or