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.
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
Hi guys,
Anyone knows how to disable the right click in the filter row? As the filter use the same ContextMenuOpening.
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);
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.
public void WriteToWordDocumentContinued(){
m_document = new RadFlowDocument();
m_editor = new RadFlowDocumentEditor(m_document);
Section section = new Section(m_document);
section.HasDifferentFirstPageHeaderFooter = true;
section.PageMargins = new Telerik.Windows.Documents.Primitives.Padding(56.69, 94.49, 47.24, 66.14);
m_document.Sections.Add(section);
m_document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.GetHeadingStyleIdByIndex(1));
Style MainTitle = new Style("MainTitle", StyleType.Character) { };
MainTitle.CharacterProperties.UnderlinePattern.LocalValue = UnderlinePattern.Single;
MainTitle.CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Arial");
MainTitle.CharacterProperties.FontSize.LocalValue = 32;
MainTitle.CharacterProperties.FontWeight.LocalValue = System.Windows.FontWeights.Bold;
m_document.StyleRepository.Add(MainTitle);
Style HeaderParagraphStyle = new Style("HeaderParagraphStyle", StyleType.Paragraph) { };
HeaderParagraphStyle.ParagraphProperties.LineSpacing.LocalValue = 16;
HeaderParagraphStyle.ParagraphProperties.LineSpacingType.LocalValue = HeightType.Exact;
HeaderParagraphStyle.ParagraphProperties.SpacingAfter.LocalValue = 0;
HeaderParagraphStyle.ParagraphProperties.SpacingBefore.LocalValue = 0;
Style HeaderTitleStyle = new Style("HeaderTitleStyle", StyleType.Paragraph) { };
HeaderTitleStyle.ParagraphProperties.LineSpacing.LocalValue = 21.4;
HeaderTitleStyle.ParagraphProperties.LineSpacingType.LocalValue = HeightType.Exact;
HeaderTitleStyle.ParagraphProperties.SpacingAfter.LocalValue = 0;
HeaderTitleStyle.ParagraphProperties.SpacingBefore.LocalValue = 0;
HeaderTitleStyle.ParagraphProperties.TextAlignment.LocalValue = Alignment.Right;
HeaderParagraphStyle.ParagraphProperties.TextAlignment.LocalValue = Alignment.Right;
m_document.StyleRepository.Add(HeaderParagraphStyle);
Style HeaderCharacterStyle = new Style("HeaderCharacterStyle", StyleType.Paragraph) { };
HeaderCharacterStyle.CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Arial");
HeaderCharacterStyle.CharacterProperties.FontSize.LocalValue = 16;
m_document.StyleRepository.Add(HeaderCharacterStyle);
Style SubTitle = new Style("SubTitle", StyleType.Character) { };
SubTitle.CharacterProperties.UnderlinePattern.LocalValue = UnderlinePattern.Single;
SubTitle.CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Arial");
SubTitle.CharacterProperties.FontSize.LocalValue = 16;
SubTitle.CharacterProperties.FontWeight.LocalValue = System.Windows.FontWeights.Bold;
m_document.StyleRepository.Add(SubTitle);
Style TopLines = new Style("TopLines", StyleType.Character) { };
TopLines.CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Arial");
TopLines.CharacterProperties.FontSize.LocalValue = 16;
TopLines.CharacterProperties.FontWeight.LocalValue = System.Windows.FontWeights.Bold;
m_document.StyleRepository.Add(TopLines);
}
This is just minified version of the method where I am trying to instantiate my RadFlowDocument object. This method is being called in a parent class, even If I try to pass RadFlowDocument object from that class, it still causes the UI to break.
Hello.
I am using RadRibbonBar (Main Form). I have multiple buttons in ribbon. Each button has different forms. I want dock them inside its Main Form on click. here is an example in below screenshot. I am unable to achieve the requirement.
Please note: The child form should dock exactly below the ribbon form. and also, the cross button (child form close button) should be present right after the tab (Child form name).
Please attach a zip file with a source code.
Thanks
Hi,
I would like to know how we get the clicked bar AxisLabelElement?
What I mean, is when I click on the chart View certain bar I would like to read its Axis label.
Many thanks in advance
Omar
Hi,
I'm using my custom template and I would like to adjust the hyperlink color in RadLabel.
Is there a way to change the color of the hyperlink? The hyperlink is set using an HTML tag. For example: "lblMessageText.Text = "<html>New software version: <a href=www.xyzcom/update>www.xyz.com/update</a>."?
Best regards
Pawel