Hi everyone,
When exporting my grid view to pdf, all the form components shrink and their text doesn't fit inside the component. I will share my code block and some screenshots with you. I look around for some clues but i didn't find anything. Please explain me how is this happening.
GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.exportGrid, SpreadExportFormat.Pdf);
SpreadExportRenderer exportRenderer = new SpreadExportRenderer();
spreadExporter.ExportVisualSettings = true;
spreadExporter.RunExportAsync(this.fileDialog.FileName, exportRenderer);
***Updated with simple standalone project attachment (ViewCellFormatting.zip)
Problem Statement:
After initial load of RadGridView with ViewCellFormatting, the appearance looks desaturated/washed out (as shown in Figure 1), until I manually mouseover the rows (as shown in Figure 2 & Figure 3).
Formatting Cells:
private void dgvMap_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
if (e.CellElement is GridCellElement && e.CellElement.Text.Trim().Length != 0)
{
Color c = Color.Black;
e.CellElement.ForeColor = Color.Black;
e.CellElement.BackColor = c;
e.CellElement.DrawFill = true;
}
}
Figure 1 (Initial Load):
Figure 2 (Manual Mouse Roll Over - partial):
Figure 3 (Manual Mouse Roll Over - Full):
[C# WinForm]
Regarding the Row Header (as shown in the figure below: (R1, R2, R3,...)
Question:
Reference:
https://www.telerik.com/forums/radgridview-row-header-related-questions
Based on the reference topic, I have attempted the to get the Row Header using Visual Rows.
var cellContent = this.radGridView1.TableElement.VisualRows[0].VisualCells[0].Text;
But seems like the VisualRows doesn't reflect all the rows.
For example, I have populated 77 rows as shown in first figure below.
However, the count of VisualRows is 4 only (as shown in second figure).
Formatting Row Header:
private void dgvMap_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
if (e.CellElement is GridRowHeaderCellElement)
{
e.CellElement.Text = string.Format("R{0}", dgvMap.CurrentView.ViewInfo.Rows.IndexOf(e.Row) + 1);
var element = new RadButtonElement();
element.Margin = new Padding(3, 3, 3, 3);
element.Padding = new Padding(2, 0, 2, -2);
element.ImageAlignment = ContentAlignment.MiddleCenter;
element.Alignment = ContentAlignment.MiddleCenter;
element.ForeColor = Color.Black;
element.Text = string.Format("R{0}", dgvMap.CurrentView.ViewInfo.Rows.IndexOf(e.Row) + 1);
element.AutoSizeMode = RadAutoSizeMode.Auto;
element.MinSize = new Size(80, 50);
e.CellElement.Children.Add(element);
e.CellElement.ForeColor = Color.White;
}
Populating Rows & Columns:
numberOfRow = int.Parse(maxRow);
numberOfColumn = int.Parse(maxCol);
for (int j = 1; j <= numberOfColumn; j++)
dgvMap.Columns.Add(string.Format("C{0}", j));
for (int k = 1; k <= numberOfRow; k++)
{
dgvMap.Rows.Add(new string[] { "" });
}
for (int k = 1; k <= numberOfRow; k++)
{
for (int j = 1; j <= numberOfColumn; j++)
{
string key = string.Format("{0},{1}", this.dgvMap.TableElement.VisualRows[k-1].VisualCells[0].Text, dgvMap.Columns[j - 1].Name);
}
}
We use RadDock.SaveToXml and LoadFromXml to store the current dock state of our WinForms application.
We have a problem that if a user floats a ToolWindow and then reattaches it and then the RadDock SaveToXml is called a new ToolTabStrip appears to be created. This means that when a new ToolWindow is added to the ToolTabStrip (found by name), it is adding the ToolWindow to the wrong ToolTabStrip and the new ToolWindow cannot be seen.
I am wondering how to fix this and think the best way would be to use an event triggered on re-docking to place the ToolWindow being re-docked in the correct ToolTabStrip. Is there any suggested way to do this or any other solution?
Before floating and re-docking the ToolWindow:
<Telerik.WinControls.UI.Docking.ToolTabStrip SelectedIndex="0" CanUpdateChildIndex="True" Size="200, 994" Location="1, 1" CausesValidation="False" Name="toolTabStrip_Navigation" TabIndex="2" TabStop="False">
<SizeInfo SplitterCorrection="0, 0" AutoSizeScale="0, 0" />
<Controls>
<Telerik.WinControls.UI.Docking.ToolWindow Caption="" AllowedDockState="Docked, Hidden, AutoHide, Floating" PreviousDockState="Docked" Name="twNavigation" Size="192, 960" Location="4, 30" AccessibleDescription="Explorer" AccessibleName="Explorer" Font="Microsoft Sans Serif, 8.25pt" Text="Explorer" />
</Controls>
</Telerik.WinControls.UI.Docking.ToolTabStrip>
After re-docking the ToolWindow:
<Telerik.WinControls.UI.Docking.ToolTabStrip SelectedIndex="0" CanUpdateChildIndex="True" Size="200, 994" Location="1, 1" Name="DockTabStrip3" TabIndex="4" TabStop="False">There is a bug in the RadGridView when using built in filters.
If I filter a grid by a value that returns a single row, the row is visibly selected but and I get a System.NullReferenceException, if I try to get a cell value when the SelectionChanged event is fired. When I handle the exception, and I then click on the row, it does not fire the SelectionChanged event.
I have to set .CurrentRow = Nothing on FilterChanged in order to click on and select the row, which will then fire the SelectChanged event and I get the value expected.
Here is my relevant code to reproduce the issue;
Private Sub RadGridViewFullBadge_SelectionChanged(sender As Object, e As EventArgs) Handles RadGridViewFullBadge.SelectionChanged
'This If Statement is Required or I get a System.NullReferenceException after the filter is applied
If RadGridViewFullBadge.CurrentRow IsNot Nothing Then
RadTextBoxControlTestBadge.Text = RadGridViewFullBadge.CurrentRow.Cells("BadgeID").Value
End If
End Sub
Private Sub RadGridViewFullBadge_FilterChanged(sender As Object, e As GridViewCollectionChangedEventArgs) Handles RadGridViewFullBadge.FilterChanged
RadGridViewFullBadge.CurrentRow = Nothing
End Sub
James
Hello
I have Un-installed all Telerik controls, VS2022.
Used ProgressControlPanelSetupA_2022_1_0727_1.exe to reinstall.
Then, Create new project of type 'Telerik UI for Winforms cSharp .Net Core App'
But I am getting
Severity Code Description Project File Line Suppression State
Error NU1101 Unable to find package UI.for.WinForms.AllControls.Net60. No packages exist with this id in source(s): nuget.org. PackageSourceMapping is enabled, the following source(s) were not considered:
C:\Program Files\dotnet\library-packs, Telerik, Telerik UI for WinForms 2022.3.921, Telerik UI for WinForms 2022.3.921.0.
ARTesting D:\Development\AngleRing\AngleRingCRM\ARTesting\ARTesting.csproj 1
Please advise
Thank you.
Steven Fellows
Hi,
I got the following error while loading the RadForm. Can you help. Thanks
Peter
Hello,
In order to sincronize horizontal scrollbars in GridView we are using the source code of the following article:
https://docs.telerik.com/devtools/winforms/knowledge-base/synchronize-scrollbars-in-hierarchy-levels
The thing is that we have tried this code in an empty project with an empty grid with 11 columnas, 30 rows and still 0 child rows and when I move the scroll bar there is too much lag.
The code line that causes the lag is: this.radGridView1.MasterTemplate.Refresh(); in the HScrollBar_ValueChanged method but it's the line that makes everything work.
Is there any way to imporve this or any new method that we can implemente since the article was made in 2018 so there may be there ways to do it.
Thank you and regards.
Hi,
default behavior when creating a new WinForms project is that this setting is generated in app.config:
<appSettings>
<add key="TelerikWinFormsThemeName" value="VisualStudio2022Light" />
</appSettings>
Since I am using .net 6 and appsettings.json, I would love to eliminate app.config entirely.
Is there a way to move this setting to appsettings.json or implement it in code globally (without adding the code in every form or user control) and still maintain the design time functionality?
regards,
Darko