Telerik Forums
UI for WinForms Forum
3 answers
412 views
I have a schedule control and a calendar control on a form.

When a user clicks on a cell in the schedule control (in timeline view), the calendar updates to show, as specialdays, all the days for the month that has the day in it that the user selected.

The specialdays and focusedDate have a very similar colour and I want to recolour the special days and focuseddate colours so they are easily identifiable.

Ive started changing the special days color, but when a user clicks in a different scheduler cell, the background color of the calendar remains how it was set previously.

I'm using the ElementRender event of the calender control to see if its a special day, and if it is colour it. I'm not sure how to reset it if it isnt.

Code below, and any help greatly appreciated.


private void Calendar_ElementRender(object sender, RenderElementEventArgs e)
{
    foreach (RadCalendarDay date in ((RadCalendar)sender).SpecialDays)
    {
        if (e.Day.Date == date.Date)
        {
            e.Element.BackColor = Color.Red;
            return;
        }
    }
}
Stefan
Telerik team
 answered on 26 Jul 2012
2 answers
115 views
Hello,

I have Hyperlink columns and am noticing it's just ignoring the TextAlignment property. I changed the "GridViewHyperlinkColumn" to "GridViewTextBoxColumn" and the TextAlignment works just fine.

var column = new GridViewHyperlinkColumn() { FieldName = sColumnNames[i], HeaderText = sColumnDisplayNames[i],
                                                                            HeaderTextAlignment = ContentAlignment.MiddleLeft, TextAlignment = ContentAlignment.MiddleCenter };
        rgvWidget.Columns.Add(column);
Rahul
Top achievements
Rank 1
 answered on 25 Jul 2012
1 answer
291 views
Hello,
I use RadGridview in my project. I use unbound mode and giving datasource to grid from a collection. I have one gridview template, each row has child rows. In child rows, there is a  GridViewComboboxColumn.

My problem is, i am trying to update child row GridviewComboboxColumn value programmatically on CellEndEdit event of grid. I edit the column, i see its edited in debug, but the changes doesnt display in the cell. Why changes doesnt display, how can i make it display?
Svett
Telerik team
 answered on 25 Jul 2012
1 answer
78 views
Hello Telerik.

Can i call a gridview value such as (name,tag) from my custom griddatacellelement.
Stefan
Telerik team
 answered on 25 Jul 2012
19 answers
504 views
Is there a way of automaticaly add a controll to the GAC? I need to make an install package to my program to deploy in other computers.

Thanks
Teodor
Telerik team
 answered on 25 Jul 2012
2 answers
190 views
Hi,

I have a treeview that shows account numbers in a hierarchy of account groups.
MultiSelect is on for the treeview.
Sometimes (not always), when I drop multiple items on an account group node a thread exception occurs.
I recently upgraded the RadControls from 'Q3 2011 SP1' to 'Q2 2012'. In the older version this problem did not exist. I did not change code, only the Telerik dll changed.

Some more details:

Message = Object reference not set to an instance of an object.
Stacktrace = at Telerik.WinControls.UI.TreeNodeElement.ApplyStyle()
   at Telerik.WinControls.UI.TreeNodeElement.OnPropertyChanged(RadPropertyChangedEventArgs e)
   at Telerik.WinControls.RadObject.RaisePropertyNotifications(RadPropertyValue propVal, Object oldValue, Object newValue, ValueSource oldSource)
   at Telerik.WinControls.RadObject.ResetValueCore(RadPropertyValue propVal, ValueResetFlags flags)
   at Telerik.WinControls.UI.TreeNodeElement.Detach()
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.RemoveElement(Int32 position)
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.UI.ScrollViewElement`1.MeasureViewElement(SizeF availableSize)
   at Telerik.WinControls.UI.ScrollViewElement`1.MeasureView(SizeF availableSize)
   at Telerik.WinControls.UI.ScrollViewElement`1.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.UI.VirtualizedScrollPanel`2.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.RootRadElement.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RootRadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayoutCallback(ILayoutManager manager).

Relevant code:

public partial class AccountGroupList : AccountsFormBase
    {
        public AccountGroupList()
        {
            InitializeComponent();
 
            accountGroupTreeView.NodeMouseDown += AccountGroupTreeViewNodeMouseDown;
            accountGroupTreeView.DragStarting += AccountGroupTreeViewDragStarting;
            accountGroupTreeView.DragOverNode += AccountGroupTreeViewDragOverNode;
            accountGroupTreeView.DragEnding += AccountGroupTreeViewDragEnding;
            accountGroupTreeView.ContextMenuStrip = contextMenuStrip;
            accountGroupTreeView.AllowDragDrop = true;
            accountGroupTreeView.MultiSelect = true;
        }
 
        protected override void OnDataBind()
        {
            FillAccountGroupTreeView();
        }
 
        private void FillAccountGroupTreeView()
        {
            accountGroupTreeView.Nodes.Clear();
             
 
            //find and add main account groups to tree
            foreach (AccountOrAccountGroupInfo mainAccountGroup in Model.AccountGroupHierarchy.Where(x => !x.EreportingId.HasValue && !x.ParentId.HasValue))
            {        
                var mainAccountGroupNode = new AccountGroupNode(mainAccountGroup.AccountGroup, true) {Tag = mainAccountGroup};
 
                //find and add sub account groups of main account group
                foreach (AccountOrAccountGroupInfo subAccountGroup in Model.AccountGroupHierarchy.Where(x => !x.EreportingId.HasValue && x.ParentId == mainAccountGroup.Id))
                {
                    var subAccountNode = new AccountGroupNode(subAccountGroup.AccountGroup, false) { Tag = subAccountGroup };
 
                    //find and add ereporting accounts of sub account group
                    foreach (AccountOrAccountGroupInfo eReportingAccount in Model.AccountGroupHierarchy.Where(x => x.EreportingId.HasValue && x.ParentId == subAccountGroup.Id))
                    {
                        var eReportingAccountNode = new EreportingAccountNode(eReportingAccount.AccountGroup)
                                                        {Tag = eReportingAccount, AllowDrop = false};
                        subAccountNode.Nodes.Add(eReportingAccountNode);   
                    }
 
                    mainAccountGroupNode.Nodes.Add(subAccountNode);  
                }
 
                //find and add ereporting accounts of main account group
                foreach (AccountOrAccountGroupInfo eReportingAccount in Model.AccountGroupHierarchy.Where(x => x.EreportingId.HasValue && x.ParentId == mainAccountGroup.Id))
                {
                    var eReportingAccountNode = new EreportingAccountNode(eReportingAccount.AccountGroup) { Tag = eReportingAccount };
                    mainAccountGroupNode.Nodes.Add(eReportingAccountNode);
                }
 
                accountGroupTreeView.Nodes.Add(mainAccountGroupNode);
            }
 
            //find and add ereporting accounts that are not linked to an account group
            foreach (AccountOrAccountGroupInfo eReportingAccount in Model.AccountGroupHierarchy.Where(x => x.EreportingId.HasValue && !x.ParentId.HasValue))
            {
                var eReportingAccountNode = new EreportingAccountNode(eReportingAccount.AccountGroup) { Tag = eReportingAccount, AllowDrop = false };
 
                accountGroupTreeView.Nodes.Add(eReportingAccountNode);
            }
        }
 
        #region drag, drop, context menu
 
        private void AccountGroupTreeViewDragStarting(object sender, RadTreeViewDragCancelEventArgs e)
        {
            try
            {
                //determine if dragging is allowed for selected node
                if (e.Node != null)
                {
                    //An ereporting account node can be dragged
                    var ereportingAccountNode = e.Node as EreportingAccountNode;
                    if (ereportingAccountNode != null)
                    {
                        e.Cancel = false;
                    }
                    else
                    {
                        //A group node can only be dragged if it has no child groups
                        var accountGroupNode = e.Node as AccountGroupNode;
                        if (accountGroupNode != null)
                        {
                            e.Cancel = (accountGroupNode.SubAccountGroupCount > 0);
                        }
                        else
                        {
                            e.Cancel = true;
                        }
                    }
                }
                else
                {
                    e.Cancel = true;
                }
            }
            catch (Exception)
            {
                e.Cancel = true;   
                throw;
            }
             
        }
 
        private void AccountGroupTreeViewDragOverNode(object sender, RadTreeViewDragCancelEventArgs e)
        {
            try
            {
                //determine if the dragged node can be dropped on the current hovered node
                if (e.Node != null)
                {
                    var accountNode = e.Node as AccountNodeBase;
                    if (accountNode != null)
                    {
                        e.Cancel = !(accountNode.CanBeDroppedOnTarget(e.TargetNode));
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
                else
                {
                    e.Cancel = true;
                }
            }
            catch (Exception)
            {
                e.Cancel = true;   
                throw;
            }
             
         
        }
 
        private void AccountGroupTreeViewDragEnding(object sender, RadTreeViewDragCancelEventArgs e)
        {
            try
            {
                //recheck if it is correct to drop the dragged node on the target node (this event is fired multiple times when multiple nodes are dragged at once)
                //execute the action that is expected
                var accountNode = e.Node as AccountNodeBase;
                if (accountNode != null)
                {
                    if (accountNode.CanBeDroppedOnTarget(e.TargetNode))
                    {
                        var draggedAccountGroupHierarchy = (AccountOrAccountGroupInfo)accountNode.Tag;
                        var targetAccountGroupHierarchy = ((AccountOrAccountGroupInfo)e.TargetNode.Tag);
 
                        if (e.Node is EreportingAccountNode)
                        {
                            Controller.MoveEreportingAccountToAccountGroup(draggedAccountGroupHierarchy.Id, targetAccountGroupHierarchy.Id);
                        }
                        else
                        {
                            Controller.MoveAccountGroupUnderAccountGroup(draggedAccountGroupHierarchy.Id, targetAccountGroupHierarchy.Id);
                        }
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
                else
                {
                    e.Cancel = true;
                }   
            }
            catch (Exception)
            {
                e.Cancel = true;   
                throw;
            }
             
        }
 
        #endregion
 
        #region Tree Node classes
 
        private abstract class AccountNodeBase : RadTreeNode
        {
            protected readonly Font TreeNodeFont = new Font("Segoe UI", 8.25f);
            public abstract bool CanBeDroppedOnTarget(RadTreeNode target);
        }
 
        private class AccountGroupNode : AccountNodeBase
        {
            public bool IsRootNode { get; private set; }
 
            public int SubAccountGroupCount
            {
                get { return Nodes.Count(o => o is AccountGroupNode); }
            }
 
            internal AccountGroupNode(string text, bool isRootNode)
            {
                Font = TreeNodeFont;
                Text = text;
                IsRootNode = isRootNode;
            }
 
            public override bool CanBeDroppedOnTarget(RadTreeNode target)
            {
                //a group node can be dropped on target if
                // -the target is also a group node
                // -the node has no child groups
                // -the node is a main group (level 1)
                // -the target node is not the current parent of the node
                var targetNode = target as AccountGroupNode;
                return targetNode != null && SubAccountGroupCount == 0 && targetNode.IsRootNode && targetNode != Parent;
            }
        }
 
        private class EreportingAccountNode : AccountNodeBase
        {
            internal EreportingAccountNode(string text)
            {
                Font = TreeNodeFont;
                Text = text;
            }
 
            public override bool CanBeDroppedOnTarget(RadTreeNode target)
            {
                //an ereporting node can be dropped on any group node that is not the current parent of the ereporting node
                if (!(target is EreportingAccountNode) && target != Parent)
                {
                    return true;
                }
                return false;
            }
        }
        #endregion
    }
Wesley
Top achievements
Rank 1
 answered on 25 Jul 2012
5 answers
299 views
How to change the rotation direction to be horizontal and moving from left to right, or right to left and displaying more than one item, to be like the marquee in html components ?

regards...
Nikolay
Telerik team
 answered on 25 Jul 2012
0 answers
147 views
Hello,

I need some help with creating 2 y axes. I have looked at the below thread but its not what I'm trying to do
http://www.telerik.com/community/forums/winforms/chart/multiple-y-axis.aspx

I don't need to show a different series on the 2nd y axis. I need 1 row (the Total row) for both series to be shown on the 2nd y axis.

Please take a look at the attached screenshot. SInce the OVERALL item is a sum of the ones above it, it hogs up all the space and the rest of the items appear squished. Thats why I want to show the OVERALL item against it's own y axis and the rest against another y axis. The only other (non elegant) solution I can think of is having 2 Radcharts, but I'm trying to see if that can be avoided.
Rahul
Top achievements
Rank 1
 asked on 24 Jul 2012
5 answers
784 views
I want to sort my ListView on Clicking a column
in similarity to what we do with General ListView in .Net

private void listView1_ColumnClick(object sender, System.Windows.Forms.ColumnClickEventArgs e)
{
}
Imagine the column Header is "Count" and the "Name" is "Column_0" In it's default behavior of the ListView it is sorted with this logic (as strings): 79 < 8 < 89 < 9 , .... The Designer's Code :
Telerik.WinControls.UI.ListViewDetailColumn listViewDetailColumn2 = new Telerik.WinControls.UI.ListViewDetailColumn("Column 1", "Count");
Telerik.WinControls.Data.SortDescriptor sortDescriptor1 = new Telerik.WinControls.Data.SortDescriptor();
I have written a comparer like this for the Default .Net Windows Forms Controls ListView :
public class CountSort: IComparer
{
    public int Compare(object x, object y)
    {
        Product w1 = (Product)x;           
 
        Product w2 = (Product)y;
 
        if (w1.Count> w2.Count)
            return 1;
        if (w1.Count< w2.Count)
            return -1;
        else
            return 0;
    }
}
But now don't know how to link all the items and figure this out. needed help, thanks
Ivan Todorov
Telerik team
 answered on 24 Jul 2012
10 answers
408 views
Hi:
How can i do, BubbleBar Vertically?
on the example only is horizontally...
Thanks!!
my apologies for my english!!
Stefan
Telerik team
 answered on 24 Jul 2012
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
Wizard
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
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?