Telerik Forums
UI for WinForms Forum
3 answers
119 views
Hello again !, it's posible to set multiple panes on the chart ?? Thx !
Nadya | Tech Support Engineer
Telerik team
 answered on 12 Jan 2021
6 answers
119 views

I have successfully located it, but I cannot change the "Agenda View" text. All other items are shown in Spanish.

 

How could I change that text?

 

 

    Inherits SchedulerNavigatorLocalizationProvider
    Public Overrides Function GetLocalizedString(ByVal id As String) As String
        Select Case id
            Case SchedulerNavigatorStringId.DayViewButtonCaption
                Return "Día"
            Case SchedulerNavigatorStringId.WeekViewButtonCaption
                Return "Semana"
            Case SchedulerNavigatorStringId.MonthViewButtonCaption
                Return "Mes"
            Case SchedulerNavigatorStringId.TimelineViewButtonCaption
                Return "Línea tiempo"
            Case SchedulerNavigatorStringId.AgendaViewButtonCaption
                Return "Agenda"
            Case SchedulerNavigatorStringId.ShowWeekendCheckboxCaption
                Return "Fin de semana"
            Case SchedulerNavigatorStringId.TodayButtonCaptionToday
                Return "Hoy"
            Case SchedulerNavigatorStringId.TodayButtonCaptionThisWeek
                Return "Esta semana"
            Case SchedulerNavigatorStringId.TodayButtonCaptionThisMonth
                Return "Este mes"
            Case SchedulerNavigatorStringId.SearchInAppointments
                Return "Buscar en citas"
            Case SchedulerNavigatorStringId.AgendaViewButtonCaption
                Return "Vista Agenda"
        End Select
        Return String.Empty
    End Function

 

Best Regards

Jaime

Nadya | Tech Support Engineer
Telerik team
 answered on 12 Jan 2021
2 answers
868 views
I have used both Telerik and Devexpress in projects in the past and while Telerik is good, it seems to lack some spit and polish.  I am looking for someone who has the skill to disabuse me of the notions that I will be raising in this post.  I WANT someone to prove me wrong so that I can feel good about switching to Telerik.

1.  Created a Ribbon Form using the latest Telerik controls as of today, when I installed it.  Went to create an application button menu item / description.  Much to my surprise I found that something as simple as wrapping the description text was left up to me.  In order to properly wrap this text, I am forced to create a compiler extension or library function (depending on your school of thought) that will take the output from the resource file and insert vbnewline entities after a certain number of letters.  This might work ok for English but when I release the software in another language, this wrapping function will likely have to be internationalized so that it will properly wrap something other than english.  I simply find it hard to believe that a product that certainly competes in many ways with DevExpress cannot handle this.  (I have gripes with the ribbon control from devexpress too, its lack of support for anything bigger than a 32 x 32 png icon is maddening).

2.  The ORM designer does not tag the the classes it generates with <datamember> or <datacontract> attributes and the documentation for this leaves much to be desired.  If you go with a code first approach it seems that there is a large amount of code that you need to write on your own to handle the data context duties.  The code first approach from devexpress seems to be more poco and I can decorate those classes with attributes that will end up feeding the database engine things like field length (for nvarchar) and so on.  Specifically there are additional classes that you need to hand code that the devexpress orm model seems to handle for you in that framework.

It is true that I did not attempt to take these generated classes and run them over the service boundary, but given the testing I have done in the past, WCF services pretty much will not serialize unless you have these attributes on your classes.

Now, if someone can disabuse me of these two notions I am all ears.  I am submitting this to the community as a challenge, especially someone who loves Telerik.  I do not dislike Telerik, but I reviewed it a number of years ago and found it lacking at that time (around 2008), and recently I won a copy of it at a .NET user meeting, so I tried it again, and found the issues above, again, causing me surprise that the product actually had these kinds of limitations being as mature as it is.

No product is perfect, I understand that, but the first issue seems to me to be easily implemented from a control perspective and the fact that it is not, leads me to wonder... what else will I run into if I adopt this product?

The ORM issue again, while not simple, it seems to me that it could be automated and that I could inherit a class that implements the needed capability in my poco class and it would have the data context methods already available to me, not as simple as the first issue I raised, but still seems to be a fairly straightforward OO design issue.  (just talk with JP at www.developwithpassion.com) and he'll tell you its a simple OO problem and probably code you the answer in about 60 minutes.

Anyhow, these are my thoughts after a day of review of this product.  If someone can disabuse me of these notions and provide fixes that will work under all the scenarios I have outlined, I would love to hear it.

Cheers,
B
Jay
Top achievements
Rank 1
Iron
Iron
 answered on 12 Jan 2021
1 answer
136 views

Hi,

I have written the below code on VS 2017 form button click suddenly the form is getting shrink. Please help me to solve this issue

using Telerik.Windows.Documents.Flow.Model;

Telerik.Windows.Documents.Flow.Model.RadFlowDocument document = new Telerik.Windows.Documents.Flow.Model.RadFlowDocument();
            Telerik.Windows.Documents.Flow.Model.Editing.RadFlowDocumentEditor editor = new Telerik.Windows.Documents.Flow.Model.Editing.RadFlowDocumentEditor(document);
            editor.InsertText("Hello world!");


            using (Stream output = new FileStream(@"c:\logs\output.docx", FileMode.OpenOrCreate))
            {
                Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
                provider.Export(document, output);
            }

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 12 Jan 2021
2 answers
147 views
How do you enable the Close Button only for certain tabs?
n/a
Top achievements
Rank 1
Veteran
 answered on 12 Jan 2021
3 answers
140 views

Hi, I was wondering how I could specify my own images (from my project resource file) for the buttons in a vertical track bar. Is this possible? if so how?

I probably need to do this at run-time due as the user is able to change themes which I suspect will cause things to go wrong.

 

Regards

Toby

 

Nadya | Tech Support Engineer
Telerik team
 answered on 08 Jan 2021
4 answers
156 views

I have a grid bound to a collection of objects and i want to have a custom editor for a column. I followed most of the example here:

https://docs.telerik.com/devtools/winforms/controls/gridview/cells/creating-custom-cells

I want to have 2 editors in this cell, one for manual entry and one with a dropdown of values. I have it mostly working, the editors show up during edit mode, the value on the underlying object is correct, but it doesn't show up in the grid for that column. The column is blank. Here is the code.

 

Imports System.ComponentModel
Imports Telerik.WinControls
Imports Telerik.WinControls.UI
 
Public Class test1
    Inherits System.Windows.Forms.Form
 
    'moved designer here for forum post
#Region " Designer "
    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub
 
    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer
 
    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer. 
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()>
    Private Sub InitializeComponent()
        Dim GridViewTextBoxColumn1 As Telerik.WinControls.UI.GridViewTextBoxColumn = New Telerik.WinControls.UI.GridViewTextBoxColumn()
        Dim GridViewDecimalColumn1 As Telerik.WinControls.UI.GridViewDecimalColumn = New Telerik.WinControls.UI.GridViewDecimalColumn()
        Dim GridViewDecimalColumn2 As Telerik.WinControls.UI.GridViewDecimalColumn = New Telerik.WinControls.UI.GridViewDecimalColumn()
        Dim GridViewDecimalColumn3 As DropdownandSpinEditorColumn = New DropdownandSpinEditorColumn()
        Dim TableViewDefinition1 As Telerik.WinControls.UI.TableViewDefinition = New Telerik.WinControls.UI.TableViewDefinition()
        Me.RadGridView1 = New Telerik.WinControls.UI.RadGridView()
        CType(Me.RadGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.RadGridView1.MasterTemplate, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'RadGridView1
        '
        Me.RadGridView1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.RadGridView1.Location = New System.Drawing.Point(0, 0)
        '
        '
        '
        GridViewTextBoxColumn1.FieldName = "Id"
        GridViewTextBoxColumn1.HeaderText = "Id"
        GridViewTextBoxColumn1.Name = "Id"
        GridViewTextBoxColumn1.Width = 150
        GridViewDecimalColumn1.DecimalPlaces = 0
        GridViewDecimalColumn1.FieldName = "SpecialNumber1"
        GridViewDecimalColumn1.HeaderText = "Special 1"
        GridViewDecimalColumn1.Name = "SpecialNumber1"
        GridViewDecimalColumn1.Width = 150
        GridViewDecimalColumn2.DecimalPlaces = 0
        GridViewDecimalColumn2.FieldName = "SpecialNumber2"
        GridViewDecimalColumn2.HeaderText = "Special 2"
        GridViewDecimalColumn2.Name = "SpecialNumber2"
        GridViewDecimalColumn2.Width = 150
        GridViewDecimalColumn3.DecimalPlaces = 0
        GridViewDecimalColumn3.FieldName = "ActionNumber"
        GridViewDecimalColumn3.HeaderText = "Action Number"
        GridViewDecimalColumn3.Name = "ActionNumber"
        GridViewDecimalColumn3.Width = 200
        Me.RadGridView1.MasterTemplate.Columns.AddRange(New Telerik.WinControls.UI.GridViewDataColumn() {GridViewTextBoxColumn1, GridViewDecimalColumn1, GridViewDecimalColumn2, GridViewDecimalColumn3})
        Me.RadGridView1.MasterTemplate.ViewDefinition = TableViewDefinition1
        Me.RadGridView1.Name = "RadGridView1"
        Me.RadGridView1.Size = New System.Drawing.Size(800, 450)
        Me.RadGridView1.TabIndex = 0
        '
        'test1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(800, 450)
        Me.Controls.Add(Me.RadGridView1)
        Me.Name = "test1"
        Me.Text = "test1"
        CType(Me.RadGridView1.MasterTemplate, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.RadGridView1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
 
    End Sub
 
    Friend WithEvents RadGridView1 As Telerik.WinControls.UI.RadGridView
#End Region
 
    Private _list As New BindingList(Of GenData)
 
    Private Sub test1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim r As New Random(Now.Millisecond)
        For i = 100 To 110
            _list.Add(New GenData(r) With {.ActionNumber = i})
        Next
        Me.RadGridView1.DataSource = _list
    End Sub
 
    Private Sub RadGridView1_CreateCell(sender As Object, e As GridViewCreateCellEventArgs) Handles RadGridView1.CreateCell
        If TypeOf e.Row.RowInfo Is GridViewDataRowInfo Then
            Select Case e.Column.Name.ToLower()
                Case "actionnumber"
                    e.CellElement = New DropdownandSpinEditorCellElement(e.Column, e.Row)
                    e.CellType = GetType(DropdownandSpinEditorCellElement)
 
            End Select
        End If
    End Sub
 
    Private Sub RadGridView1_CellEndEdit(sender As Object, e As GridViewCellEventArgs) Handles RadGridView1.CellEndEdit
        If TypeOf e.Row Is GridViewDataRowInfo Then
            Dim elementsToRemove As New List(Of RadElement)
            Dim d = e.Row.DataBoundItem
            Console.WriteLine("end edit - " + d.ToString())
            Select Case e.Column.Name.ToLower()
                Case "actionnumber"
                    For Each c In RadGridView1.CurrentCell.Children
                        If TypeOf c Is RadDropDownListElement Then
                            elementsToRemove.Add(c)
                        End If
                    Next
                    For Each i In elementsToRemove
                        RadGridView1.CurrentCell.Children.Remove(i)
                        Console.WriteLine("end edit : removed dropdown")
                    Next
            End Select
        End If
    End Sub
 
    Private Sub RadGridView1_CellBeginEdit(sender As Object, e As GridViewCellCancelEventArgs) Handles RadGridView1.CellBeginEdit
        If TypeOf e.Row Is GridViewDataRowInfo Then
            Dim d = e.Row.DataBoundItem
            Console.WriteLine("begin edit - " + d.ToString())
            Select Case e.Column.Name.ToLower()
                Case "actionnumber"
                    CType(RadGridView1.CurrentCell, DropdownandSpinEditorCellElement).DrawEditor(d)
            End Select
        End If
    End Sub
End Class
 
Public Class GenData
    Private _rand As Random
 
    Public Sub New()
        _rand = New Random(Date.Now.Millisecond)
        SetSpecials()
    End Sub
    Public Sub New(rand As Random)
        _rand = rand
        SetSpecials()
    End Sub
    Public Sub SetSpecials()
        SpecialNumber1 = _rand.Next()
        SpecialNumber2 = _rand.Next()
    End Sub
    Public Overrides Function ToString() As String
        Return NameOf(Id) + " - " + Id + ", " + NameOf(ActionNumber) + " - " + ActionNumber.ToString()
    End Function
    Public Property Id As String = Guid.NewGuid.ToString
    Public Property SpecialNumber1 As Integer = -1
    Public Property SpecialNumber2 As Integer = -1
    Public Property ActionNumber As Integer = -1
End Class
 
Public Class DropdownandSpinEditorCellElement
    Inherits GridDataCellElement
 
    Private _radDropDownElement As RadDropDownListElement
 
    Public Sub New(ByVal column As GridViewColumn, ByVal row As GridRowElement)
        MyBase.New(column, row)
    End Sub
 
    Public Sub DrawEditor(d As GenData)
        _radDropDownElement = BuildDropdown(d)
        Me.Children.Add(_radDropDownElement)
        AddHandler _radDropDownElement.SelectedIndexChanged, AddressOf HandleSelectChanged
    End Sub
 
    Protected Overrides Sub CreateChildElements()
        MyBase.CreateChildElements()
    End Sub
 
    Protected Overrides ReadOnly Property ThemeEffectiveType() As Type
        Get
            Return GetType(GridDataCellElement)
        End Get
    End Property
    Public Overrides Function IsCompatible(ByVal data As GridViewColumn, ByVal context As Object) As Boolean
        Return TypeOf data Is GridViewDecimalColumn AndAlso TypeOf context Is GridDataRowElement
    End Function
 
    Protected Overrides Function ArrangeOverride(ByVal finalSize As SizeF) As SizeF
        Console.WriteLine("children count was : " + Me.Children.Count.ToString)
        If Me.Children.Count = 2 Then
            Dim dropDownWidth As Single = finalSize.Width * 0.5
            Dim dropDownRect As New RectangleF(0, 0, dropDownWidth - 1, finalSize.Height)
            Dim spinEditorRect As New RectangleF(dropDownWidth + 1, 0, finalSize.Width - dropDownWidth - 2, finalSize.Height)
            Me.Children(0).MinSize = New Size(dropDownWidth - 2, 20)
            Me.Children(0).Arrange(dropDownRect)
            Me.Children(1).Arrange(spinEditorRect)
        End If
        Return finalSize
    End Function
 
    Private Function BuildDropdown(ByRef d As GenData) As RadDropDownListElement
        Dim speedDropdown As New RadDropDownListElement()
        speedDropdown.MinSize = New Size(40, 20)
        speedDropdown.MaxSize = speedDropdown.MinSize
        speedDropdown.DropDownWidth = 150
        speedDropdown.DropDownHeight = 130
        speedDropdown.Padding = New Padding(2, 2, 2, 2)
        speedDropdown.Tag = d
        speedDropdown.DataSource = BuildSpecialList(d)
        speedDropdown.DisplayMember = "DisplayValue"
        speedDropdown.ValueMember = "Value"
        speedDropdown.SelectedIndex = 0
        Return speedDropdown
    End Function
 
    Private Sub HandleSelectChanged(sender As Object, e As Data.PositionChangedEventArgs)
        Dim speedDropdown As RadDropDownListElement = CType(sender, RadDropDownListElement)
        Dim d As GenData = speedDropdown.Tag
        Dim data As GenericItem(Of Double) = speedDropdown.SelectedItem.DataBoundItem
        d.ActionNumber = data.Value
    End Sub
 
    Private Function BuildSpecialList(d As GenData) As List(Of GenericItem(Of Double))
        Dim l As New List(Of GenericItem(Of Double))
        Dim g As New GenericItem(Of Double)
        g.DisplayValue = ""
        g.Value = -1
        l.Add(g)
        g = New GenericItem(Of Double)
        g.DisplayValue = d.SpecialNumber1.ToString
        g.Value = d.SpecialNumber1
        l.Add(g)
        g = New GenericItem(Of Double)
        g.DisplayValue = d.SpecialNumber2.ToString
        g.Value = d.SpecialNumber2
        l.Add(g)
        Return l
    End Function
End Class
 
Public Class DropdownandSpinEditorColumn
    Inherits GridViewDecimalColumn
    Public Sub New(ByVal fieldName As String)
        MyBase.New(fieldName)
    End Sub
    Public Sub New()
        MyBase.New()
    End Sub
    Public Overrides Function GetCellType(ByVal row As GridViewRowInfo) As Type
        If TypeOf row Is GridViewDataRowInfo Then
            Return GetType(DropdownandSpinEditorCellElement)
        End If
        Return MyBase.GetCellType(row)
    End Function
End Class
 
Public Class GenericItem(Of ValueType)
    Public Property DisplayValue As String = ""
    Public Property Value As ValueType
    Public Property Data As Object = Nothing
End Class
dd
Top achievements
Rank 1
 answered on 07 Jan 2021
3 answers
356 views

How to add a context menu by pressing a RadButton?

ContextMenuStrip mainMenu = new ContextMenuStrip();
RadButtonElement btn = new RadButtonElement();
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 07 Jan 2021
1 answer
152 views

Hello,

I have a GridView with GroupComparer and it works fine, but if I add EnableCustomSorting true, the GroupComparer stops working, it's not called by GridView anymore. Could you please advise how to make it work together.

 

public Form1()
{
  InitializeComponent();
 
  DataTable dt = new DataTable();
  dt.Columns.Add( "A", typeof( string ) );
 
  this.radGridView1.Columns.Add( "A" );
  this.radGridView1.Columns.Add( "B" );
 
  this.radGridView1.Rows.Add( "1", "1");
  this.radGridView1.Rows.Add( "2", "2" );
  this.radGridView1.Rows.Add( "10", "10" );
 
  this.radGridView1.MasterTemplate.GroupComparer = new GroupComparer();
 
  this.radGridView1.CustomSorting += RadGridView1_CustomSorting;
  this.radGridView1.EnableCustomSorting = true; //if true, GroupComparer stop working
}
 
private void RadGridView1_CustomSorting( object sender, GridViewCustomSortingEventArgs e )
{
  //logic to sort columns.
}
 
public class GroupComparer : IComparer<Group<GridViewRowInfo>>
{
  public int Compare( Group<GridViewRowInfo> x, Group<GridViewRowInfo> y )
  {
    int parsedX;
    int parsedY;
    if ( int.TryParse( ( (object[])x.Key ).First().ToString(), out parsedX ) &&
        int.TryParse( ( (object[])y.Key ).First().ToString(), out parsedY ) )
    {
      int result = parsedX.CompareTo( parsedY );
      DataGroup xGroup = x as DataGroup;
      if ( xGroup != null && ( (DataGroup)x ).GroupDescriptor.GroupNames.First().Direction == ListSortDirection.Descending )
      {
        result *= -1;
      }
      return result;
    }
    return ( (object[])x.Key )[0].ToString().CompareTo( ( (object[])y.Key )[0].ToString() );
  }
}
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 07 Jan 2021
1 answer
85 views

As title. Followed as my code and screen shot as attachment.

public partial class Form3 : Form
{
    public Form3()
    {
        this.InitializeComponent();
 
        this.label1.Text = this.radHScrollBar1.Minimum.ToString();
        this.label2.Text = this.radHScrollBar1.Maximum.ToString();
    }
 
    private void button1_Click(object sender, System.EventArgs e)
    {
        this.textBox1.Text = this.radHScrollBar1.Value.ToString();
    }
}
Nadya | Tech Support Engineer
Telerik team
 answered on 06 Jan 2021
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?