Telerik Forums
UI for WinForms Forum
2 answers
109 views

I want to create a RadGridViewwhich allow the user to enter the multiple materials just click on add material 

as well as after list of material adds, we can add the multiple labours also 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 Sep 2018
0 answers
149 views

I have this code modified from example for moving rows between grids:

 

GridDataRowBehavior:

public class RowSelectionGridBehavior : GridDataRowBehavior
{
    private List<GridViewRowInfo> selectedRows = new List<GridViewRowInfo>();
    protected override bool OnMouseDownLeft(MouseEventArgs e)
    {
        GridDataRowElement row = this.GetRowAtPoint(e.Location) as GridDataRowElement;
        if (row != null)
        {
            RadGridViewDragDropService svc = this.GridViewElement.GetService<RadGridViewDragDropService>();
            svc.AllowAutoScrollColumnsWhileDragging = true;
            svc.AllowAutoScrollRowsWhileDragging = true;
            svc.Start(row);
        }
        return base.OnMouseDownLeft(e);
    }
}

My extension of RadGridView

public delegate void MovingItemsEvent(List<GridViewRowInfo> rows, object source, object target);
public event MovingItemsEvent MovingItems;
//THIS IS THE PART I DON'T LIKE
private void ExtendedGrid_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button == System.Windows.Forms.MouseButtons.Left && EnableDragnDrop)
    {
        GridGroupContentCellElement row = this.ElementTree.GetElementAtPoint(e.Location) as GridGroupContentCellElement;
        if (row != null)
        {
            RadGridViewDragDropService svc = this.GridViewElement.GetService<RadGridViewDragDropService>();
            svc.AllowAutoScrollColumnsWhileDragging = true;
            svc.AllowAutoScrollRowsWhileDragging = true;
            svc.Start(row);
        }
    }
}
private bool _EnableDragnDrop;
[BrowsableAttribute(true)]
public bool EnableDragnDrop
{
    get { return this._EnableDragnDrop; }
    set
    {
        _EnableDragnDrop = value;
        if (value)
        {
            //register the custom row selection behavior
            var gridBehavior = this.GridBehavior as BaseGridBehavior;
            gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
            //gridBehavior.UnlockBehavior(typeof(GridGroupContentCellElement));
            gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new RowSelectionGridBehavior());
        }
    }
}
private void svc_PreviewDragStart(object sender, PreviewDragStartEventArgs e)
{
    if (EnableDragnDrop)
        e.CanStart = true;
}
private void svc_PreviewDragOver(object sender, RadDragOverEventArgs e)
{
    if (EnableDragnDrop)
        e.CanDrop = true;
}
private void svc_PreviewDragDrop(object sender, RadDropEventArgs e)
{
    if (EnableDragnDrop)
    {
        var dropTarget = e.HitTarget as RadItem;
        var targetGrid = dropTarget.ElementTree.Control as RadGridView;
        //append dragged rows to the end of the target grid
        
        List<GridViewRowInfo> rows = new List<GridViewRowInfo>();
        if (e.DragInstance is GridGroupContentCellElement)
        {
            e.Handled = true;
            GridGroupContentCellElement group = e.DragInstance as GridGroupContentCellElement;
            foreach (var row in group.ViewInfo.CurrentRow.ChildRows)
            {
                rows.Add(row);
            }
            this.MoveRows(targetGrid, rows);
        }
        else if (e.DragInstance is GridDataRowElement)
        {
            e.Handled = true;
            foreach (var row in this.SelectedRows)
            {
                rows.Add(row);
            }
            this.MoveRows(targetGrid, rows);
        }
    }
}
private void MoveRows(RadGridView targetGrid, List<GridViewRowInfo> dragRows)
{
    this.BeginUpdate();
    targetGrid.BeginUpdate();
    if (MovingItems != null)
    {
        MovingItems(dragRows, this, targetGrid);
    }
    this.EndUpdate(true);
    targetGrid.EndUpdate(true);
}

 

This works fine without any problem, but I would like if ther is a better way to allow Grouped rows to be dragged, like for example registering a GridBehavior like in the case of ordinary rows

 

Vicent
Top achievements
Rank 1
Iron
 asked on 20 Sep 2018
4 answers
335 views
Hi all,In my winForm program, I made some GridView columns programmatically. and after adding them to GridView
I tried to make just some headers in a group view style. the problem  is when I apply this view changes, the gridview don't load 
other columns which haven't been grouped.
the code I used to change the view is  in below and notice I wrote them after adding columns to DGV. Thanks in advance
...
//adding 8 columns to DGV programmatically
....
//make just 6 column in a group format
ColumnGroupsViewDefinition view = new ColumnGroupsViewDefinition();
            dataGridView1.ViewDefinition = view;
            view.ColumnGroups.Add(new GridViewColumnGroup("morning));
            view.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow());
            view.ColumnGroups[1].Rows[0].Columns.Add(this.dataGridView1.Columns["MrnngEnt"]);
            view.ColumnGroups[1].Rows[0].Columns.Add(this.dataGridView1.Columns["MrnngExit"]);
            view.ColumnGroups.Add(new GridViewColumnGroup("evnng"));
            view.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow());
            view.ColumnGroups[2].Rows[0].Columns.Add(this.dataGridView1.Columns["EvnngEnt"]);
            view.ColumnGroups[2].Rows[0].Columns.Add(this.dataGridView1.Columns["EvnngExit"]);
            view.ColumnGroups.Add(new GridViewColumnGroup("over"));
            view.ColumnGroups[3].Rows.Add(new GridViewColumnGroupRow());
            view.ColumnGroups[3].Rows[0].Columns.Add(this.dataGridView1.Columns["OvrEnt"]);
            view.ColumnGroups[3].Rows[0].Columns.Add(this.dataGridView1.Columns["OvrExit"]);       
        }
Tofan
Top achievements
Rank 1
 answered on 20 Sep 2018
2 answers
121 views

Hello,

 

I have defined my own GroupBox, that inherits the RadGroupBox.

If I apply a Theme, nothing happend.

Button, MaskedEditBox, CheckBox etc. works fine, but not the GroupBox.

Is this an known issue?

 

Regards

Marc
Top achievements
Rank 1
Veteran
 answered on 20 Sep 2018
3 answers
552 views

First, I'm new to Telerik Controls.

I'm trying to show a simple hierarchical class (some Properties and a List<T> with sub entries) in a RadGridView. I figured out I can use "AutoGenerateHierarchy" which works so far. But I'm having a real hard time to make it look how I need it. Especially for the sub entries. What ever I change in the Property Builder on "Template1" doesn't seem to have any effect. Also does it display a + even if the entry doesn't have sub entries.

I would appreciated if you could help me out with this...

Marco
Top achievements
Rank 1
 answered on 19 Sep 2018
1 answer
743 views

Greetings,

I want the RadTimePicker to show only Time value , not date. How to do that ?

 

Thanks


Hristo
Telerik team
 answered on 19 Sep 2018
3 answers
74 views

Hello, I have tried modifying https://docs.telerik.com/devtools/winforms/ganttview/timeline/custom-timeline to have it do custom ranges, however when I run my copy I get a fully blank header. See attached for images.

My setting the custom behavior:

radGanttView1.GanttViewElement.GraphicalViewElement.TimelineStart = start; // Start is a DateTime
radGanttView1.GanttViewElement.GraphicalViewElement.TimelineEnd = end; // End is a DateTime
radGanttView1.GanttViewElement.GraphicalViewElement.OnePixelTime = TimeSpan.FromMinutes(0.0025);
radGanttView1.GanttViewElement.GraphicalViewElement.TimelineRange = TimeRange.Custom;
var behavior = new WarehouseTimelineBehavior { Start = start, End = end };
radGanttView1.GanttViewElement.GraphicalViewElement.TimelineBehavior = behavior;

And my Behavior class:

001.using System;
002.using System.Collections.Generic;
003.using Telerik.WinControls.UI;
004. 
005.namespace WarehouseBuilder.LogViewer
006.{
007.    public class WarehouseTimelineBehavior : BaseGanttViewTimelineBehavior
008.    {
009.        public DateTime Start = DateTime.MinValue;
010.        public DateTime End = DateTime.MaxValue;
011. 
012.        public override DateTime AdjustedTimelineStart
013.        {
014.            get
015.            {
016.                if (GraphicalViewElement.TimelineRange != TimeRange.Custom || Start == DateTime.MinValue)
017.                {
018.                    return base.AdjustedTimelineStart;
019.                }
020.                return Start;
021.            }
022.        }
023. 
024.        public override DateTime AdjustedTimelineEnd
025.        {
026.            get
027.            {
028.                if (GraphicalViewElement.TimelineRange != TimeRange.Custom || End == DateTime.MaxValue)
029.                {
030.                    return base.AdjustedTimelineEnd;
031.                }
032.                return End;
033.            }
034.        }
035. 
036.        public override IList<GanttViewTimelineDataItem> BuildTimelineDataItems(TimeRange range)
037.        {
038.            if (range != TimeRange.Custom)
039.            {
040.                return base.BuildTimelineDataItems(range);
041.            }
042.            return this.BuildTimelineDataItemsForDecadesRange();
043.        }
044. 
045.        public IList<GanttViewTimelineDataItem> BuildTimelineDataItemsForDecadesRange()
046.        {
047.            List<GanttViewTimelineDataItem> result = new List<GanttViewTimelineDataItem>();
048.            DateTime currentDate = AdjustedTimelineStart;
049.            int currentMinuteNumber = currentDate.Minute;
050.            int newMinuteNumber = currentMinuteNumber;
051. 
052.            GanttViewTimelineDataItem item = new GanttViewTimelineDataItem(currentDate, currentDate.AddMinutes(5), GraphicalViewElement.TimelineRange, GraphicalViewElement.OnePixelTime);
053. 
054.            result.Add(item);
055. 
056.            while (currentDate < AdjustedTimelineEnd)
057.            {
058.                item.End = currentDate.AddMinutes(5);
059.                currentDate = currentDate.AddMinutes(5);
060.                newMinuteNumber = currentDate.Minute;
061. 
062.                if (newMinuteNumber != currentMinuteNumber && currentDate <= AdjustedTimelineEnd)
063.                {
064.                    currentMinuteNumber = newMinuteNumber;
065.                    item = new GanttViewTimelineDataItem(currentDate, currentDate, GraphicalViewElement.TimelineRange, GraphicalViewElement.OnePixelTime);
066.                    result.Add(item);
067.                }
068.            }
069. 
070.            return result;
071.        }
072. 
073.        public override GanttTimelineCellsInfo GetTimelineCellInfoForItem(GanttViewTimelineDataItem item, TimeRange timeRange)
074.        {
075.            if (timeRange != TimeRange.Custom)
076.            {
077.                return base.GetTimelineCellInfoForItem(item, timeRange);
078.            }
079. 
080.            return GetTimelineCellInfoForDecadeRange(item);
081.        }
082. 
083.        public GanttTimelineCellsInfo GetTimelineCellInfoForDecadeRange(GanttViewTimelineDataItem item)
084.        {
085.            int minutes = 5;
086. 
087.            if (item.Start == AdjustedTimelineStart)
088.            {
089.                if (item.Start.Minute % 5 > 0)
090.                {
091.                    minutes = 10 - (item.Start.Minute % 5);
092.                }
093.            }
094. 
095.            if (item.End == AdjustedTimelineEnd)
096.            {
097.                if (item.End.Minute % 5 > 0)
098.                {
099.                    minutes = item.End.Minute % 5;
100.                }
101.            }
102. 
103.            return new GanttTimelineCellsInfo(minutes);
104.        }
105. 
106.        public override string GetTimelineTopElementText(GanttViewTimelineDataItem item)
107.        {
108.            if (item.Range != TimeRange.Custom)
109.            {
110.                return base.GetTimelineTopElementText(item);
111.            }
112. 
113.            string format = "{0} - {1}";
114. 
115.            return string.Format(System.Threading.Thread.CurrentThread.CurrentUICulture, format, item.Start, item.End);
116.        }
117. 
118.        public override string GetTimelineBottomElementText(GanttViewTimelineDataItem item, int index)
119.        {
120.            if (item.Range != TimeRange.Custom)
121.            {
122.                return base.GetTimelineBottomElementText(item, index);
123.            }
124. 
125.            string format = "{0:hh:mm}";
126. 
127.            return string.Format(System.Threading.Thread.CurrentThread.CurrentCulture, format, new DateTime(item.Start.Minute + index, 1, 1));
128.        }
129.    }
130.}

 

Hristo
Telerik team
 answered on 19 Sep 2018
14 answers
187 views

     Hey guys, I'm trying to add a QuickStart(TextBox with Autocomplete) to the Title Bar, like visual studio 2017. I've tried adding a RadTextBoxElement, but I couldn't even enter text on it, any help? But of course I wanna it beatiful, like Visual Studio, changing border colors and back color. I've attached how it is on VS and how it is on mine.

The button is a RadButtonElement.

Leandro
Top achievements
Rank 1
 answered on 18 Sep 2018
4 answers
208 views

Hello Telerik Team !

I currently try to achieve something similar to the attached picture.

Maybe I took the wrong direction, by using a MaskedEditBox with a DateTime MaskType, I am trying to add an adjacent button picture to open a calendar, and also a drop down button with several standard choice.

By editing UI Elements I notice the presence of a StackLayoutPanel with LightVisualButtonElement, I put both Visibility to Visible and add a little calendar icon image.

I can see It on Visual Studio, but the icon does not appear when I launch the program, and also I don't have any idea what kind of event I need to add if I succeed in showing the icon to open a calendar control to select my date.

So maybe I took a wrong direction by using this controls ?

Any help or suggestion would be highly welcome

 

Thanks in adavnce

 

Jeff

Jeff
Top achievements
Rank 1
 answered on 18 Sep 2018
3 answers
292 views
Hi

I'm using Office2010SilverTheme. The Font of UI Controls in English and Farsi culture is different.
Where is this default is set? How can I set a new Font for controls in Farsi culture?

Cheers
Hristo
Telerik team
 answered on 18 Sep 2018
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
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
Styling
Barcode
PopupEditor
RibbonForm
TaskBoard
Callout
NavigationView
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Security
LocalizationProvider
Dictionary
SplashScreen
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?