Simple code
new
System.Threading.Thread(
delegate
()
{
var grid =
new
RadGridView();
grid.Columns.Add(
"column"
);
grid.Rows.Add(
new
Object[] {
"value1"
});
grid.Dock = System.Windows.Forms.DockStyle.Fill;
var form =
new
RadForm();
form.Controls.Add(grid);
form.ShowDialog();
}).Start();
When i try right click + copy on cell i got error:
Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
Hey,
I need help with Drag 'n Drop MultiLines from GridView to ListView.
Everything works, but I have to press Shift or Ctrl to drag more than one line.
If I drag without holding the key, only I line drags.
Is there any solutions for this?
Best regards
Hi there,
I've tried to make an outlook inspired form using the RibbonBar but am not able to get the colours correct. Please see Picture 1 for how I want it to look and Picture 2 of how it actually looks.
I've tried going through each element via the 'Edit UI Elements' on the RibbonBar and haven't been able to find the element that controls this.
Any help will be appreciated.
Thanks,
Ray
hi.
I have 3 tables that structure showed in attached picture and I want to create the manual hierarchy. for this goal I do this steps :
1. add column to master and child's template from designer and set "FieldName" property to table file name
2. add GridVew relation from for these master/child template.
3. in the button event click, load tables and set GridView DataSource & child template DataSource from entity framwork:
using (var entity = new VaccinationEntities())
{
radGridView1.DataSource = entity.Patients.ToList();
childTemplate1.DataSource = entity.ChildVaccinations.ToList();
childTemplate2.DataSource = entity.ProblemBackgrounds.ToList();
}
but after load data just master template showed in GridView without child template.
Hi,
I have an eventhandler for the GraphicalViewItemFormatting event so I can change the look&feel of the items in the ganttview according to the contents. Now I also want to make it more clear which item is selected. Unfortunately I seem to be doing something wrong.
In the handler I have this part that should draw the border in red:
private void GanttViewElement_GraphicalViewItemFormatting(object sender, Telerik.WinControls.UI.GanttViewGraphicalViewItemFormattingEventArgs e)
{
if (e.ItemElement.Selected)
{
e.ItemElement.TaskElement.BorderColor = Color.Red;
e.ItemElement.TaskElement.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.FourBorders;
e.ItemElement.TaskElement.BorderWidth = 6;
e.ItemElement.TaskElement.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
e.ItemElement.TaskElement.DrawBorder = true;
}
}
But the border keeps working in the standard way. There is only a slight difference between selected and non-selected items.
What part am I missing?
SetupDragDrop(radGridViewPreview);
SetupDragDrop(radGridView1);
}
private void SetupDragDrop(RadGridView grid)
{
grid.MultiSelect = true;
//handle drag and drop events for the grid through the DragDrop service
var svc = grid.GridViewElement.GetService<RadDragDropService>();
svc.PreviewDragStart += svc_PreviewDragStart;
svc.PreviewDragDrop += SvcPreviewDragDrop;
svc.PreviewDragOver += svc_PreviewDragOver;
//register the custom row selection behavior
grid.GridBehavior = new CustomGridBehavior();
}
private void svc_PreviewDragStart(object sender, PreviewDragStartEventArgs e)
{
e.CanStart = true;
}
private void SvcPreviewDragDrop(object sender, RadDropEventArgs e)
{
var rowElement = e.DragInstance as GridDataRowElement;
if (rowElement == null)
{
return;
}
e.Handled = true;
var dropTarget = e.HitTarget as RadItem;
var targetGrid = dropTarget.ElementTree.Control as RadGridView;
if (targetGrid == null || targetGrid == radGridView1)
{
return;
}
var dragGrid = rowElement.ElementTree.Control as RadGridView;
//Grab every selected row from the source grid, including the current row
List<GridViewRowInfo> dragRows = dragGrid.SelectedRows.ToList<GridViewRowInfo>();
if (dragGrid.CurrentRow != null)
{
GridViewRowInfo row = dragGrid.CurrentRow;
if (!dragRows.Contains(row)) dragRows.Add(row);
}
var dropTargetRow = dropTarget as GridDataRowElement;
int indexToMoveTo = targetGrid.RowCount;
if (dropTargetRow != null) indexToMoveTo = GetTargetRowIndex(dropTargetRow, e.DropLocation);
if (targetGrid != dragGrid)
{
e.Handled = true;
MoveRows(targetGrid, dragGrid, dragRows, indexToMoveTo);
}
else
{
MoveRowsWithinGrid(targetGrid, dragRows, indexToMoveTo);
}
}
private void svc_PreviewDragOver(object sender, RadDragOverEventArgs e)
{
if (e.DragInstance is GridDataRowElement || e.DragInstance is ListViewDataItem)
{
e.CanDrop = e.HitTarget is GridDataRowElement || e.HitTarget is GridTableElement || e.HitTarget is GridSummaryRowElement;
}
}
public class CustomGridBehavior : BaseGridBehavior
{
List<GridViewRowInfo> selectedRows = new List<GridViewRowInfo>();
public List<GridViewRowInfo> SelectedRows
{
get { return selectedRows; }
}
public override bool OnMouseDown(MouseEventArgs e)
{
selectedRows.Clear();
bool result = base.OnMouseDown(e);
selectedRows.AddRange(this.GridControl.SelectedRows);
return result;
}
}
Hello all together!
I am currently experiencing the below issues with RadTrackBar.
TrackBar.Minimum is set to 50.
TrackBar.Maximum is set to 150.
TrackBar.Value is set to 100.
I guess, everybody should now expect the track bar to move the knob in the exact middle of the control. But it simply doesn't. When looking at the track bar's minimum, maximum and value properties during FormLoad event, I discovered that the minimum changed to 19.
What I did next was searching for the number in the designer class of the respective form, assuming that Visual Studio somehow messed it up as it is always doing from time to time. But nothing found here. Setting the minimum value again in FormLoad fixes the problem, but this should not be the default approach when working with a RadTrackBar. So this must be a bug, right?