Telerik Forums
UI for WinForms Forum
7 answers
1.6K+ views
Hi there,

I am having some trouble implementing a "select all" checkbox for the RadGridView. I have successfully added checkboxes to group headers as shown in the attached screenshot. I need the ability to tick a box (which sits outside the grid) so it will select or deselect all items in the grid. 

Currently when I click on the "select all" checkbox, only four items are selected in the grid out of 131. I believe this has something to do with the control reusing cells. I have implemented the following class.

public class CustomGroupCellHeader : GridGroupContentCellElement
    {
        public event EventHandler CheckChanged;
        public RadCheckBoxElement Checkbox { get; set; }
        public GridViewColumn Column { get; set; }
        public GridRowElement Row { get; set; }
        public Guid OperatorId { get; set; }
        public string OperatorName { get; set; }
 
        public CustomGroupCellHeader(GridViewColumn column, GridRowElement row) :
            base(column, row)
        {
            this.Column = column;
            this.Row = row;
        }
 
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            this.Checkbox = new RadCheckBoxElement();
            this.Checkbox.MinSize = new Size(10, 10);
            this.Checkbox.ToggleStateChanged += new StateChangedEventHandler(_checkbox_ToggleStateChanged);
            this.Children.Insert(0, this.Checkbox);
        }
 
        protected override System.Drawing.SizeF ArrangeOverride(System.Drawing.SizeF finalSize)
        {
            SizeF size = base.ArrangeOverride(finalSize);
            RectangleF rect = GetClientRectangle(finalSize);
            if (this.Checkbox != null)
            {
                this.Checkbox.Arrange(new RectangleF(rect.X, rect.Y + 5, 10, 10));
            }
 
            return size;
        }
 
        private void _checkbox_ToggleStateChanged(object sender, StateChangedEventArgs args)
        {
            if (this.CheckChanged != null)
            {
                this.CheckChanged(this, null);
            }
        }

I have also added the following code into the CreateCell event handler:

private List<CustomGroupCellHeader> _groupCheckboxes = new List<CustomGroupCellHeader>();
private void results_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
    if (e.CellType == typeof(GridGroupContentCellElement))
    {
        CustomGroupCellHeader customCell = new CustomGroupCellHeader(e.Column, e.Row);
        customCell.CheckChanged += new EventHandler(customCell_CheckChanged);
        e.CellElement = customCell;
 
        _groupCheckboxes.Add(customCell);
    }
}

The variable _groupCheckboxes is intended to store the checkboxes for group headers. How can I ensure that this variable stores ALL checkboxes for group headers?

Thanks
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 08 Jul 2019
2 answers
72 views

Hello,

 

Maybe it's a stupid question but I cannot find it anywhere.

I have a scheduler with several appointments (normal and recurring).

How can I retrieve all appointments at a specific date and time?

 

Best regards

Patrick Vossen

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 08 Jul 2019
2 answers
133 views
I have a MDI form and trying to open the child screen.  On the MDI screen I have a RadMenu on the top.  When I load the app and pick a child fr the first time it loads correctly and is maximized, but when I open another child screen I close the current and then open the new screen and maximize the screen but it opens like the rad menu is not on the screen, so I lose the top section on the screen.  I have not has this issue before.  I am using framework 4.6.2 and I am using Telerik controls 2018 r2.  I have not had this issue before.
Dimitar
Telerik team
 answered on 08 Jul 2019
1 answer
192 views

Hi.

I have a radgridview that contains many images. i want to get the image size (width and height in "pixel") of each image. how can i do that? 

Note: i have no access to image sources (in fact, there is no any image source. all images are in binary format and has been converted to image automatically in radgridview's image columns).

thanks in advance

Dimitar
Telerik team
 answered on 08 Jul 2019
15 answers
118 views
Hi everyone,

my trial period is almost over and I really like Telerik components.
There is just one little thing that I have issues with.

Let CustomFiltering and the default Filter via FilterRow work together.
I read examples about achieving this goal under C#, but I can't figure out how to make this work under VB.

Can anyone please help me?

Thank you in advance!
Bye
Dimitar
Telerik team
 answered on 08 Jul 2019
1 answer
315 views

hi all

i want to send a question to user "are u sure to switch off?" when user click on slide the toggle switcher.

how can do this?

set the snipped code in valueChanging action, but if user click on "No", the toggle switch to off!

 

if (switchtg.Value)
                {
                    RadMessageBox.Instance.StartPosition = FormStartPosition.CenterParent;
                    if (RadMessageBox.Show("Are u sure ?", "disconnecting...", MessageBoxButtons.YesNo,
                            RadMessageIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        //_allowdc = true;
                        switchtg.Value = true;
                        //switchtg.ValueChanged -= switchtg_ValueChanged;
                    }
                    else
                    {
                       // _allowdc = false;
                        switchtg.Value = false;
                        //switchtg.ValueChanged -= switchtg_ValueChanged;
 
                    }
 
                }
Mehdi
Top achievements
Rank 1
 answered on 07 Jul 2019
3 answers
89 views

Hey guys, I'm trying to do drag&drop functionality on RadListView, I'm currently using this example and it's works just fine, the only problem is when I'm using custom visual Item on RadListView, there is a little portion of the item where the mouse capture drag&drop, how can make it work for all inside child of my custom visual item? 

    class CartaoCustomVisualListView : SimpleListViewVisualItem
    {
        LightVisualElement tituloElement;
        LightVisualElement dataInicioElement;
        LightVisualElement dataEntregaElement;
        LightVisualElement nomeBancoQueFezASolicitacao;
        LightVisualElement progressoCartaoElement;
        LightVisualElement totalChecklistElement;
        LightVisualElement totalAnexosElement;
        LightVisualElement totalComentariosElement;
        StackLayoutPanel stackLayout;
 
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            stackLayout = new StackLayoutPanel();
            stackLayout.Orientation = System.Windows.Forms.Orientation.Vertical;
 
            tituloElement = new LightVisualElement();
            tituloElement.Click += (e, f) => this.DoClick(f);
            tituloElement.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
            tituloElement.TextWrap = true;
            tituloElement.Margin = new System.Windows.Forms.Padding(10, 2, 2, 2);
            tituloElement.Font = new System.Drawing.Font("Segoe UI", 10, System.Drawing.FontStyle.Bold, GraphicsUnit.Point);
            tituloElement.ForeColor = Color.Black;
            tituloElement.AutoSize = true;
            tituloElement.AutoSizeMode = RadAutoSizeMode.Auto;
            stackLayout.Children.Add(tituloElement);
 
            dataInicioElement = new LightVisualElement();
            dataInicioElement.Click += (e, f) => this.DoClick(f);
            dataInicioElement.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
            dataInicioElement.Margin = new System.Windows.Forms.Padding(10, 2, 0, 2);
            dataInicioElement.Font = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Regular, GraphicsUnit.Point);
            dataInicioElement.ForeColor = Color.Black;
            dataInicioElement.AutoSize = true;
            dataInicioElement.AutoSizeMode = RadAutoSizeMode.Auto;
            stackLayout.Children.Add(dataInicioElement);
 
            dataEntregaElement = new LightVisualElement();
            dataEntregaElement.Click += (e, f) => this.DoClick(f);
            dataEntregaElement.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
            dataEntregaElement.Margin = new System.Windows.Forms.Padding(10, 2, 0, 2);
            dataEntregaElement.Font = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Regular, GraphicsUnit.Point);
            dataEntregaElement.ForeColor = Color.Black;
            dataEntregaElement.AutoSize = true;
            dataEntregaElement.AutoSizeMode = RadAutoSizeMode.Auto;
            stackLayout.Children.Add(dataEntregaElement);
 
            nomeBancoQueFezASolicitacao = new LightVisualElement();
            nomeBancoQueFezASolicitacao.Click += (e, f) => this.DoClick(f);
            nomeBancoQueFezASolicitacao.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
            nomeBancoQueFezASolicitacao.Margin = new System.Windows.Forms.Padding(10, 2, 0, 2);
            nomeBancoQueFezASolicitacao.Font = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Regular, GraphicsUnit.Point);
            nomeBancoQueFezASolicitacao.ForeColor = Color.Black;
            nomeBancoQueFezASolicitacao.AutoSize = true;
            nomeBancoQueFezASolicitacao.AutoSizeMode = RadAutoSizeMode.Auto;
            stackLayout.Children.Add(nomeBancoQueFezASolicitacao);
 
            progressoCartaoElement = new LightVisualElement();
            progressoCartaoElement.Click += (e, f) => this.DoClick(f);
            progressoCartaoElement.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
            progressoCartaoElement.Margin = new System.Windows.Forms.Padding(10, 2, 0, 2);
            progressoCartaoElement.Font = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Regular, GraphicsUnit.Point);
            progressoCartaoElement.ForeColor = Color.Black;
            progressoCartaoElement.AutoSize = true;
            progressoCartaoElement.AutoSizeMode = RadAutoSizeMode.Auto;
            stackLayout.Children.Add(progressoCartaoElement);
 
            totalAnexosElement = new LightVisualElement();
            totalAnexosElement.Click += (e, f) => this.DoClick(f);
            totalAnexosElement.TextAlignment = System.Drawing.ContentAlignment.MiddleRight;
            totalAnexosElement.Margin = new System.Windows.Forms.Padding(10, 1, 10, 1);
            totalAnexosElement.Font = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Bold, GraphicsUnit.Point);
            totalAnexosElement.ForeColor = SystemColors.AppWorkspace;
            totalAnexosElement.AutoSize = true;
            totalAnexosElement.AutoSizeMode = RadAutoSizeMode.Auto;
            totalAnexosElement.DrawText = true;
            stackLayout.Children.Add(totalAnexosElement);
 
            totalChecklistElement = new LightVisualElement();
            totalChecklistElement.Click += (e, f) => this.DoClick(f);
            totalChecklistElement.TextAlignment = System.Drawing.ContentAlignment.MiddleRight;
            totalChecklistElement.Margin = new System.Windows.Forms.Padding(10, 1, 10, 1);
            totalChecklistElement.Font = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Bold, GraphicsUnit.Point);
            totalChecklistElement.ForeColor = SystemColors.AppWorkspace;
            totalChecklistElement.AutoSize = true;
            totalChecklistElement.AutoSizeMode = RadAutoSizeMode.Auto;
            totalChecklistElement.DrawText = true;
            stackLayout.Children.Add(totalChecklistElement);
 
            totalComentariosElement = new LightVisualElement();
            totalComentariosElement.Click += (e, f) => this.DoClick(f);
            totalComentariosElement.TextAlignment = System.Drawing.ContentAlignment.MiddleRight;
            totalComentariosElement.Margin = new System.Windows.Forms.Padding(10, 1, 10, 1);
            totalComentariosElement.Font = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Bold, GraphicsUnit.Point);
            totalComentariosElement.ForeColor = SystemColors.AppWorkspace;
            totalComentariosElement.AutoSize = true;
            totalComentariosElement.AutoSizeMode = RadAutoSizeMode.Auto;
            totalComentariosElement.DrawText = true;
            stackLayout.Children.Add(totalComentariosElement);
 
             
            Children.Add(stackLayout);
            Shape = new RoundRectShape(5);
            this.BackColor = Color.White;
            this.Padding = new Padding(5);
        }
 
        protected override void SynchronizeProperties()
        {
            var bound = this.Data.DataBoundItem as cartao_model;
            if(bound != null)
            {
                tituloElement.Text = bound.obj_cartao.titulo;
                if (bound.obj_cartao.data_inicio != null)
                {
                    dataInicioElement.Text = "Data inicio: " + bound.obj_cartao.data_inicio.ToString();
                    dataInicioElement.Visibility = ElementVisibility.Visible;
                }
                else
                    dataInicioElement.Visibility = ElementVisibility.Collapsed;
                if (bound.obj_cartao.data_entrega != null)
                {
                    dataEntregaElement.Text = "Data entrega: " + bound.obj_cartao.data_entrega.ToString();
                    dataEntregaElement.Visibility = ElementVisibility.Visible;
                }
                else
                    dataEntregaElement.Visibility = ElementVisibility.Collapsed;
 
                if (bound.obj_cartao.id_banco_de_dados != null && bound.obj_cartao.id_banco_de_dados != 0)
                {
                    nomeBancoQueFezASolicitacao.Text = "Solicitador por: " + bound.obj_cartao.banco_de_dados.nome;
                    nomeBancoQueFezASolicitacao.Visibility = ElementVisibility.Visible;
                }
                else
                    nomeBancoQueFezASolicitacao.Visibility = ElementVisibility.Collapsed;
 
                if (bound.anexos.TemRegistro())
                {
                    totalAnexosElement.Visibility = ElementVisibility.Visible;
                    totalAnexosElement.Text = $"anexos: {bound.anexos.Count()}";
                }
                else
                    totalAnexosElement.Visibility = ElementVisibility.Collapsed;
 
                int totalConcluidos = 0, totalItens = 0;
                if (bound.obj_cartao.checklist.TemRegistro())
                {
                    totalChecklistElement.Visibility = ElementVisibility.Visible;
                    foreach(var item in bound.obj_cartao.checklist)
                    {
                        totalConcluidos = totalConcluidos + item.itens.Where(c => c.concluido == true).Count();
                        totalItens = totalItens + item.itens.Count();
                        if(totalItens == totalConcluidos)
                        {
                            totalChecklistElement.ForeColor = Color.Green;
                            totalChecklistElement.Font = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Bold, GraphicsUnit.Point);
                        }
                        else
                        {
                            totalChecklistElement.ForeColor = SystemColors.AppWorkspace;
                            totalChecklistElement.Font = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Bold, GraphicsUnit.Point);
                        }                       
                    }
                    totalChecklistElement.Text = $"checklist: {totalConcluidos}/{totalItens}";
                }
                else
                    totalChecklistElement.Visibility = ElementVisibility.Collapsed;
                 
 
                if (bound.comentarios.TemRegistro())
                {
                    totalComentariosElement.Visibility = ElementVisibility.Visible;
                    totalComentariosElement.Text = $"comentários: {bound.comentarios.Count()}";
                }
                else
                    totalComentariosElement.Visibility = ElementVisibility.Collapsed;
                 
 
                progressoCartaoElement.Text ="Status: " + bound.obj_cartao.progresso_cartao.GetDescription();
            }
             
             
        }
 
    }
 
 
Leandro
Top achievements
Rank 1
 answered on 05 Jul 2019
1 answer
88 views

Hi,

 

I am trying to collapse ProgressBar inside StatusStrip, with that code:

Me.RadProgressBarElement1.Visibility = ElementVisibility.Collapsed

 

The ProgressBar  is been hidded but not collapsed.

Is there any bug or something else I must aplly for collapse ProgressBar?

 

Thanks you!

Nadya | Tech Support Engineer
Telerik team
 answered on 05 Jul 2019
4 answers
123 views
Hello,

I wanted to change my WaitingBar style via examples in documentations but my waiting bar didn't have the WaitingStyle property!
So I think this is because of my Telerik version: 2010.2.10.713

How can I write this code in my version if it is supported in this version?
this.radWaitingBar1.WaitingStyle = Telerik.WinControls.Enumerations.WaitingBarStyles.Dash;
Nadya | Tech Support Engineer
Telerik team
 answered on 05 Jul 2019
4 answers
1.1K+ views

Hi. I have a radgridview with some data columns and one image column. I want to set row height and width manually (to fit the images and all data) before exporting to Excel (note: i dont want to use "ExportVisualSettings" property).

so... what should i do?

Pin
Top achievements
Rank 1
Iron
 answered on 04 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
ComboBox and ListBox (obsolete as of Q2 2010)
ListView
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
Menu
PropertyGrid
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
Rotator
TrackBar
MessageBox
SpinEditor
StatusStrip
CheckedListBox
Wizard
ShapedForm
SyntaxEditor
TextBoxControl
LayoutControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
DataEntry
GroupBox
ScrollablePanel
WaitingBar
ScrollBar
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
ColorBox
Callout
FilterView
PictureBox
VirtualKeyboard
NavigationView
Accessibility
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
Flyout
ToolbarForm
NotifyIcon
Rating
TimeSpanPicker
BarcodeView
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
DateOnlyPicker
TimeOnlyPicker
+? more
Top users last month
Henri
Top achievements
Rank 2
Iron
Iron
Iron
SUNIL
Top achievements
Rank 2
Iron
Iron
Iron
David
Top achievements
Rank 1
Jackson
Top achievements
Rank 1
Iron
Iron
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Henri
Top achievements
Rank 2
Iron
Iron
Iron
SUNIL
Top achievements
Rank 2
Iron
Iron
Iron
David
Top achievements
Rank 1
Jackson
Top achievements
Rank 1
Iron
Iron
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?