Telerik Forums
UI for WinForms Forum
3 answers
176 views
Hi,
I'm getting into TPF based control development and I'm finding a lot of difficulties to understand the behind logic maybe because there is not enough documentation and examples on that.

I'm trying to make a control that arrange in a stacklayout many radlabelelement as the Rows property value of my control; the height of any child element should be control.Size.Height/control.Rows, so I got my child to have same height.

This is the way I implement it, could you please help me on that?

MyControl:
    public class MyControl : RadControl 
    { 
        MyElementPanel elementPanel; 
 
        public MyControl() 
        { 
            this.UseNewLayoutSystem = true
            this.AutoSize = true
        } 
 
        protected override void CreateChildItems(RadElement parent) 
        { 
            elementPanel = new MyElementPanel(); 
            this.RootElement.Children.Add(elementPanel); 
            base.CreateChildItems(parent); 
        } 
 
        public int Rows 
        { 
            get 
            { 
                return this.elementPanel.Rows; 
            } 
            set 
            { 
                this.elementPanel.Rows = value; 
            } 
        } 
 
    } 
 

MyElement:
    public class MyElementPanel : RadItem 
    { 
        StackLayoutPanel layout; 
 
        public static RadProperty RowsProperty = RadProperty.Register( 
            "Rows"
            typeof(int), 
            typeof(MyElementPanel), 
            new RadElementPropertyMetadata(2, ElementPropertyOptions.AffectsLayout)); 
 
        public int Rows 
        { 
            get 
            { 
                return (int)this.GetValue(RowsProperty); 
            } 
            set 
            { 
                this.SetValue(RowsProperty, value); 
            } 
        } 
 
        protected override void CreateChildElements() 
        { 
            var border = new BorderPrimitive(); 
            Children.Add(border); 
            var background = new FillPrimitive(); 
            Children.Add(background); 
 
            layout = new StackLayoutPanel(); 
            layout.Orientation = System.Windows.Forms.Orientation.Vertical; 
            this.Children.Add(layout); 
 
            var rows = this.Rows; 
            int rowHeight = (int)this.Size.Height / rows; 
            for (int i = 0; i < rows; i++) 
            { 
                var child = new RadLabelElement(); 
                child.Text = (i + 1).ToString(); 
                child.Margin = new System.Windows.Forms.Padding(1); 
                child.Children[2].AutoSize = false
                child.Children[2].Size = new Size(20, rowHeight); 
                child.BorderVisible = true
                layout.Children.Add(child); 
            } 
 
            base.CreateChildElements(); 
        } 
 
        protected override void OnPropertyChanged(RadPropertyChangedEventArgs e) 
        { 
            if (e.Property == StorageRackElement.RowsProperty) 
            { 
                var rows = (int)e.NewValue; 
                int rowHeight = (int)this.Size.Height / rows; 
                layout.Children.Clear(); 
                for (int i = 0; i < rows; i++) 
                { 
                    var child = new RadLabelElement(); 
                    child.Text = (i + 1).ToString(); 
                    child.Margin = new System.Windows.Forms.Padding(1); 
                    child.Children[2].AutoSize = false
                    child.Children[2].Size = new Size(20, rowHeight); 
                    child.BorderVisible = true
                    layout.Children.Add(child); 
                } 
            } 
            if (e.Property == StorageRackElement.BoundsProperty) 
            { 
                int rowHeight = (int)this.Size.Height / this.Rows; 
                foreach(var child in layout.Children) 
                    child.Children[2].Size = new Size(20, rowHeight); 
            } 
 
            base.OnPropertyChanged(e); 
        } 
    } 
 
Dobry Zranchev
Telerik team
 answered on 11 Feb 2010
0 answers
184 views
i created a radribbonform as a main form for my application. then i added 2 radform as mdichild of the main. i load the windowstate of the 2 mdichild to maximize. While 2 mdichild is open, i used a button to toggle between the 2. problem is, the windowstate of the child revert back to normal state.  i want the radform to show in maximize state. how can i fixed this? anyone?

Thanks,
jeff torririt
Top achievements
Rank 1
 asked on 11 Feb 2010
3 answers
207 views
i have  radgridview with a datasource of type bindingsource that is linking to a linq2sql class.

when i insert a new record i want call a method to refresh the grid.
Im inserting from a detail view, not from the grid.

 have tried with  refrsh method in the bindingsourc, and with an update in the grid but nothing happens.
Martin Vasilev
Telerik team
 answered on 10 Feb 2010
5 answers
282 views

Hi
I have an unbound radgridview and I am deleteing the row with an ID value of 0 the code runs but the row is still visible in the grid and when the radgridview is selected I get an error:

 

System.Data.RowNotInTableException was unhandled

  Message="This row has been removed from a table and does not have any data.  BeginEdit() will allow creation of new data in this row."

  Source="System.Data"

 

 

For x As Integer = 0 To Me. radgridview1.Rows.Count - 1

                    If (Me. radgridview1.Rows(x).Cells("ID").Value) = 0 Then

                        Me.Packagelist.Rows.RemoveAt(x)                       

                        Exit For

                    End If

                Next

How do I remove the row from the grid and avoid the error?
Regards
Joe

Nikolay
Telerik team
 answered on 10 Feb 2010
12 answers
291 views
I have 2009Q3  installed with VS 2008.
I installed VS 2010 Beta 2

The Win Rad Win Controls tab does not show up ( I added the tab and controls)
The Open Access menu is presents
The Telerik Report menu is not present

If I add a Radtextbox and run I get the following error:
Error 8 Type 'Telerik.WinControls.UI.RadTextBox' is not defined. 

Is there a previous message or paper that explains how to user Telerik products with VS 2010?
Nick
Telerik team
 answered on 10 Feb 2010
1 answer
185 views
Any chance of seeing a fully completed version of the Sapphire theme in the next release ? or at least even just more complete than the current xml's supplied by the current version ?
Nikolay
Telerik team
 answered on 09 Feb 2010
3 answers
143 views

Hello,

I have a RadGridView, I need to add two controls is a single cell (i.e. Combobox and image button ).

Looking forward for your cooperation ASAP. 

Thanks
Ajay Yadav

Nikolay
Telerik team
 answered on 09 Feb 2010
1 answer
189 views
Dear Friends,

I am dealing tedious situation as i have to hide maximize box on the title bar of radform when it sets to false.

is it possible..? i have to make the form to be with only minimize and close boxes in title bar.

please help me with a means to do that..

Thanks,
Regards,
Hari Atluri
Hari Atluri Atluri
Top achievements
Rank 1
 answered on 09 Feb 2010
3 answers
177 views
I'm not exactly sure which control to use, but I want to be able to display a long list of items with X items viewable simultaneously.

In other words, I want to show let's say 5 items out of 100, and allow the user to scroll left or right through these items to find the one they want.

I'm not sure if I need to use the RadRotator or the RadCarousel.

For an example (web based, but I need WinForms), check out the "Customers Who Bought This Item Also Bought" section of any Amazon.com product page.

Thanks.
Nikolay
Telerik team
 answered on 09 Feb 2010
3 answers
130 views
Hello everybody,
hello telerik - Team,

in our project using RadControls for WinForms Q3 2009 SP2 we get an OverflowException when pressing ^ / ° (on german keyboards left of Key 1) no matter where we are.
The same happens in your demo project. Pls. see attached screenshot.

Greetings,
Daniel
Nikolay
Telerik team
 answered on 09 Feb 2010
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
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
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
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?