I have a self-referencing Hierarchy working fine in .NET Framework 4.8,
now I upgraded to .NET 8 with
UI.for.WinForms.AllControls.Net60 2022.2.808-hotfix
public partial class Form1 : Form
{
private Person[] _people = {
new Person() { ID=1, Parent =0, Name = "Hans"},
new Person() { ID=2, Parent =1, Name = "Fred"},
new Person() { ID=3, Parent =1, Name = "Mary"},
new Person() { ID=4, Parent =0, Name = "John"}
};
public Form1()
{
InitializeComponent();
radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, nameof(Person.ID), nameof(Person.Parent));
radGridView1.DataSource = _people;
}
}
public class Person
{
public int ID { get; set; }
public int Parent { get; set; }
public string Name { get; set; }
}
as following picture shows, I have a hierarchical "Grid View", when the amount of data is too large, I can not see the horizontal scrollbar of “Event”
private void OnCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) { if (/*some-condition-that-are-always-true-for-all-cells-in-specific-column*/true) { e.CellElement.Children.Clear(); e.CellElement.Children.Add(new RadButtonElement { Text = e.CellElement.Value?.ToString() }); } }
When the GanttView opens, the ratio of the text (left) side to the graphical (right) side is 50/50.
This looks strange, as there may be either lots of space to the right of the right-most column of text, or not enough space if you have lots of columns.
There may be a better way to do this, but to make the left hand (text) columns have the correct with, and stay correct, add this:
Private Sub resetSplitter()
Dim allColWidths = 0
For Each c As GanttViewTextViewColumn In myGanttView.GanttViewElement.Columns
allColWidths = allColWidths + c.Width
Next
If allColWidths <> 0 Then 'might still be initializing
allColWidths += 5 'removes the horizontal scroll bar from the text part - makes the left hand side look a bit neater
myGanttView.Ratio = allColWidths / myGanttView.Width
End If
End Sub
You can then call this from:
1 - the Load event, so it looks nice at the start and
2 - from the resize, so it stays looking nice:
Private Sub myGanttView_Resize(sender As Object, e As EventArgs) Handles myGanttView.ResizeHello!
I was trying to use Sorting/Filtering/Grouping while using VirtualMode by using the default properties and methods and wasn't able to. I found this that said "In the future editions of RadGridView, we have planned to implement virtual grouping operations with a simpler and more useful API." in the year 2009. Have there been any changes? Can i use the functionalities that i want while using VirtualMode without having to override and subscribe several events to workaround this problem?
JP
I have a customer that when adding new records to my data grid doesn't want the records to disappear until the grid is refreshed.
For example, in the screen shot, the user has filtered the rows to State Program = "AK FFS" and NDC = "42543-003-01". The user want to see the existing values while creating the new record i.e., NDC 42543-003-02. When the user enters all the fields and the record gets added it disappears because of the current filters applied. Is there a way to by-pass the filters on the newly added rows?
Appreciate any advise.
Hi,
Is it possible to override the colour and width of the horizontal drag / drop visual cue? If so can you give me an example ?
Cheers
Toby
private void RadGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
e.CellElement.DrawFill = true;
e.CellElement.BackColor = Color.Orange;
e.CellElement.NumberOfColors = 1;
e.CellElement.BorderColor = Color.Yellow;
e.CellElement.BorderWidth = 3;
e.CellElement.DrawBorder = true;
e.CellElement.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
e.CellElement.BorderGradientStyle = Telerik.WinControls.GradientStyles.Solid;
}
private void RadGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
{
e.RowElement.DrawFill = true;
e.RowElement.BackColor = Color.GreenYellow;
e.RowElement.NumberOfColors = 1;
e.RowElement.BorderColor = Color.Aqua;
e.RowElement.BorderWidth = 3;
e.RowElement.DrawBorder = true;
e.RowElement.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
e.RowElement.BorderGradientStyle = Telerik.WinControls.GradientStyles.Solid;
}
e.RowElement.Padding = new Padding(20,20,20,20);
e.RowElement.Margin = new Padding(20,20,20,20);
e.CellElement.Margin = new Padding(10, 10, 10, 10);