Telerik Forums
UI for WinForms Forum
2 answers
567 views

Is it possible to force a cell formatting outside the event for it? EveryWhere i look it's refering us back to CellFormating Event.

I've try multiple option Using the CellFormatting Event that have generating undesired result because of Virtualisation UI.

I've manage to make it refresh on scrolling but the UI slowed down to the point it's not viable anymore.

Basically i am using DragAndDrop from 1 grid to another and then i'm trying to validate if the selected COLUMN match certain criteria.

this is the final step in my project and would gladly need help to find a solution.

 

private void svc_PreviewDragDrop(object sender, RadDropEventArgs e)
        {
            SnapshotDragItem draggedItem = e.DragInstance as SnapshotDragItem;
            GridHeaderCellElement targetHeaderCell = e.HitTarget as GridHeaderCellElement;
            if (draggedItem == null || targetHeaderCell == null)
            {
                return;
            }
            GridHeaderCellElement sourceHeaderCell = draggedItem.Item as GridHeaderCellElement;
             
            if (sourceHeaderCell != null)
            {
                e.Handled = true;
                for (int i = 0; i < gridSource.RowCount; i++)
                {
                    gridTarget.Rows[i].Cells[targetHeaderCell.ColumnIndex].Value = gridSource.Rows[i].Cells[sourceHeaderCell.ColumnIndex].Value;                   
                }
                if(Mycondition(gridTarget,Rows[i].Cells[targetHeaderCell.ColumnIndex].Value.toString(), dataType))
                {
                   gridTarget,Rows[i].Cells[targetHeaderCell.ColumnIndex].style.backcolor = Color.Red
                   gridTarget,Rows[i].Cells[targetHeaderCell.ColumnIndex].style.Drawfill = true;
                }
            }           
        }
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 13 Dec 2017
2 answers
135 views

Hello, 

I think I have found a bug in the radgridview behavior:

My radgridview is structured by :

- A Tree with a self reference hierarchy.

- Child templates for some elements in the tree

My code looks like this :

radGridView.Relations.AddSelfReference(radGridView.MasterTemplate, "CategoryId", "ParentCategoryId");
GridViewTemplate childTemplate = CreateChildTemplate();
GridViewRelation relation = new GridViewRelation(this.radGridView.MasterTemplate, childTemplate);
relation.ChildColumnNames.Add("T_RIGHT");
radGridView.Relations.Add(relation);

 

For the CreateChildTemplate(), it looks like this :

GridViewTemplate childTemplate = new GridViewTemplate();
childTemplate.AutoGenerateColumns = false;
radGridView.Templates.Add(childTemplate);
 
GridViewDecimalColumn decColumn = new GridViewDecimalColumn
{
    Name = "RightId",
    HeaderText = "Right Id",
    FieldName = "RGT_ID",
    IsVisible = false,
    MinWidth = 100
};
childTemplate.Columns.Add(decColumn);
 
GridViewTextBoxColumn tbxColumn = new GridViewTextBoxColumn
{
    Name = "RightName",
    HeaderText = "Right Name",
    FieldName = "RGT_NAME",
    ReadOnly = true,
    MinWidth = 100
};
childTemplate.Columns.Add(tbxColumn);
 
GridViewCheckBoxColumn chkxColumn = new GridViewCheckBoxColumn
{
    Name = "Checkbox",

    EnableHeaderCheckBox = true,

    FieldName = "HasAccess",
};
childTemplate.Columns.Add(chkxColumn);

 

This tree works fine, as expected.

But when I try to implement the EnableHeaderCheckBox feature, I have an error

'System.NullReferenceException' dans Telerik.WinControls.GridView.dll

 

But the header checkbox works fine if I comment the line which enables the self referencing :

//radGridView.Relations.AddSelfReference(radGridView.MasterTemplate, "CategoryId", "ParentCategoryId");

 

Can you reproduce the problem ? What can I do with this behavior ?

Thanks in advance for your help.

 

florian
Top achievements
Rank 1
 answered on 13 Dec 2017
1 answer
799 views

I have "x" number of PageViewPage's on my PageView. 

I need to be able to hide/show specific PageViewPage objects in code-behind.  I am not seeing any way to do this.  Basically I just want the "tab" for the page to go away and come back when I dictate. 

I can't destroy and then re-show the pages however, because they were built using the designer many years ago and are very elaborate.  The current solution and timing required for my project doesn't allow for going back and retooling the UI just so I could put the content of those items built in designer in to separate user controls.  So, that idea is out.

Dimitar
Telerik team
 answered on 13 Dec 2017
6 answers
192 views

Unfortunately I'm using an older version of the winforms controls, but just in case someone can help..

I'm validating in the property view, but I can't get an error message to show. I even tried to set Description until I worked out the error message issue, but that doesn't show either. (I have the help panel showing).

I have a delegate doing the property validation, which returns me an error string if invalid. The string is being returned correctly. See below for my code; I've only changed a name or two.

private void OnValidating(object sender, PropertyValidatingEventArgs e)
{
    var item = e.Item as PropertyGridItem;
    if (item == null) return;
 
    if (_validateProperty != null)
    {
        var item = GetViewModelItem(sender);
        var error = "";
        var valid = _validateProperty(item, e.Item.Name, e.NewValue as string, out error);
        if (!valid)
        {
            // TODO: error message not showing
            item.ErrorMessage = error;
        }
        e.Cancel = !valid;
    }
}
Tino
Top achievements
Rank 1
 answered on 12 Dec 2017
6 answers
322 views

Hello I am trying to implement the Drag of a tree Node on a Panel (which incidentally is hosted in a usercontrol loaded on the same form as the treeView)

It seems that I manage to enable the drag on the tree node (see the code below) but I don't know how to handle the Drop on the panel; the panel allowdrop property is set to true but the Drop related events (DragOver, DragDrop, DragEnter) are not fired.

What am I doing wrong ? (tvDisplay s my TreeView) 

 

I tried to follow the follwing exemple:

https://stackoverflow.com/questions/27014469/drag-telerik-radtreeview-node-to-textbox-in-c-sharp

 

----------------------------------------------------------------------------

    Private Sub tvDisplay_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles tvDisplay.MouseMove
        If myMouseDown AndAlso IsRealDrag(e.Location, clickedPoint) Then
            Dim node As TreeNodeElement = TryCast((CType(sender, RadTreeView)).ElementTree.GetElementAtPoint(clickedPoint), TreeNodeElement)
            If node IsNot Nothing Then
                CType(sender, RadTreeView).DoDragDrop(node.Data, DragDropEffects.Copy Or DragDropEffects.Move)
            End If
            myMouseDown = False
        End If
    End Sub
    Private Sub tvDisplay_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles tvDisplay.MouseDown
        If e.Button = MouseButtons.Left Then
            myMouseDown = True
            clickedPoint = e.Location
        End If
    End Sub
    Private Shared Function IsRealDrag(ByVal mousePosition As Point, ByVal initialMousePosition As Point) As Boolean
        Return (Math.Abs(mousePosition.X - initialMousePosition.X) >= SystemInformation.DragSize.Width) OrElse (Math.Abs(mousePosition.Y - initialMousePosition.Y) >= SystemInformation.DragSize.Height)
    End Function

 

pierre-jean
Top achievements
Rank 1
Veteran
Iron
 answered on 12 Dec 2017
2 answers
96 views

Working in WinForms GridView and am trying to show the filter icon in the header itself and not in the search row.

I've done it before but cannot find the code on how I made that happen.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 12 Dec 2017
4 answers
571 views

I have to print GridView content but there are some columns that are not needed to be in printed document (for example selection field). How can I make this right?

 

Krasimir
Top achievements
Rank 1
 answered on 12 Dec 2017
9 answers
272 views

Hi all,

I am trying to drag and drop columns from grid1 to grid2 without any luck.

Found a example here on how to drag and drop rows :

http://www.telerik.com/help/winforms/gridview-rows-drag-and-drop.html

 

I searched for the same but then with columns instead of rows but i could not find any examples,so i am not sure if it even is possible to do it?

If it is possible does anyone know about a example or a tutorial on how to do this?

 

best regards,

H

 

 
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 12 Dec 2017
11 answers
2.0K+ views
Hi,

I use RadControls for WinForms Q2 2011.

I've set a column on my grid to ReadOnly for both EnterKeyMode and NewRowEnterKeyMode.

When navigating through cells with either Tab or Enter keys - it works fine and it jumps to the next editable cell. But, When navigating with Enter key on a new row through the read-only column - it stays on that cell and doesn't move on. I need to use Esc, arrows or mouse to release it.

Is it the right behavior? If so, is there some workaround for that?

Best Regards,

Boaz
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 12 Dec 2017
2 answers
181 views

Hello Telerik,

  I have a gridview where I would like to implement two levels of grouping.  The first level is the same, but the second level is conditional.  When the condition is true, I would like to use the CustomGridGroupContentCellElement (as your sample), where is false, I would like to use a standard GridGroupContentCellElement.

I was able to get the initial display to work, but I am having issues with virtualization when the cell is being re-displayed during a collapse/expand and scrolling.

What I am doing now:

In then radgridview.CreateCell event handler;

if (e.CellType == typeof(GridGroupContentCellElement) && e.Row.RowInfo.Group.Level == 1)
           {
               if (e.Row.RowInfo.ChildRows[0].DataBoundItem != null)
               {
                   var myobjectInfo = e.Row.RowInfo.ChildRows[0].DataBoundItem as MyObjectClass;
                   if (myobjectInfo != null && myobjectInfo.TestCondition == true)
                       e.CellType = typeof(CustomGridGroupContentCellElement);
               }              
           }

 

When initially displaying the group, everything seems to work.  But when expanding/collapsing or scrolling, the incorrect group cell is displayed at times.

I have looked at ViewCellFormatting and GroupSummaryEvaluate but don't know what I need to do in order to make sure the correct group cell is displayed.

Thanks

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 12 Dec 2017
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Form
Chart (obsolete as of Q1 2013)
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?