Telerik Forums
UI for WinForms Forum
1 answer
162 views
I want to change position MessageElement when I want to do it. When I load old message, I only load about 30 message element, then when I scroll to last message I will load 30 next message.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 05 Aug 2019
1 answer
317 views

Hi,

I am trying to customize the appearance of the list view item and I followed the Shopping Cart List View example at the below location -

https://docs.telerik.com/devtools/winforms/knowledge-base/shopping-cart-lsitview-custom-item

The list view item is divided into two StackLayout elements and each element has further UI elements and buttons. The entire item is divided into 2 halves. I need to define the width of the each StackLayout element such that the element on the left occupies around 70% of the item width and the one on the right to have a 30% width.

Attached is an image for reference which shows the item is split into 2 halves. 

A sample code or pointers would be great.

Below is the code for the visual item as well.

 

using System;
using System.Drawing;
using System.Windows.Forms;
using Telerik.WinControls.UI;
using WFAInterplayPOS.Model.DataModel.Cart;
using WFAInterplayPOS.Service;
 
namespace WFAInterplayPOS.UserIterface.Restaurant
{
    public class ActiveCartVisualItem : SimpleListViewVisualItem
    {
        // Add button.
        private RadButtonElement AddButtonElement;
        // Remove button.
        private RadButtonElement RemoveButtonElement;
        // Details layout
        private StackLayoutElement DetailsStackLayout;
        // Buttons layout.
        private StackLayoutElement ButtonsStackLayout;
        // Title.
        private LightVisualElement TitleElement;
        // Viewitem layout.
        private StackLayoutElement ViewItemLayout;
        // Amount label.
        private RadLabelElement AmountLabelElement;
 
        /*
         * Overridden CreateChildElements()
         *
         * */
        protected override void CreateChildElements()
        {
            // base.CreateChildElements();
            base.CreateChildElements();
 
            // Viewitem layout.
            ViewItemLayout = new StackLayoutElement
            {
                Orientation = Orientation.Horizontal,
                ShouldHandleMouseInput = false,
                NotifyParentOnMouseInput = true,
                StretchHorizontally = true
            };
 
            // Build details layout.
            BuildDetailsLayout();
 
            // Build buttons layout.
            BuildButtonsLayout();
 
            // Add the visual elements.
            ViewItemLayout.Children.Add(DetailsStackLayout);
            ViewItemLayout.Children.Add(ButtonsStackLayout);
            Children.Add(ViewItemLayout);
        }
 
        /*
         * BuildDetailsLayout()
         *
         * */
        private void BuildDetailsLayout()
        {
            // Details layout.
            DetailsStackLayout = new StackLayoutElement
            {
                Orientation = Orientation.Vertical,
                ShouldHandleMouseInput = false,
                NotifyParentOnMouseInput = true,
                StretchHorizontally = true,
                Margin = new Padding(3, 3, 3, 3)
            };
 
            // Title element.
            TitleElement = new LightVisualElement
            {
                TextAlignment = ContentAlignment.MiddleLeft,
                StretchHorizontally = true,
                ShouldHandleMouseInput = false,
                NotifyParentOnMouseInput = true
            };
            DetailsStackLayout.Children.Add(TitleElement);
 
            // Amount label.
            AmountLabelElement = new RadLabelElement
            {
                Margin = new Padding(0, 3, 0, 3),
                TextAlignment = ContentAlignment.MiddleLeft
            };
            DetailsStackLayout.Children.Add(AmountLabelElement);
        }
 
        /*
         * BuildButtonsLayout()
         *
         * */
        private void BuildButtonsLayout()
        {
            // Buttons layout.
            ButtonsStackLayout = new StackLayoutElement
            {
                Orientation = Orientation.Horizontal,
                ShouldHandleMouseInput = false,
                NotifyParentOnMouseInput = true,
                StretchHorizontally = true,
                StretchVertically = true
            };
 
            // Remove button.
            RemoveButtonElement = new RadButtonElement
            {
                Margin = new Padding(3, 6, 0, 6),
                Text = "<html><size=13><b>-</b>",
                StretchVertically = true,
            };
            RemoveButtonElement.Click += RemoveButtonElement_Click;
            ButtonsStackLayout.Children.Add(RemoveButtonElement);
 
            // Add button.
            AddButtonElement = new RadButtonElement
            {
                Margin = new Padding(0, 6, 3, 6),
                Text = "<html><size=13><b>+</b>",
                StretchVertically = true,
            };
            AddButtonElement.Click += AddButtonElement_Click;
            ButtonsStackLayout.Children.Add(AddButtonElement);
        }
 
        /*
         * AddButtonElement_Click()
         *
         * */
        private void AddButtonElement_Click(object sender, EventArgs e)
        {
             
        }
 
        /*
         * RemoveButtonElement_Click()
         *
         * */
        private void RemoveButtonElement_Click(object sender, EventArgs e)
        {
             
        }
 
        protected override void SynchronizeProperties()
        {
            // base.SynchronizeProperties()
            base.SynchronizeProperties();
 
            // Other attributes.
            Text = "";
            var data = Data.DataBoundItem as LineItem;
            TitleElement.Text = "<html><size=10>" + data.quantity + " x " + data.name;
            AmountLabelElement.Text = "<html><size=10><color=red>" + data.subTotal.amount.ToString("C");
        }
 
        protected override Type ThemeEffectiveType
        {
            get
            {
                return typeof(SimpleListViewVisualItem);
            }
        }
    }
}

 

Thanks.

Nadya | Tech Support Engineer
Telerik team
 answered on 02 Aug 2019
1 answer
568 views

Hi All, 

I have added a custom column or cell containing DrodownList -its appearing correctly in view mode. 

Now I have below points :

1. On which event of the GridView I can bind the dropdownList. 

2. When I select any value (Currently have added some static value in the DropdownList). Once I scroll the grid , the state changes to original state. 

3. Some time I noticed that the value i selected for let say row one, the same value is being selected for the the row which is not displayed. after scrolling we can see the same. and the value of 1st row got removed. 

4. My requirement is -

  1.     I need to give a data source to the Drodownlist. 
  2.  Need to get a value selected on some condition 
  3. If I scroll the value should not change. 

Attaching my code of custom cell 

class CustomDropCell : GridDataCellElement
   {
       private string conString { get; set; }
       public CustomDropCell(GridViewColumn column, GridRowElement row): base(column, row)
       {
           //conString = con;
       }
       
       private StackLayoutPanel panel;
       private RadDropDownListElement radDropDownList;
 
 
       protected override void CreateChildElements()
       {
           base.CreateChildElements();
 
           this.panel = new StackLayoutPanel();
           this.panel.Margin = new System.Windows.Forms.Padding(5);
           this.panel.Orientation = System.Windows.Forms.Orientation.Vertical;
 
 
           this.radDropDownList = new RadDropDownListElement
           {
               DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList
           };
           this.radDropDownList.Items.Add("Santosh");
           this.radDropDownList.Items.Add("Jha");
            this.radDropDownList.Items.Add("Mr");
           this.radDropDownList.Items.Add("Kumar");
           this.Children.Add(radDropDownList);
       }
 
       protected override void SetContentCore(object value)
       {
           
           GridViewGroupRowInfo row = this.RowInfo as GridViewGroupRowInfo;
 
           object cellValue = value;
 
           if (cellValue is DBNull || cellValue == null)
               cellValue = "Mr";
           this.radDropDownList.SelectedValue = cellValue;
 
       }
       protected override Type ThemeEffectiveType
       {
           get
           {
               return typeof(GridDataCellElement);
           }
       }
 
       public override bool IsCompatible(GridViewColumn data, object context)
       {
           return base.IsCompatible(data, context);
           // return data is CustomDropCellColumn && context is GridDataRowElement;
       }
   }
 
 
   public class CustomDropCellColumn : GridViewDataColumn
   {
       //private string conString { get; set; }
       public CustomDropCellColumn(string fieldName) : base(fieldName)
       {
           //conString = connectionString;
       }
 
       public override Type GetCellType(GridViewRowInfo row)
       {
           if (row is GridViewDataRowInfo)
           {
               return typeof(CustomDropCell);
           }
           return base.GetCellType(row);
       }
   }

 

Adding the column in Grid in Form Constructor.

CustomDropCellColumn customColumn = new CustomDropCellColumn("Destination Table");
           customColumn.MaxWidth = 170;
           this.radGridViewTable.Columns.Add(customColumn);
           this.radGridViewTable.Columns["Destination Table"].MinWidth = 165;
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 02 Aug 2019
3 answers
229 views

I need to use dropdownlist as RadGridView editor 

and I have look into this 

https://docs.telerik.com/devtools/winforms/controls/dropdown-listcontrol-and-checkeddropdownlist/checkeddropdownlist/how-to/use-as-radgridview-editor

In the sample above,it bound a datasource to the dropdownlist editor,but only handle the display text and control value by overiding the "Value" property.

If I want to bind a datasource with valuemember and displaymember,how to handle them properly?What I expect is to let user choose with the displaymember and valuemember can be saved according to what user choose just like the normal checkeddropdownlist control.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 02 Aug 2019
3 answers
167 views
How to customize appearance of the GridViewRatingColumn in radgidview 
Nadya | Tech Support Engineer
Telerik team
 answered on 01 Aug 2019
1 answer
162 views

Hi,

I have a TableLayoutPanel that is divided to 3 rows. Each row contains a RadPanel.

Only the middle one is causing transparency issue because it's not filled with controls.

how can I get rid of this issue?

Thanks,

Karoon

Nadya | Tech Support Engineer
Telerik team
 answered on 01 Aug 2019
3 answers
723 views

Hi all, 

I just encountered the most bizarre thing today while using the Rich Text Editor. I upgraded our Telerik DLLs to the most recent one available (2019 R2, 2019.2.618) and it seems like the ability to paste into the Rich Text Editor has been lost all of a sudden. I tried all I could and looked around the forums a bit to no avail. The interesting thing is that when I debug, I can "hit" the CommandExecuting event and I can see that in the code it recognizes that it is a paste command, but the text is not being pasted onto the textbox. 

 private void RadRichTextEditor1_CommandExecuting(object sender, Telerik.WinForms.Documents.RichTextBoxCommands.CommandExecutingEventArgs e)
        {
            if (e.Command is PasteCommand)
            {
                //the event is fired and recognizes that IT IS  a PASTE COMMAND, but text is not being pasted onto the textbox
            }
        }

 

Has anyone else encountered this before. If so, can anyone point me to the right direction as to why this is happening? Thanks all.

 

Romel

Romel
Top achievements
Rank 1
 answered on 31 Jul 2019
1 answer
111 views
I am binding a Datasource to RadCheckedDropDownList. This RadCheckedDropDownList have checked items. TextBlockFormatting not working binding time (Figure 1).
After binding i checked or unchecked item TextBlockFormatting working properly(Figure 2). I need a RadCheckedDropDownList like Figure 2..
Waiting for your favourable response.


Binding code...
RadCheckedDropDownList1.DataSource = Nothing
RadCheckedDropDownList1.CheckedMember = "vaIsProductVariant"
RadCheckedDropDownList1.DisplayMember = "ProductVariantValueID"
RadCheckedDropDownList1.ValueMember = "VariantValue"
RadCheckedDropDownList1.DataSource = value


Formatting Code....
Private Sub chkVariantValue_TextBlockFormatting(sender As Object, e As TextBlockFormattingEventArgs) 

        Dim token As TokenizedTextBlockElement = TryCast(e.TextBlock, TokenizedTextBlockElement)

        If token IsNot Nothing Then
            token.GradientStyle = Telerik.WinControls.GradientStyles.Solid
            token.BackColor = ColorTranslator.FromHtml(TokenColor)
            token.BorderColor = ColorTranslator.FromHtml(TokenColor)
            token.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
            token.Shape = New RoundRectShape
        End If

End Sub
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 30 Jul 2019
4 answers
567 views

I have a RadCheckedDropDownList that I am binding a BindingList to it. Some of the items in the list will have the CheckedMember property filled in. However, after the control loads, the items that are checked do not show up in TEXT area of the control. However, if you open the dropdown, you can see items checked.  As soon as you uncheck or check an item, all the checked items do show up.  This is a problem, I need the items that are checked by default to show up in the TEXT area.  Below is my code that I use to bind my list to the control.  Am I missing something?


private static void BindList (this RadCheckedDropDownList radDropDownList, BindingList<CheckedListItem> dropDownList, string valueMember = "Key", string displayMember = "Value", string checkedMember = "Checked")  
{
radDropDownList.BeginUpdate();
radDropDownList.ValueMember = valueMember;
radDropDownList.DisplayMember = displayMember;
radDropDownList.CheckedMember = checkedMember;
radDropDownList.DataSource = dropDownList;
radDropDownList.EndUpdate();
radDropDownList.SelectedIndex = -1;
}

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 30 Jul 2019
1 answer
438 views
Hi,
Is there anyway to retrieve the ValueMember value of GridViewComboBoxColumn in the CellEndEdit ? Thanks.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 30 Jul 2019
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
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
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?