Telerik Forums
UI for WinForms Forum
3 answers
260 views
Hi everyone,

I developing a new application in visual studio for mono, and I want to use teleriks winforms controls for the gui, and i have a doubt about if winforms controls are compatible with mono.

thaks for your attention.

Best regards


Jack
Telerik team
 answered on 23 Jan 2013
1 answer
141 views
How do I change the size of the items? Whenever I set the AutoSize property of the StripViewItemLayout to False, the whole control disapears in debug mode.


EDIT:

Did it with the Padding property.
Anton
Telerik team
 answered on 23 Jan 2013
1 answer
273 views
Hello,

I am using RadListView that will display an image for each data record.  There will be 4 records in a row with an undetermined number of rows that will depend on the pager.  To the right of the image I would like to add a dividing line, but I do not want the line to appear for the 4th record in each row.  I would also like a horizontal line between the rows.  In other words I would like it to display

image | image | image | image
_________________________

image | image | image | image 

Currently I have my item template defined as a table and have set the right border to display, so it displays the "line" for each record including after the 4th image.  Can anyone tell me how I can do this with the RadListView, or do I need to use a different control?

Thanks.
Jack
Telerik team
 answered on 23 Jan 2013
1 answer
216 views
Some of the users like High Contrast Black for the gridview, but when you do a "Group By" on a column, the "X" or close button is super tiny. Is there a way to modify this to make the "X" or close button bigger?
Plamen
Telerik team
 answered on 22 Jan 2013
1 answer
176 views

Hello,

I have an application were I include a Treeview.

I have some issues with my screen,
when I manipulate this treeview with drag and drop functionality.

The treeview get's rendered and is only showing a part.
It's like the scrollbar is not on the correct position.
When I scroll with the mouse up and down it will be rendered correct again.

This issue appear's when I reorder the treeview with the mouse, aswell in code.
It's not predictable when it occurs.

Has anyone an idea how to fix this ?

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.Data;
using Telerik.WinControls.UI;
 
namespace SortAccountsSpike
{
    public partial class SortAccountsForm : Form
    {
        private Object _currentTargetDataBoundItem;
  
        public SortAccountsForm()
        {
            InitializeComponent();
          //  _dataList = new ObservableCollection<AccountGroup>();
        }
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            AutoScroll = false;
 
            radTreeView1.TreeViewElement.NodeFormatting += TreeViewElement_NodeFormatting;
            radTreeView1.DragStarting += RadTreeView1DragStarting;
            radTreeView1.DragOverNode += RadTreeView1DragOverNode;
            radTreeView1.DragEnding += RadTreeView1DragEnding;
            radTreeView1.TreeViewElement.AutoSizeItems = true;
            radTreeView1.ShowLines = true;
            radTreeView1.ShowRootLines = true;
            radTreeView1.ShowExpandCollapse = true;
            radTreeView1.FullRowSelect = true;
            radTreeView1.LineStyle = TreeLineStyle.Dot;
            radTreeView1.MultiSelect = true;
            radTreeView1.ShowNodeToolTips = true;
            radTreeView1.TreeViewElement.Comparer = new AccounNodeComparer(radTreeView1.TreeViewElement);
            radTreeView1.NodeExpandedChanging += radTreeView1_NodeExpandedChanging;
 
            FillTreeView();
        }
 
        private void FillTreeView()
        {
            radTreeView1.ChildMember = @"AccountGroup\Accounts";
          //  radTreeView1.DisplayMember = @"GroupName\AccountNumber";
            radTreeView1.SortOrder = SortOrder.Ascending;
            radTreeView1.DataSource = AccountModel.AccountGroups;
        }
 
        void TreeViewElement_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
        {
            var treeNodeContentElement = e.NodeElement.ContentElement;
 
            //General styling
            /////////////
  
            //  treeNodeContentElement.StretchHorizontally = true;
            treeNodeContentElement.Padding = new Padding(5);
            treeNodeContentElement.Margin = new Padding(0, 2, 0, 2);
            treeNodeContentElement.SmoothingMode = SmoothingMode.AntiAlias;
            treeNodeContentElement.DrawBorder = true;
            treeNodeContentElement.BorderColor = Color.FromArgb(110, 153, 210);
            treeNodeContentElement.DrawFill = true;
            treeNodeContentElement.GradientStyle = GradientStyles.Linear;
            treeNodeContentElement.NumberOfColors = 2;
 
            //AccountGroupFormatting
            var accountGroup = e.Node.DataBoundItem as AccountGroup;
            if (accountGroup != null)
            {
                treeNodeContentElement.Text = accountGroup.ToDisplayHtml();
                e.Node.Expanded = accountGroup.Expanded;
 
                //fill
                treeNodeContentElement.BackColor = Color.FromArgb(248, 248, 248);
                treeNodeContentElement.BackColor2 = Color.FromArgb(233, 233, 233);
            }
 
            //Account formatting
            var accountInfo = e.Node.DataBoundItem as AccountInfo; 
            if (accountInfo != null)
            {
                treeNodeContentElement.Text = accountInfo.ToDisplayHtml();
 
                if (accountInfo.IsVisible)
                {
                    e.Node.ToolTipText = string.Empty;
                    treeNodeContentElement.BackColor = Color.FromArgb(174, 190, 217);
                    treeNodeContentElement.BackColor2 = Color.FromArgb(168, 183, 210);
                    treeNodeContentElement.ForeColor = Color.Black;
                }
                else
                {
                    e.Node.ToolTipText = "This account is not visible in drop down lists.";
                    treeNodeContentElement.BackColor = Color.FromArgb(227, 233, 242);
                    treeNodeContentElement.BackColor2 = Color.FromArgb(235, 238, 245);
                    treeNodeContentElement.ForeColor = Color.FromArgb(153, 153, 153);
                }
 
                  
            }
        }
 
        void radTreeView1_NodeExpandedChanging(object sender, RadTreeViewCancelEventArgs e)
        {
            var group = e.Node.DataBoundItem as AccountGroup;
            if (group != null)
            {
                group.Expanded = !e.Node.Expanded;
            }
        }
 
        void RadTreeView1DragStarting(object sender, RadTreeViewDragCancelEventArgs e)
        {
            //don't allow the first group to be moved
            if (e.Node.Level == 0 && e.Node.Index == 0)
            {
                e.Cancel = true;
            }
     
            _currentTargetDataBoundItem = null;
        }
 
        void RadTreeView1DragOverNode(object sender, RadTreeViewDragCancelEventArgs e)
        {
            //determine if the dragged node can be dropped on the current hovered node
            if (e.Node != null)
            {
                e.Cancel = !CanBeDroppedOnTarget(e.Node.DataBoundItem, e.TargetNode.DataBoundItem);
            }
            else
            {
                e.Cancel = true;
            }
        }
 
        void RadTreeView1DragEnding(object sender, RadTreeViewDragCancelEventArgs e)
        {
            //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)
            if (CanBeDroppedOnTarget(e.Node.DataBoundItem, e.TargetNode.DataBoundItem))
            {
                if (_currentTargetDataBoundItem == null)
                    _currentTargetDataBoundItem = e.TargetNode.DataBoundItem;
                //execute drag operation      
                MoveNode(e.Node.DataBoundItem);             
            }
        
            e.Cancel = true; //cancel event and make the treeview refresh to reflect the changed observable datasource
            radTreeView1.Nodes.Refresh();
            radTreeView1.SelectedNodes.Clear();
        }
 
        private bool CanBeDroppedOnTarget(Object draggedDataBoundItem, Object targetDataBoundItem)
        {
            var draggedGroup = draggedDataBoundItem as AccountGroup;
            var targetGroup = targetDataBoundItem as AccountGroup;
            if (draggedGroup != null)
            {
                //dragged node is a group -> target must also be a group
                return (targetGroup != null);
            }
            else
            {
                //dragged node is an account
                var draggedAccount = (AccountInfo)draggedDataBoundItem;
 
                //-> if parent is also being dragged, the node cannot be dropped
                var parentGroupIsAlsoDragged = radTreeView1.SelectedNodes.Select(n => n.DataBoundItem)
                                                           .OfType<AccountGroup>()
                                                           .Any(
                                                               group =>
                                                               group.Accounts.Any(
                                                                   account => account.Id == draggedAccount.Id));
 
                return !parentGroupIsAlsoDragged;
            }
        }
 
        private void MoveNode(Object draggedDataBoundItem)
        {
            var draggedGroup = draggedDataBoundItem as AccountGroup;
            var targetGroup = _currentTargetDataBoundItem as AccountGroup;
            var draggedAccount = draggedDataBoundItem as AccountInfo;
            var targetAccount = _currentTargetDataBoundItem as AccountInfo;
            if (draggedGroup != null)
            {
                if (targetGroup == null)
                {
                    throw new InvalidOperationException(
                        "Dropping an account group on a node that does not represent an account group is not possible.");
                }
 
                MoveAccountGroup(draggedGroup, targetGroup);
            }
            else
            {
                //move account
                MoveAccount(draggedAccount, targetAccount, targetGroup);
            }
        }
 
        private void MoveAccount(AccountInfo draggedAccount, AccountInfo targetAccount, AccountGroup targetGroup)
        {
            Debug.Assert(draggedAccount != null);
 
            AccountGroup draggedGroup = AccountModel.AccountGroups.First(group => @group.Accounts.Contains(draggedAccount));
 
            if (targetAccount != null)
            {
                targetGroup = AccountModel.AccountGroups.First(group => @group.Accounts.Contains(targetAccount));
            }
            Debug.Assert(targetGroup != null);
 
            //move down items
            var targetSequence = (targetAccount != null) ? targetAccount.Sequence : 0;
            var accountInfosToMove = targetGroup.Accounts.Where(accInfo => accInfo.Sequence > targetSequence);
            foreach (var accInfo in accountInfosToMove)
            {
                accInfo.Sequence += 1;
            }
 
            //move item
            draggedAccount.Sequence = targetSequence + 1;
 
            if (draggedGroup.Id != targetGroup.Id)
            {
                draggedGroup.Accounts.Remove(draggedAccount);
                targetGroup.Accounts.Add(draggedAccount);
                NormalizeAccountSequences(draggedGroup.Accounts);
            }
 
            NormalizeAccountSequences(targetGroup.Accounts);
 
            if (_currentTargetDataBoundItem is AccountInfo)
            {
                _currentTargetDataBoundItem = draggedAccount;
            }
        }
 
        private void MoveAccountGroup(AccountGroup draggedGroup, AccountGroup targetGroup)
        {
            //move down items
            var groupsToMove = AccountModel.AccountGroups.Where(group => @group.Sequence > targetGroup.Sequence);
            foreach (var group in groupsToMove)
            {
                @group.Sequence += 1;
            }
 
            //move group
            draggedGroup.Sequence = targetGroup.Sequence + 1;
 
            //normalize
            NormalizeGroupSequences(AccountModel.AccountGroups);
        }
 
        private void NormalizeAccountSequences(IEnumerable<AccountInfo> accountInfosToNormalize)
        {
            var index = 0;
 
            foreach (var accInfo in accountInfosToNormalize.OrderBy(account => account.Sequence))
            {
                accInfo.Sequence = ++index;
            }
        }
 
        private void NormalizeGroupSequences(IEnumerable<AccountGroup> accountGroupsToNormalize)
        {
            var index = 0;
 
            foreach (var group in accountGroupsToNormalize.OrderBy(group => group.Sequence))
            {
                group.Sequence = ++index;
            }
        }
 
 
        private void MakeVisibleButtonClick(object sender, EventArgs e)
        {
            ChangVisibilityOfSelectedNodes(true);
        }
 
        private void MakeInvisibleButtonClick(object sender, EventArgs e)
        {
            ChangVisibilityOfSelectedNodes(false);
        }
 
        private void ChangVisibilityOfSelectedNodes(bool isvisible)
        {
            var accountsToChange = radTreeView1.SelectedNodes.Select(n => n.DataBoundItem).OfType<AccountInfo>().ToList();
 
            foreach (var account in accountsToChange)
            {
                account.IsVisible = isvisible;
            }
 
            radTreeView1.Nodes.Refresh();
        }
 
        private void ChangeAliasButtonClick(object sender, EventArgs e)
        {
            string filledInAlias = string.Empty;
 
            var uniquePreferedNames =
                (from account in radTreeView1.SelectedNodes.Select(n => n.DataBoundItem).OfType<AccountInfo>()
                 group account by account.PreferedName
                 into accountGroup
                 select accountGroup.Key).ToList();
 
            if (uniquePreferedNames.Count == 1)
            {
                filledInAlias = uniquePreferedNames.First();
            }
 
            var result = InputDialog.ShowInputBox("Edit alias", "Please fill in an alias for the selected account(s)", out filledInAlias, this, filledInAlias);
 
            if (result == DialogResult.OK)
            {
                var accountsToChange = radTreeView1.SelectedNodes.Select(n => n.DataBoundItem).OfType<AccountInfo>().ToList();
 
                foreach (var account in accountsToChange)
                {
                    account.PreferedName = filledInAlias;
                }
 
                radTreeView1.Nodes.Refresh();
            }     
        }
 
        private static class AccountModel
        {
            private static ObservableCollection<AccountGroup> _accountGroups;
            public static ObservableCollection<AccountGroup> AccountGroups
            {
                get { return _accountGroups ?? (_accountGroups = LoadInitialDataList()); }
            }
 
            private static ObservableCollection<AccountGroup> LoadInitialDataList()
            {
                var dataCollection = new ObservableCollection<AccountGroup>();
                var groupNone = new AccountGroup
                    {
                    Id = Guid.NewGuid(),
                    GroupName = "No group",
                    Sequence = 1,
                    Expanded = true
                };
                dataCollection.Add(groupNone);
 
                var groupTest = new AccountGroup
                {
                    Id = Guid.NewGuid(),
                    GroupName = "Some other group",
                    Sequence = 2
                };
                dataCollection.Add(groupTest);
 
                var anotherGroup = new AccountGroup
                {
                    Id = Guid.NewGuid(),
                    GroupName = "Yet another group",
                    Sequence = 3
                };
                dataCollection.Add(anotherGroup);
 
                var item1 = new AccountInfo
                {
                    Id = Guid.NewGuid(),
                    AccountNumber = "1",
                    Balance = 154000,
                    Currency = "EUR",
                    Product = "Alba VZW, Mullens Kris",
                    Sequence = 1,
                    IsVisible = true
                };
                groupNone.Accounts.Add(item1);
 
                var item2 = new AccountInfo
                {
                    Id = Guid.NewGuid(),
                    AccountNumber = "2",
                    Balance = 500,
                    Currency = "EUR",
                    Product = "John Doe",
                    PreferedName = "The unknown account",
                    Sequence = 3,
                    IsVisible = true
                };
                groupNone.Accounts.Add(item2);
 
                var item3 = new AccountInfo
                {
                    Id = Guid.NewGuid(),
                    AccountNumber = "3",
                    Balance = -600,
                    Currency = "EUR",
                    Product = "Jane Doe",
                    Sequence = 4
                };
                groupTest.Accounts.Add(item3);
 
                var item4 = new AccountInfo
                {
                    Id = Guid.NewGuid(),
                    AccountNumber = "4",
                    Balance = -600,
                    Currency = "EUR",
                    Product = "John Denver",
                    Sequence = 5
                };
                groupTest.Accounts.Add(item4);
 
                var item5 = new AccountInfo
                {
                    Id = Guid.NewGuid(),
                    AccountNumber = "5",
                    Balance = 600897,
                    Currency = "EUR",
                    Product = "Richie Vallens",
                    Sequence = 6,
                    IsVisible = true
                };
                groupTest.Accounts.Add(item5);
 
                for (int i = 0; i < 10; i++)
                {
                    var item6 = new AccountInfo
                    {
                        Id = Guid.NewGuid(),
                        AccountNumber = "BE11 2222 3333 4444",
                        Balance = -150,
                        Currency = "EUR",
                        Product = "Donna Summer",
                        Sequence = i + 1
                    };
                    anotherGroup.Accounts.Add(item6);
                }
 
                
 
                return dataCollection;
            }
        }
    }
 
    public class AccounNodeComparer : TreeNodeComparer
    {
        public AccounNodeComparer(RadTreeViewElement treeViewElement)
            : base(treeViewElement)
        {
 
        }
 
        public override int Compare(RadTreeNode x, RadTreeNode y)
        {
            //compare 2 account groups
            var accountGroup1 = x.DataBoundItem as AccountGroup;
            var accountGroup2 = y.DataBoundItem as AccountGroup;
 
            if (accountGroup1 != null && accountGroup2 != null)
            {
                return accountGroup1.CompareTo(accountGroup2);
            }
 
            //compare 2 accounts
            var accountInfo1 = x.DataBoundItem as AccountInfo;
            var accountInfo2 = y.DataBoundItem as AccountInfo;
 
            if (accountInfo1 != null && accountInfo2 != null)
            {
                return accountInfo1.CompareTo(accountInfo2);
            }
 
            return 0;
        }
    }
}

Kind regards.

Ralf

Svett
Telerik team
 answered on 22 Jan 2013
6 answers
422 views

Hi

RadGridView has property AllowColumnReorder.

How can I disable reordering specific column?

 

In my case I don`t want let user move first column, all other columns can be reordered.

 

Regards

Stefan
Telerik team
 answered on 22 Jan 2013
1 answer
244 views
I am facing a problem with theme to change text color to white in grid highlight and menu highlight.
Also the split button color can't make homogeneous

Attached is screenshots of the controls that I failed to change its color to white.

I can send the theme file, but failed to attach to the post (incorrect file extension)
Plamen
Telerik team
 answered on 22 Jan 2013
1 answer
204 views
Hi Telerik,

First of all thanks for supporting and providing answers for my  previous questions. i am facing difficulties in getting the parent menu items text. I have attached the image below, in which when i click on the 'Test Member4' i should get the Parent menu item text (ie) 'Test Member3' programatically. i dont know whether telerik allows as to achieve that?  please give the solution for the same.

Note: all the menu items are dynamically created so i cant take any static text.

Thanks in Advance.
Dev.
Princy
Top achievements
Rank 2
 answered on 22 Jan 2013
4 answers
399 views
Hi all,

I have a RadMenu1 control, with inside 10  controls (named RadMenuItem1,RadMenuItem2,RadMenuItem3,...

How can I change the visibility of the RadMenuItem elements in a loop ?

I try to use :
for i=1 to 10   me.controls("RadMenuItem" & i.tostring).visible=False or True   but it don't work !

Thanks
Princy
Top achievements
Rank 2
 answered on 22 Jan 2013
0 answers
64 views
RadPanel or RadScrollablePanel design time Scrolling not supported?
like winform panel

lee
Top achievements
Rank 1
 asked on 22 Jan 2013
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
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
Styling
Barcode
PopupEditor
RibbonForm
TaskBoard
Callout
NavigationView
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Security
LocalizationProvider
Dictionary
SplashScreen
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?