This question is locked. New answers and comments are not allowed.
Hello,
I am trying to figure out how to get the copy past working on custom check box column. Below is the code for it. I have to override the CanEdit method so that it does not go in edit mode when user click on the cell, but I still want the copy past to work. I think internally your code might be checking on this method to determine when to fire PasteContent event. Is there any work around?
Thanks
Amit
I am trying to figure out how to get the copy past working on custom check box column. Below is the code for it. I have to override the CanEdit method so that it does not go in edit mode when user click on the cell, but I still want the copy past to work. I think internally your code might be checking on this method to determine when to fire PasteContent event. Is there any work around?
Thanks
Amit
public sealed class GridViewCheckBoxColumn : GridViewBoundColumnBase
{
public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
{
BindingTarget = CheckBox.IsCheckedProperty;
var target = new CheckBox().SetTwoWayBinding(CheckBox.IsCheckedProperty, DataMemberBinding.Path.Path);
target.IsEnabled = !cell.ParentOfType<RadGridView>().IsReadOnly && !IsReadOnly;
// initial state dataItem.GetType().GetProperty(DataMemberBinding.Path.Path + "Enabled").Do(p => target.SetOneWayBinding(CheckBox.IsEnabledProperty, p.Name));
dataItem.GetType().GetProperty(DataMemberBinding.Path.Path + "Visible").Do(p => target.SetOneWayBinding(CheckBox.VisibilityProperty, p.Name));
target.HorizontalAlignment = HorizontalAlignment.Center;
target.VerticalAlignment = VerticalAlignment.Center; dataItem.GetType().GetProperty(DataMemberBinding.Path.Path + "ToolTip").Do(p => cell.SetOneWayBinding(ToolTipService.ToolTipProperty, p.Name));
return target;
}
public override bool CanEdit(object item)
{
return false; // never go into edit mode
}
}