Telerik Forums
UI for WinForms Forum
1 answer
87 views

Hi! 

In my code I'm creating new appointments in a scheduler by dropping them from a radGridView. Any ideas how can I get the last created appointment element of the scheduler, or the appointment element assigned to the newly created appointment?

private void svc_PreviewDragDrop(object sender, RadDropEventArgs e)
        {
            SchedulerCellElement schedulerCell = e.HitTarget as SchedulerCellElement;

            if (schedulerCell != null)
            {
                GridDataRowElement draggedRow = e.DragInstance as GridDataRowElement;
                if (draggedRow != null)
                {
                    if (draggedRow.Data.DataBoundItem != null)
                    {
                        if (draggedRow.GridControl.DataSource != null)
                        {
                            MainJobObject draggedMainJobObject = (MainJobObject)draggedRow.Data.DataBoundItem;
                            AppointmentWithObject appointment = new AppointmentWithObject(schedulerCell.Date, schedulerCell.Date.AddHours(1), draggedMainJobObject.Customer, " / ", draggedMainJobObject.MachineType);
                            appointment.Start = schedulerCell.Date;
                            appointment.End = schedulerCell.Date.AddHours(1);
                            appointment.AssignedMainJobObject = draggedMainJobObject;
                            appointment.ResourceId = schedulerCell.View.GetResourceId();
                            scheduler.Appointments.Add(appointment);

                            //CustomAppointmentElement appointmentElement = get the appointment element that was just created;
                            //if (appointmentElement != null)
                            //{
                            //    appointmentElement.ChangeStatus(2);
                            //}                         
                        }
                    }
                }            
            }          
        }


Nadya | Tech Support Engineer
Telerik team
 answered on 02 Oct 2023
1 answer
61 views

Hi!

How does one programmatically scroll through the resources (vertical scroll) in a timeline view scheduler that is grouped by resources?

Thanks!

Nadya | Tech Support Engineer
Telerik team
 answered on 29 Sep 2023
1 answer
71 views

Hi,

I am having two issues with a RadGridView and need some help.

In the attached movie, there is a gridView with two "optional" columns : one with check boxes and one with buttons.

This is to allow a user to modify values in the associated DB Table either individually with the buttons or as a group via the check boxes.

However, I want only one column active at any time. The selection being done via the upper left label.

Note that  I do not want the CommandColumn to be hiden, as the buttons labels also convey status information.

The problems are as follow :

1- when the form is loaded, I only want to show the lines where buttons in the "ready for update" state (written "Mettre à jour"). So I hide the other rows labelled "Not Ready". Doing this in the CellFormatting event works, but due to the virtualisation, as you can see in the attached movie, if the user move the colums too fast, the Not ready cells are temporarily displayed ( I tried a MasterTemplate.Refresh but this crash the form load with an index invalid exception in Telerik code).

How can I solved this ?

2 - when I click on the label (used as a button) to show the Check box column, it should change color in grey. As you can see, it does it (on the whole column as expected) but only if I click on any of the column button.

Here is the CellFormatting code :

  private void gvMajBoutique_CellFormatting(object sender, CellFormattingEventArgs e)
  {
      if (e.CellElement is not GridCommandCellElement commandCell) return;
      var row = commandCell.RowInfo;
      if (row == null) return;

      string ugs = row.Cells["Sku"].Value.ToString();
      if (ugs != null && SuiviDesModifications.ContainsKey(ugs))
      {
          StatusModifsPrixBoutique state = SuiviDesModifications[ugs];

          if (state == null) return;

          if (state.CurrentState == ChangeButtonState.UpdateReady)
          {
              commandCell.CommandButton.Text = state.CurrentButtonName;
              row.IsVisible = true;
          }

          else if (state.CurrentState == ChangeButtonState.UpdateForbidden)
          {
              row.IsVisible = false;
          }

          if (StatusColumnEnabled)
          {
              commandCell.CommandButton.ButtonFillElement.BackColor = Color.PapayaWhip;
              commandCell.CommandButton.ButtonFillElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
              commandCell.CommandButton.Enabled = true;
          }
          else
          {
              commandCell.CommandButton.ButtonFillElement.BackColor = Color.LightGray;
              commandCell.CommandButton.ButtonFillElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
              commandCell.CommandButton.Enabled = false;
          }
          // This crash the form //gvMajBoutique.MasterTemplate.Refresh();
      }
  }

Thanks for your answers

Patrick

Nadya | Tech Support Engineer
Telerik team
 answered on 29 Sep 2023
2 answers
59 views

Hello, I am using a scheduler, where my appointments can have multiple resources. A resource can be the a casual member or be responsible for the appointment. I want to achieve a custom formatting of the appointment element, depending on the following states:

- the current resource is the only member (automatically responsible)
- the current resource is member, but not responsible
- the current resource is responsible and appointment has other members.

The attached screenshot shows a single appointment with 2 members and a responsible. The drawn Icon shall be depending on the resource of the current row.

To achieve that task, I want to implement the AppointmentFormatting-Event and set the Icon of the AppointmentElement depending on the relative resouce state. But how do I determine the current resouce of the AppointmentElement?

Regards Stephan

 

Nadya | Tech Support Engineer
Telerik team
 answered on 28 Sep 2023
1 answer
63 views

I have a timeline view scheduler grouped by Resources and would like to use the drag & drop service to move objects from my DataGridView to the scheduler. How do I determine the resource assigned to the cell that's my hit target (the cell I'm currently dropping into), so I can correctly set the ResourceID for the appointment I'm creating?

private void svc_PreviewDragDrop(object sender, RadDropEventArgs e)
        {
            SchedulerCellElement schedulerCell = e.HitTarget as SchedulerCellElement;
           
            if (schedulerCell != null)
            {
                GridDataRowElement draggedRow = e.DragInstance as GridDataRowElement;
                if (draggedRow != null)
                {
                    if (draggedRow.Data.DataBoundItem != null)
                    {
                        MainJobObject draggedMainJobObject = (MainJobObject)draggedRow.Data.DataBoundItem;
                        AppointmentWithObject appointment = new AppointmentWithObject(schedulerCell.Date, schedulerCell.Date.AddHours(1), draggedMainJobObject.Customer, " / ", draggedMainJobObject.MachineType);
                        appointment.Start = schedulerCell.Date;
                        appointment.End = schedulerCell.Date.AddHours(1);
                        //appointment.ResourceId = -- I need the resource ID HERE
                        scheduler.Appointments.Add(appointment);                     
                    }
                }            
            }          
        }

 

If it's not possible, I'd be happy with any trick or workaround that helps determining the resource that's assigned to the row the cell currently resides in - even determining the row number of the cell would help.

Stephan
Top achievements
Rank 3
Bronze
Iron
Iron
 updated answer on 28 Sep 2023
1 answer
49 views

Hi,

I used example : https://docs.telerik.com/devtools/winforms/controls/ganttview/working-with-data/data-binding-basics

and added a column "Resource", it will help a lot if you can give me an example where every resource can have its OWN fill color to identify them quickly.

 

 

Thank you very much

Kobus

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 28 Sep 2023
3 answers
62 views

Hi guys,

Anyone knows how to disable the right click in the filter row? As the filter use the same ContextMenuOpening.

 

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 27 Sep 2023
1 answer
63 views

The Drag & Drop service is working perfectly on my RadGridView until I add a GridViewTemplate to it with the intent to create a hierarchy view, after which the drag events aren't even fired anymore. Any ideas, please?

 

This is how I initialize the Drag & Drop behavior on my main DataGrid:

 

private void InitGrid()
        {             
            bt_addAttachment.Visible = false;
            BaseGridBehavior gridBehavior = this.radGridView1.GridBehavior as BaseGridBehavior;
            gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
            gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomRowGridBehavior());

            //handle drag and drop events for the grid through the DragDrop service
            RadDragDropService svc = this.radGridView1.GridViewElement.GetService<RadDragDropService>();
            svc.PreviewDragStart += svc_PreviewDragStart;
            svc.PreviewDragDrop += svc_PreviewDragDrop;
            svc.PreviewDragOver += svc_PreviewDragOver;        
        }

        //required to initiate drag and drop when grid is in bound mode
        private void svc_PreviewDragStart(object sender, PreviewDragStartEventArgs e)
        {
            e.CanStart = true;
        }

        private void svc_PreviewDragOver(object sender, RadDragOverEventArgs e)
        {
            if (e.DragInstance is GridDataRowElement)
            {
                e.CanDrop = e.HitTarget is SchedulerCellElement;
            }
        }

        private void svc_PreviewDragDrop(object sender, RadDropEventArgs e)
        {
            SchedulerCellElement schedulerCell = e.HitTarget as SchedulerCellElement;
            if (schedulerCell == null)
            {
                //DayViewAllDayHeader allDay = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement).AllDayHeaderElement;
                //schedulerCell = SchedulerUIHelper.GetCellAtPoint(e.DropLocation, allDay.Children);
            }
            if (schedulerCell == null)
            {
                return;
            }
            GridDataRowElement draggedRow = e.DragInstance as GridDataRowElement;
            if (draggedRow == null)
            {
                return;
            }

            DataRowView dataRowView = draggedRow.Data.DataBoundItem as DataRowView;
            if (dataRowView != null)
            {
                if (draggedRow.GridControl.DataSource != null && typeof(BindingSource).IsAssignableFrom(draggedRow.GridControl.DataSource.GetType()))
                {
                    Appointment appointment = new Appointment();
                    appointment.Start = (DateTime)draggedRow.RowInfo.Cells["Start"].Value;
                    appointment.End = (DateTime)draggedRow.RowInfo.Cells["End"].Value;
                    //adjust start/end according to target cell
                    appointment.End = schedulerCell.Date.AddMinutes(appointment.Duration.TotalMinutes);
                    appointment.Start = schedulerCell.Date;
                    appointment.Summary = string.Empty + draggedRow.RowInfo.Cells["Summary"].Value;
                    appointment.Description = string.Empty + draggedRow.RowInfo.Cells["Description"].Value;
                    appointment.Location = string.Empty + draggedRow.RowInfo.Cells["Location"].Value;
                    appointment.StatusId = (int)draggedRow.RowInfo.Cells["StatusId"].Value;
                    appointment.BackgroundId = (int)draggedRow.RowInfo.Cells["BackgroundId"].Value;
                    //this.radScheduler1.Appointments.Add(appointment);

                    dataRowView.Row.Table.Rows.Remove(dataRowView.Row);
                }
                else
                {
                    throw new ApplicationException("Unhandled Scenario");
                }
            }
        }

 

Which is working perfectly until I add this piece of code to it:

 

///attachments sub-row initialization
GridViewTemplate attachmentsTemplate = new GridViewTemplate();
attachmentsTemplate.AutoGenerateColumns = false;            
attachmentsTemplate.HierarchyDataProvider = new GridViewEventDataProvider(attachmentsTemplate);

GridViewTextBoxColumn columnMainJobID = new GridViewTextBoxColumn();
columnMainJobID.TextAlignment = ContentAlignment.MiddleCenter;
columnMainJobID.FieldName = "MainJobID";
columnMainJobID.IsVisible = false;
attachmentsTemplate.Columns.Add(columnMainJobID);

radGridView1.Templates.Add(attachmentsTemplate);

 

Nadya | Tech Support Engineer
Telerik team
 answered on 27 Sep 2023
1 answer
63 views

Hello,

I have a RadRibbonBar and I have added a Group for themes. Inside that I have added a RadGalaryElement control, within this I want to add themes exactly as shown in the below screenshot. When hovering mouse on theme, it shows large icon. (The attached screenshot is from different tool)

1.

2. On clicking the bottom button popup appears with all the themes name + Image.

 

Please add all the themes and attach a source code zip file.

Thanks.

Dinko | Tech Support Engineer
Telerik team
 answered on 26 Sep 2023
1 answer
59 views
Hello, 

I am trying to get the Location in Pixels of each of the Ranges Indicators  I defined in a RadTrackBar.
How can I make this happen?
Dinko | Tech Support Engineer
Telerik team
 answered on 26 Sep 2023
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
ComboBox and ListBox (obsolete as of Q2 2010)
ListView
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
Menu
PropertyGrid
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
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
Rotator
TrackBar
MessageBox
SpinEditor
StatusStrip
CheckedListBox
Wizard
ShapedForm
SyntaxEditor
TextBoxControl
LayoutControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
DataEntry
GroupBox
ScrollablePanel
WaitingBar
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
ColorBox
Callout
FilterView
PictureBox
VirtualKeyboard
NavigationView
Accessibility
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
Flyout
ToolbarForm
NotifyIcon
Rating
TimeSpanPicker
BarcodeView
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
+? more
Top users last month
Henri
Top achievements
Rank 2
Iron
Iron
Iron
SUNIL
Top achievements
Rank 2
Iron
Iron
Iron
David
Top achievements
Rank 1
Jackson
Top achievements
Rank 1
Iron
Iron
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Henri
Top achievements
Rank 2
Iron
Iron
Iron
SUNIL
Top achievements
Rank 2
Iron
Iron
Iron
David
Top achievements
Rank 1
Jackson
Top achievements
Rank 1
Iron
Iron
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?