Telerik Forums
UI for WinForms Forum
7 answers
491 views
Hello, 
I am trying to change color of the header cell in currently selected column. I tried to achieve this as it is done in this post Change of back color, however the header cells will start to react only if the user hovers with mouse over specified columns before he starts clicking into the grid. 

Here is the code snippet I use
        void electionChanged(object sender, EventArgs e)
        {
            if (SelectedCells.Count == 0)
                return;
            int index = SelectedCells[0].ColumnInfo.Index;

            if (MasterGridViewInfo.TableHeaderRow.Cells[index].CellElement == null)
                return;

           for (int i = 0; i < Columns.Count; i++ )
                MasterGridViewInfo.TableHeaderRow.Cells[i].CellElement.ResetValue(LightVisualElement.BackColorProperty);

            MasterGridViewInfo.TableHeaderRow.Cells[index].CellElement.SetValue(
                LightVisualElement.BackColorProperty, Color.Blue);
        }

Can you please pinpoint where is the problem?
Richard Slade
Top achievements
Rank 2
 answered on 21 Mar 2011
4 answers
424 views

Hi

 

Users of my app some time ago reported issue with memory leak, so I started investigation and it looks that there is problem with RadGridView.

 

 

This is my sample code:

 

 

 

public partial class Form1 : Form
{
    BindingList<Package> _packages = new BindingList<Package>();
    BindingList<PackageItem> _items = new BindingList<PackageItem>();
    public Form1()
    {
        InitializeComponent();
        radGridView1.DataSource = _packages;
        radGridView1.ReadOnly = true;       
     
        GridViewTemplate viewItemsTemplate = new GridViewTemplate();
        viewItemsTemplate.DataSource = _items;
        this.radGridView1.MasterTemplate.Templates.Add(viewItemsTemplate);
 
        GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate);
        relation.RelationName = "myRelation";
        relation.ChildTemplate = viewItemsTemplate;

        relation.ParentColumnNames.Add("Id");
        relation.ChildColumnNames.Add("PackageId");

        this.radGridView1.Relations.Add(relation);
        _packages.Add(new Package() { Id = "1", Name = "Package1" });
        _items.Add(new PackageItem() { Id = "1", PackageId = "1", Name = "Item1 in package1" });
        _items.Add(new PackageItem() { Id = "2", PackageId = "1", Name = "Item2 in package1" });
        _packages.Add(new Package() { Id = "2", Name = "Package2" });
        _items.Add(new PackageItem() { Id = "3", PackageId = "2", Name = "Item1 in package2" });
        _items.Add(new PackageItem() { Id = "4", PackageId = "2", Name = "Item2 in package2" });
        radGridView1.BestFitColumns();
    }
    private void btnDelete_Click(object sender, EventArgs e)
    {
        radGridView1.BeginUpdate();
        PackageItem pi = _items[0];
        _items.Remove(pi);
        radGridView1.EndUpdate();
    }
}

 

 

 

 

 

 

 

When I delete row I call BeingUpdate() and EndUpdate(), this is needed – without these calls row is not deleted and after click on row exception is thrown.

 

The problem for sure is missing unhooking event RadGridView.ThemeNameChanged (I do not know if there are other missing unhooks).

 

 

 

TO SEE this problem before deleting row YOU HAVE TO expand child rows!

 

 

I used profiler and I have seen that there are types that hook this event and do not unhook after disposing! These types are: GridDetailViewCellElement, GridDetailViewRowElement, GridTableElement. You can check details in screen shots.

How can I solve this problem? This is really urgent issue for me – I have a lot of updates in my grid and after couple hours there is always out of memory exception caused by my app.

Regards

 

 

Jack
Telerik team
 answered on 21 Mar 2011
3 answers
245 views
We use the Desktop Alerts quite extensive now, but something annoys me:
When RadDesktopAlerts became visible while i am editing in a RadTextBox it seems to steal the focus. I can still type letters but delete and return keys are disabled. When the RadDesktopAlert disappears (we use the autoclose property) the keyboard works again and i can continue with the TextBox. Is there something you can do to fix this in the next version? Or is there already a setting to keep the Alert in the background?

You can see the problem in your samples: Desktop Alert->Settings
Preview the Alert and edit in the "Delay" text box. You can add numbers but delete and return keys are redirected to the desktop alerts.

Best regards

Bernd
Bernd Mueller
Top achievements
Rank 1
 answered on 21 Mar 2011
2 answers
155 views
Hello,
I'm working with a GridView in bound mode. It's bounded with a List which receives new rows during execution time. At a certain point, a new row is added, this row turns to be the selected one and the gridview scrolls. That's my problem: I want it to maintain the line (chosen previously by the user) as the one selected. But, this is not the beahaviour I'm getting, because every row which is added or updated becomes the one selected.
How can I make the selected row stay the same while adding this new rows to the bounded list?

Thanks,
Alexandre
Alexandre
Top achievements
Rank 1
 answered on 21 Mar 2011
3 answers
199 views
Hi - I am sure I am not doing this right but not sure how it is done

I have an mdi parent with a rad ribbon bar on it. When I click a button on the ribbon bar it loads an child form. In the child form I have a rad treeview. But when the form loads the nodes do not show up. I can see the treeview, but the nodes do not populate

 Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()
        AddNodes()

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Private Sub AddNodes()
        Me.MdiParent = Form1
        Me.RadTreeView1.Parent = Form1
        Dim Node1 As New RadTreeNode("Node1")
        Node1.Tag = 1234
        Node1.BackColor = Color.Blue
        Dim Node2 As New RadTreeNode("Node2")
        Dim Node3 As New RadTreeNode("Node3")
        Dim Node4 As New RadTreeNode("Node4")
        RadTreeView1.Nodes.Add(Node1)
        RadTreeView1.Nodes.Add(Node2)
        Node1.Nodes.Add(Node3)
        Node2.Nodes.Add(Node4)
    End Sub
Richard Slade
Top achievements
Rank 2
 answered on 21 Mar 2011
2 answers
189 views
Hi,

I am not able to set the start date of the Timeline View to the Current Date. It always defaults to 31 Dec 2010.
The Range is applied correctly. i.e. 1 Year on either side of today.

I did refer to the documentation at - http://www.telerik.com/help/winforms/scheduler-views-timeline-view.html

and have the following in my code:

this.rScheduler.GetTimelineView().StartDate = DateTime.Today;
this.rScheduler.GetTimelineView().RangeStartDate = DateTime.Today.AddYears(-1);
this.rScheduler.GetTimelineView().RangeEndDate = DateTime.Today.AddYears(1);

If I change the first statement to: this.rScheduler.GetTimelineView().StartDate = new DateTime(2010, 11, 20);
this sets the default date on the Timeline View to this date correctly when the TimelineView is shown.
Any date after 31st Dec 2010 sets the Time Line View Start date to 31st Dec 2010.

Thanks,
Lester

 

Dobry Zranchev
Telerik team
 answered on 21 Mar 2011
2 answers
163 views
I have a dock control with 6 minimized toolbar windows and all works as expected accept when a tabbed document it loaded into the MDI area and one of the toolbar windows is opened and a control within that toolbar window is clicked the following exception is thrown:

System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
  Source=Telerik.WinControls.RadDock
  StackTrace:
       at Telerik.WinControls.UI.Docking.DocumentManager.get_ActiveDocument()
       at Telerik.WinControls.UI.Docking.DocumentManager.InsertDocument(Int32 index, DockWindow document)
       at Telerik.WinControls.UI.Docking.DocumentManager.EnsureActiveDocument()
       at Telerik.WinControls.UI.Docking.DocumentManager.get_ActiveDocument()
       at Telerik.WinControls.UI.Docking.DocumentManager.OnActiveWindowChanged(DockWindow currActive)
       at Telerik.WinControls.UI.Docking.RadDock.OnActiveWindowChanged(DockWindowEventArgs e)
       at Telerik.WinControls.UI.Docking.RadDock.UpdateActiveWindow(DockWindow window, Boolean forceNotify)
       at Telerik.WinControls.UI.Docking.RadDock.ActivateWindow(DockWindow window, Boolean forceNotify)
       at Telerik.WinControls.UI.Docking.RadDock.set_ActiveWindow(DockWindow value)
       at Telerik.WinControls.UI.Docking.DockWindow.OnEnter(EventArgs e)
       at System.Windows.Forms.Control.NotifyEnter()
       at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
       at System.Windows.Forms.ContainerControl.AssignActiveControlInternal(Control value)
       at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
       at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
       at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control)
       at System.Windows.Forms.Control.WmSetFocus(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at Telerik.WinControls.RadControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.SetFocus(HandleRef hWnd)
       at System.Windows.Forms.Control.FocusInternal()
       at System.Windows.Forms.Control.Focus()
       at Telerik.WinControls.RadControl.ProcessFocusRequested(RadElement element)
       at Telerik.WinControls.RadControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at PCNManager.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Any assistance would be appreciated.

Thanks

Simon
Simon Maystre
Top achievements
Rank 1
 answered on 21 Mar 2011
1 answer
142 views
Hi,
I am using Dock in My MDI From .
My problem is I cannot get auto scroll bars when the contents of the docking
panel exceed the boundaries.
Richard Slade
Top achievements
Rank 2
 answered on 21 Mar 2011
2 answers
158 views
Hello,

The TreeNode of TreeView in web version has a "Value" property that can be bound from XML files. Our colleagues cannot find the corresponding one in WinForm TreeView.

Do you suggest any property as a substitute (that can be bound from XML files)?

Thanks a lot.
Ricky.
Stefan
Telerik team
 answered on 21 Mar 2011
4 answers
152 views
Hi,

I have a situation where after editing I have to fire an event containing the old and new name of the edited node so other sections of my application can update to match.  What is the best way to accomplish this?

Regards,
Brad
Stefan
Telerik team
 answered on 21 Mar 2011
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
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Form
Chart (obsolete as of Q1 2013)
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
PdfViewer and PdfViewerNavigator
CommandBar
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
Label
AutoCompleteBox
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
SyntaxEditor
Wizard
CollapsiblePanel
LayoutControl
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
SmartPasteButton
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?