Telerik Forums
UI for WinForms Forum
19 answers
414 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
121 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
214 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
112 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
704 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
264 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
2 answers
86 views
Hi,
We have GridView with predefined columns (AutoGenerateColumns=false) bound to DataTable. DataTable has boolean field which is represented by CheckBoxColumn in GridView. GridView Display data as expected (true values appear checked and false unchecked). GridView is editable.
Any attempt to check unchecked checkbox not working - as soon as field looses focus, it revert to unchecked state.
We are using 2012 Q2 version.
What are we missing?
Thanks in advance,
Leon
Leon
Top achievements
Rank 1
 answered on 23 Jul 2012
1 answer
79 views
Hi All,

i need to get the axis Y value by the acutal mouse position on chart control...do has anybody solution ?

thanks lot
Ves
Telerik team
 answered on 23 Jul 2012
9 answers
162 views
Hi,

Several questions:
 I downloaded the full suite trial installer (web installer). Did the install and it errored. I can't add Telerik components to my projects, you get an error.

1) So I want to uninstall, but I can't find a unified uninstaller, just the half dozen separate installers in Programs. Is there a way to uninstall them alll in one go?

2) Where is the offline installer? If I have to use the web installler again I'm going to be here hours first uninstalling, then reinstalling via web installer. If it still doesn't work, well I imagine that would be annoying.

I've seen several threads here about offline installers, but they are all pointing at the licensed users only area.

Thanks
Petar
Telerik team
 answered on 23 Jul 2012
2 answers
358 views
Am trying to search a specific Text in the Document, and replace it with Table.
this is what am doing:
      private void Replace()
        {
              this.radRichTextBox1.Document.Selection.Clear();
              DocumentTextSearch ser = new DocumentTextSearch(this.radRichTextBox1.Document);
              IList<DocumentPosition> startPositions = new List<DocumentPosition>();
              IList<DocumentPosition> endPositions = new List<DocumentPosition>();
   
              foreach (var textRange in ser.FindAll("<Threat"))
                startPositions.Add(textRange.StartPosition);
              foreach (var textRange in ser.FindAll(KEYEND))
                   endPositions.Add(textRange.EndPosition);
              string xml = string.Empty;
              for (int i = 0; i < startPositions.Count; i++)
             {
                this.radRichTextBox1.Document.Selection.Clear();
                this.radRichTextBox1.Document.Selection.AddSelectionStart(startPositions[i]);
                this.radRichTextBox1.Document.Selection.AddSelectionEnd(endPositions[i]);
                 
                xml = this.radRichTextBox1.Document.Selection.GetSelectedText();
                Table tbl = GenerateTable(xml);
                this.radRichTextBox1.InsertTable(tbl);
            }



but it doesn't work. when i try to replace the selection with any string, it works fine. what's wrong??? please help
Svett
Telerik team
 answered on 23 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)
Chart (obsolete as of Q1 2013)
Form
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
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
NavigationView
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?