Telerik Forums
UI for WinForms Forum
2 answers
506 views
I have a set of data (4000) items that appear in a RadGridView.  The goal is for the user to select items from this GV to save.  When the form re-loads, I need the selected items to automatically show as selected.  
I have that column set as GridViewCheckBoxColumn.

I am looping through the DataClass to match the information in which would determine if the record (row) would be selected.

Since I'm already looping through the data, I dont want to have to loop through the GV each time to find the Cell in which to select.  I was hoping there would be a way to Search or FindBy XXX.

I've yet to find any information on how to do this and it seems like something that most people would use....  What am I missing?

Brandy
Top achievements
Rank 1
 answered on 06 Mar 2018
7 answers
1.1K+ views

I am using Version 2016.2.608.20 of WinControls.UI.  

 

WHERE IS PERFORMCLICK EVENT?

My client is very particular that they do not want anyone hand-typing a date into a control, so I need the date part of the DateTimePicker to be read-only.  Unfortunately, all attempts to do this do not work, and it appears that is not supported.  My workaround is a standard LABEL control placed OVER the date area of the DateTimePicker, with a painted border.  But the client wants to be able to CLICK on that now and have the calendar appear.

I considered using a standard RadButton and RadCalendar, but then I need to do a lot of extra work to make it extend beyond the modal dialog form bounds, etc.  I am hoping there is an easier way to just do a built-in PERFORMCLICK, if only I can find where it's hidden.

 

DISABLE SUNDAYS ON THE CALENDAR

I found other answers to this question, and it certainly makes the Sunday dates APPEAR disabled, but they can still click on them, and the date changes.  I am handling in the CLOSED event, adjusting the date accordingly to the next Monday... but it would be better if the Sundays actually stayed disabled / un-clickable.

 

HIDE THE CLEAR BUTTON

Minor issue, I can show the footer and disable the clear button... but is there any way to completely remove it?  (They like having the [TODAY] button in the footer.  This is minor... they can live with a disabled button... but if there's an easy way to hide it, how?

 

Thanks for your help!

 

Here is my code:

/// PART ONE - WHERE IS THE PERFORMCLICK EVENT?
 
private void MyLabel_MouseClick(object sender, MouseEventArgs e)
{
     // Attempts to locate the PerformClick event...
 
     MyRadDateTimePicker.DateTimePickerElement.PerformClick();
     MyRadDateTimePicker.DateTimePickerElement.ArrowButton.PerformClick();
 
     foreach (Telerik.WinControls.RadElement _Element in
          MyRadDateTimePicker.DateTimePickerElement.ArrowButton.Children)
                _Element.PerformClick();
 
     foreach (Telerik.WinControls.RadElement _Element in
          MyRadDateTimePicker.DateTimePickerElement.Calendar.CalendarElement.Children)
                _Element.PerformClick();
}
 
 
// PART TWO - HOW TO DISABLE SUNDAYS IN CALENDAR
 
private void MyRadDateTimePicker_Opened(object sender, EventArgs e)
{
     MyRadDateTimePicker.DateTimePickerElement.Value = this.SelectedDate;
             
     RadCalendar _Calendar = MyRadDateTimePicker.DateTimePickerElement.Calendar;
     CalendarTableElement _Table
        = (CalendarTableElement)_Calendar.CalendarElement.CalendarVisualElement.Children[0].Children[1];
 
     foreach (CalendarCellElement _Cell in _Table.Children)
     {
         if (_Cell.Date.DayOfWeek == DayOfWeek.Sunday)
         {
             _Cell.Enabled = false;   // Disables, but still leaves it clickable
         }
     }
     _Calendar.ClearButton.Enabled = false// Would actually prefer to HIDE this!
     _Calendar.ShowFooter = true;
}
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 06 Mar 2018
2 answers
117 views

Hi,

if I add calculated field like below:

https://docs.telerik.com/devtools/winforms/pivotgrid/calculated-fields

and then try to rename it using FieldList - More aggrerate options...

I got an exception:

System.InvalidOperationException: Operation is not valid due to the current state of the object.

   at Telerik.WinControls.UI.PivotGrid.Dialogs.AggregateOptionsDialog.get_SelectedQueryableAggregateFunction()
   at Telerik.WinControls.UI.PivotFieldListVisualItem.aggregateOptionsMenuItem_Click(Object sender, EventArgs e)
   at Telerik.WinControls.RadElement.OnClick(EventArgs e)
   at Telerik.WinControls.UI.RadMenuItem.OnClick(EventArgs e)
   at Telerik.WinControls.RadElement.DoClick(EventArgs e)

...

Is it a bug and is there a workaround?

Alex

 

 

Alex Dybenko
Top achievements
Rank 2
 answered on 06 Mar 2018
3 answers
188 views

If I have say 110 items in my list and want to bring item 67 into view, how do I go about this?

 

Thanks

Tino
Top achievements
Rank 1
 answered on 05 Mar 2018
8 answers
555 views
Hi,
I did look at other posts involving creating HTML links in the RadLabel control but they all are navigating to some web page.

I don't know if this is possible but i wanted to "detect" which link is clicked in the RadLabel_Click event and then load some Winforms based on the link.

To make this simple lets say for example, the RadLabel has some HTML text with say 3 link tags.

 

 

 

RadLabel1.Text = "<html><span><a href='??'>Link 1</a>, <a href='??'>Link 2</a>, <a href='??'>Link 3</a</span></html>"

When user click on "link 1", i would show message box "Link 1" or load Form1, click on Link 2, show message box "Link 2" or load  Form2 and so on. I put "??" in the href as am not sure what will go there yet.

Is this possible? I know it can be done with the LinkControl but i really like the HTML formatting available with a RadLabel.

Thanks
Don

Edit:
I do see a "Other" option in the hyperlink type option.(image attached)
Please could you tell me how to use this option? Can i use this option to load winforms?
Thanks.. 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 05 Mar 2018
2 answers
110 views

Hello,

I have an issue about the new search support functionnality in the scheduler.

On the grid displaying the result of a search, there is a column based on the background of the appointements which display a color and a displayname defined by Backgrounds property of the Scheduler and the value set in an appointement.

It have made the following customization with theses backgrounds to fit my need.

' Redefine the background list of Appointement
        Dim vacancesbackground As AppointmentBackgroundInfo = Me.AbsenceScheduler.Backgrounds(0)
        With vacancesbackground
            .Id = Absence.TypeOfAbsence.Vacance '=1
            .DisplayName = EnumHelper.GetDescription(Absence.TypeOfAbsence.Vacance)
        End With
        Dim maladiebackground As AppointmentBackgroundInfo = Me.AbsenceScheduler.Backgrounds(1)
        With maladiebackground
            .Id = Absence.TypeOfAbsence.Maladie '=2
            .DisplayName = EnumHelper.GetDescription(Absence.TypeOfAbsence.Maladie)
        End With
        Dim absencebackground As AppointmentBackgroundInfo = Me.AbsenceScheduler.Backgrounds(10)
        With absencebackground
            .Id = Absence.TypeOfAbsence.Absence '=3
            .DisplayName = EnumHelper.GetDescription(Absence.TypeOfAbsence.Absence)
        End With
        Dim congebackground As AppointmentBackgroundInfo = Me.AbsenceScheduler.Backgrounds(9)
        With congebackground
            .Id = Absence.TypeOfAbsence.Conge '=4
            .DisplayName = EnumHelper.GetDescription(Absence.TypeOfAbsence.Conge)
        End With
 
        Me.AbsenceScheduler.Backgrounds.Clear()
        Me.AbsenceScheduler.Backgrounds.Add(vacancesbackground)
        Me.AbsenceScheduler.Backgrounds.Add(maladiebackground)
        Me.AbsenceScheduler.Backgrounds.Add(absencebackground)
        Me.AbsenceScheduler.Backgrounds.Add(congebackground)

 

They are correctly displayed in the result grid except for the one with the Id "1" which display a transparent color and no text.

I'm not really surprised that there is a "special treatment" for this value as the default values 1 of the backgrounds is defined as "None" but is there a way to handle this ? I have attached a exemple screenshot (Record with blank Type should have "Vacances" and blue color)

Thanks for you support

Marco Guignard

 

Marco
Top achievements
Rank 2
Veteran
 answered on 05 Mar 2018
1 answer
95 views

Hi

How can I increase/decrease the number of digits after decimal in the pivotgrid for all cells on button click.

Hristo
Telerik team
 answered on 05 Mar 2018
4 answers
2.4K+ views

I have a GridViewTextBoxColumn in my grid.  I want it to behave like a drop down when I have more than one potential value which could be displayed.  In order to do this I capture the "EditorRequired" event.  Sometimes I will have values in my grid for a given row and sometimes I will not.  Sometimes I will have only one item in the row as well.  So basically I expect to have no value, one value or multiple values.

I'd like the column in my GridView to only show the drop down list when I have more than one value that is available.  Currently the column shows the drop down as soon as I click on that column which is very misleading to the user.  I've attached 3 screen shots showing an example of how my grid row/column appears.  In my screen shots I also show an exclamation point image when there is more than 1 item in my drop down list.

Here is my implementation of this event..

private void BatchComparisonGridEditorRequired(object sender, EditorRequiredEventArgs e)
{
    if (BatchComparisonGrid.CurrentColumn.Name == "Matches")
    {
        // get model
        ComparisonScanViewModel model = BatchComparisonGrid.CurrentRow.DataBoundItem as ComparisonScanViewModel;
 
        RadDropDownListEditor editor = new RadDropDownListEditor();
        RadDropDownListEditorElement element = editor.EditorElement as RadDropDownListEditorElement;
        element.DropDownStyle = RadDropDownStyle.DropDownList;
        element.DataSource = model.Matches;
        element.DisplayMember = "Id";               
 
        // only 0 or 1 match?
        if (model.Matches.Count <= 1)
        {
            // how to not make this a drop down??
        }
 
        // more than 1 match?  make it obvious
        if (model.Matches.Count > 1)
        {
            element.BorderThickness = new Padding(1);
            element.FocusBorderColor = Color.Blue;
            element.EnableFocusBorder = true;
        }
 
        // assign as the editor
        e.Editor = editor;
    }
}

 

Also, it would be nice for the border of the column to have a thickness and color before clicking on it when it has multiple values in the drop down.  If possible please let me know how to do this.

Chris Kirkman
Top achievements
Rank 1
 answered on 05 Mar 2018
8 answers
123 views

I have a strange error. See attached.  I have a form with a GridView.  The user clicks a button which in turn causes the GridView to bind to a datasource that I call a BindingList of "ComparisonScanViewModel".  For this example the contents of this class are not relevant.  The grid immediately binds correctly.  In a background thread a value within each instance named "Gamma" is calculated.  The result is that the grid is filled with rows representing all the items in the list and as each "Gamma" is calculated the grid reflects this by updating the "Gamma (Passing %)" column.

// user wants to compare now
private async void CompareCommandBarButton_Click(object sender, EventArgs e)
{
    _projectViewModel = ReferenceProjectDropDownList.SelectedValue as ProjectViewModel;
 
    UpdateWaitingBar(ElementVisibility.Visible, "Finding matches / Calculating Passing Percentage...");
    if (null != _projectViewModel)
        await GetScans();
    UpdateWaitingBar(ElementVisibility.Collapsed);
}

 

The "await GetScans()" function does all the heavy lifting.  This function can be stopped elsewhere (when a user wants to close the form before this function has completed), which is why the "private ManualResetEvent _reset = null;" exists in the class.  The important part of this function is the line "scanModel.FindMatches(_snc.Measuring.GetProject(_projectViewModel.Id));".  This is where my "Gamma" value is calculated and the grid is updated to reflect the result.  See below...

/// <summary>
/// Calculate the gammas for the scans in the project
/// </summary>
private async Task GetScans()
{
    _reset?.Set();
    _task?.Wait();
 
    if (null != _projectViewModel)
    {
        // reference project name
        _referenceProjectName = _projectViewModel.Name;
 
        // what is the current analysis parameter protocol
        _protocol = (AnalysisProtocolType)_snc.Administration.GetPreference(
            PreferenceType.AnalysisProtocolType).IntValue;
 
        _model = new ComparisonScansViewModel(_snc, _protocol, _scans);
        if (null != _model)
            BatchComparisonGrid.DataSource = _model.Scans;
 
        UpdateWaitingBar(ElementVisibility.Visible, "Finding matches / Calculating Passing Percentage...");
 
        // try to calculate match/gamma
        _task = Task.Run(() =>
        {
            _reset = new ManualResetEvent(false);
 
            try
            {
                foreach (ComparisonScanViewModel scanModel in _model.Scans)
                {
                    if (_reset.WaitOne(0)) break;
                    scanModel.FindMatches(_snc.Measuring.GetProject(_projectViewModel.Id));
                }
            }
            catch (Exception)
            {
 
            }
            finally
            {
                _reset?.Close();
                _reset?.Dispose();
                _reset = null;
            }
        });
        await _task;
    }
 
    UpdateWaitingBar(ElementVisibility.Collapsed);
}

 

This is what the UI looks like as "Gamma" is calculated within my model and it's value is reflected in the grid.  *Notice that there are rows with no "Gamma" and as "Gamma" is calculated it is shown on that column (this is exactly how it supposed to work).  Occasionally I get the error attached, the "LayoutQueue" error while the model is being updated and then reflected in to the grid.  Any ideas why this is happening?

 

 

 

Hristo
Telerik team
 answered on 02 Mar 2018
3 answers
257 views

Hello,

I'm using 2018 SP1.  It looks like the CommandBarButton is displaying improperly when disabled.  I have the TextImageRelation set to ImageBeforeText but when disabled it puts a blank square on the right side.  Changing the TextImageRelation to TextBeforeImage makes it display properly.  Is there any way to work around this?

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 01 Mar 2018
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
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
ShapedForm
SyntaxEditor
Wizard
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
Overlay
Security
LocalizationProvider
Dictionary
SplashScreen
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
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?