Telerik Forums
UI for WinForms Forum
8 answers
146 views

Hello Telerik Team,

I want to implement some custom renderings or a overlay for a radChart. I added a screenshot of my application with some annotations. My goal is to remove the dummy resource from the scheduler. The cells of the dummy resource are only used to show workload-percentages. But before I can remove it, I need to display the workload in the ChartView, more precisely in the RangeSelector.

Screenshot

I already implemented a custom CartesianRenderer and custom BarSeriesDrawPart to control the color of the bars depending on the calculated workload. But now I want a Label with the workload percentage centered on each bar. But i don't know how to calculate the the rectange of the area from 0% to 100% to figure out the correct positioning.

My solution so far:


internal class CustomBarSeriesDrawPart : BarSeriesDrawPart
{
    public Font DefaultFont { get; private set; }


    public CustomBarSeriesDrawPart(BarSeries series, IChartRenderer renderer, Font defaultFont) : base(series, renderer)
    {
        DefaultFont = defaultFont;
    }

    public override void DrawSeriesParts()
    {
        //LogHelper.Info("CustomBarSeriesDrawPart.DrawSeriesParts() START");
        if (!(Renderer is CustomCartesianRenderer renderer))
            throw new ApplicationException($"Renderer ist nicht vom Typ \"{nameof(CustomCartesianRenderer)}\"");

        var graphics = ((ChartRenderer)Renderer).Graphics;
        var radGraphics = new RadGdiGraphics(graphics);

        for (int i = 0; i < Element.DataPoints.Count; i++)
        {
            RadRect slot = Element.DataPoints[i].LayoutSlot;

            //how to get the rectangle for the full slot (from 0% to 100% height)? 
            RectangleF barBounds = new RectangleF((float)(OffsetX + slot.X), (float)(OffsetY + slot.Y), (float)slot.Width, (float)slot.Height);

            DataPointElement childElement = (DataPointElement)Element.Children[i];

            float realWidth = barBounds.Width * childElement.HeightAspectRatio;
            barBounds.Width = realWidth;

            barBounds.Height = Math.Max(barBounds.Height, 1f);
            double percentage = 0;
            Color color;

            if (Element.DataPoints[i] is CategoricalDataPoint point)
            {
                percentage = point.Value ?? 0;

                //color = Owner.Auslastungsfarbe(percentage);
                color = renderer.Owner.Auslastungsfarbe(percentage);
            }
            else
                color = Color.LightGray;

            radGraphics.FillRectangle(barBounds, color);

            //radGraphics.DrawEllipse();

            var parameters = new TextParams()
            {
                text = $"{(int)percentage}%",
                alignment = ContentAlignment.MiddleCenter,
                foreColor = Color.Black,
                paintingRectangle = barBounds,
                font = DefaultFont,
            };
            radGraphics.DrawString(parameters, barBounds.Size);
        }
        //base.DrawSeriesParts();
    }
}

Hope you can help my with it.

Regards,

Stephan

Stephan
Top achievements
Rank 3
Bronze
Iron
Iron
 answered on 08 Nov 2023
3 answers
88 views

Hello, 

I'm trying to set up a custom filter for a ListView set in Icon Mode.

Following along with the example provided here: https://docs.telerik.com/devtools/winforms/controls/listview/features/filtering

I've created the following function (no actual filtering functionality has been added yet):

//Apply the filters to the RadListView
bool BrightLife::FilterDatabase(ListViewDataItem^ item)
{

	//Filter by Tree View

	//Filter by Search Bar

	//Filter by Color

	//Filter by Style

	return false;
}

Then, in the constructor of my form, I have the following:

this->LV_Assets->EnableFiltering = true;
this->LV_Assets->ListViewElement->DataView->Filter = FilterDatabase; //<- Problem here

The line which assigns the filter to the RadListView is returning an error in Visual Studio

function "Telerik::WinControls::Data::RadCollectionView<TDataItem>::Filter::set [with TDataItem=Telerik::WinControls::UI::ListViewDataItem ^]" cannot be called with the given argument

I'm not entirely sure what the problem is here and would appreciate any insight to help me get this working. Thanks!

Dinko | Tech Support Engineer
Telerik team
 answered on 08 Nov 2023
2 answers
183 views

Hello I need to localize the filedialog componenet to french

I have created the frenchlocalization class and it works partially, as you can see from the attached screenshot some of the elements are properly translated but all the buttons and some labels are not translated

I don't see what I am missing:

here below the code and the class

-----------------------------------------------------

            Select Case MyPreference.ifLanguage
                Case "fr" : FileDialogsLocalizationProvider.CurrentProvider = New FrenchLocalization.MyFrenchFileDialogsLocalizationProvider()
            End Select

-------------------------------------------------------

    Public Class MyFrenchFileDialogsLocalizationProvider
        Inherits FileDialogsLocalizationProvider
        Public Overloads Overrides Function GetLocalizedString(ByVal id As String) As String
            Select Case id
                Case FileDialogsStringId.OK
                    Return "OK"
                Case FileDialogsStringId.Yes
                    Return "Oui"
                Case FileDialogsStringId.No
                    Return "Non"
                Case FileDialogsStringId.Cancel
                    Return "Annuler"
                Case FileDialogsStringId.Back
                    Return "Arrière"
                Case FileDialogsStringId.Forward
                    Return "Avant"
                Case FileDialogsStringId.Up
                    Return "en Haut"
                Case FileDialogsStringId.NewFolder
                    Return "Nouveau Dossier"
                Case FileDialogsStringId.SearchIn
                    Return "Chercher dans"
                Case FileDialogsStringId.SearchResults
                    Return "Résultats de recherche dans"
                Case FileDialogsStringId.ExtraLargeIcons
                    Return "Très grandes icônes"
                Case FileDialogsStringId.LargeIcons
                    Return "Grandes icônes"
                Case FileDialogsStringId.MediumIcons
                    Return "Icônes moyennes"
                Case FileDialogsStringId.SmallIcons
                    Return "Petites icônes"
                Case FileDialogsStringId.List
                    Return "Liste"
                Case FileDialogsStringId.Tiles
                    Return "Titres"
                Case FileDialogsStringId.Details
                    Return "Détails"
                Case FileDialogsStringId.NameHeader
                    Return "Nom"
                Case FileDialogsStringId.SizeHeader
                    Return "Taille"
                Case FileDialogsStringId.TypeHeader
                    Return "Type"
                Case FileDialogsStringId.DateHeader
                    Return "DModifié le"
                Case FileDialogsStringId.FileSizes_B
                    Return "bytes"
                Case FileDialogsStringId.FileSizes_GB
                    Return "GB"
                Case FileDialogsStringId.FileSizes_KB
                    Return "KB"
                Case FileDialogsStringId.FileSizes_MB
                    Return "MB"
                Case FileDialogsStringId.FileSizes_TB
                    Return "TB"
                Case FileDialogsStringId.OpenFileDialogHeader
                    Return "Ouvrir le fichier"
                Case FileDialogsStringId.OpenFolderDialogHeader
                    Return "Ouvrir le dossier"
                Case FileDialogsStringId.SaveFileDialogHeader
                    Return "Enregistrer sous"
                Case FileDialogsStringId.FileName
                    Return "Nom de fichier:"
                Case FileDialogsStringId.Folder
                    Return "Dossier:"
                Case FileDialogsStringId.SaveAsType
                    Return "Enregistrer comme type:"
                Case FileDialogsStringId.OpenFolder
                    Return "Ouverture du dossier"
                Case FileDialogsStringId.FileFolderType
                    Return "Dossier de fichier"
                Case FileDialogsStringId.Cut
                    Return "Couper"
                Case FileDialogsStringId.Copy
                    Return "Copier"
                Case FileDialogsStringId.CopyTo
                    Return "Copier vers"
                Case FileDialogsStringId.Delete
                    Return "Supprimer"
                Case FileDialogsStringId.Edit
                    Return "Modifier"
                Case FileDialogsStringId.MoveTo
                    Return "Déplacer vers"
                Case FileDialogsStringId.Open
                    Return "Ouvrir"
                Case FileDialogsStringId.Paste
                    Return "Coller"
                Case FileDialogsStringId.Properties
                    Return "Propriétés"
                Case FileDialogsStringId.Rename
                    Return "Renommer"
                Case FileDialogsStringId.Save
                    Return "Enregistrer"
                Case FileDialogsStringId.View
                    Return "Vue"
                Case FileDialogsStringId.CheckThePath
                    Return "Vérifier le chemin et réessayer."
                Case FileDialogsStringId.ConfirmSave
                    Return "Confirmer enregistrer sous"
                Case FileDialogsStringId.FileExists
                    Return "existe déjà."
                Case FileDialogsStringId.FileNameWrongCharacters
                    Return "Un nom de fichier ne peut pas contenir les caractères : \ / : * ? "" < > |"
                Case FileDialogsStringId.InvalidExtensionConfirmation
                    Return "Etes-vous sûr de vouloir le changer?"
                Case FileDialogsStringId.InvalidFileName
                    Return "Le nom du fichier n'est pas valide."
                Case FileDialogsStringId.InvalidOrMissingExtension
                    Return "Si vous changez l'extension d'un fichier, ce dernier peut devenir inutilisable."
                Case FileDialogsStringId.InvalidPath
                    Return "Le chemin n'existe pas."
                Case FileDialogsStringId.OpenReadOnly
                    Return "Ouvrir en lecture seule"
                Case FileDialogsStringId.ReplacementQuestion
                    Return "Voulez-vous le remplacer?"
                Case Else
                    Return String.Empty
            End Select
        End Function
    End Class

Nadya | Tech Support Engineer
Telerik team
 answered on 08 Nov 2023
1 answer
270 views

I have a simple form, in which the first two controls are radio buttons. I dont' want either radio button checked, but no matter what I do, the first radio button is always checked when I run the form.   I want the user to have to pick one of the radio buttons, and if they don't we have code that warns a one of the radio buttons must be picked.   Witht hat said, I am kind of stuck, as I played with setting them both to IsChecked = false and CheckState = CheckState.UnChecked, but the first RadioButton, at runtime, gets checked anyway.   

 

Also, I don't want the radio button to auto check when the user uses the ARROW keys to switch between them. I want the user to have to either click the SPACE BAR or click with the mouse, is this possible.

 

TIA

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 08 Nov 2023
1 answer
106 views

Hi all,

i tried to add a CommandBarSeparator into a CommandBarStripElement (of a RadCommandBar) .

The RadCommandBar has dock = Left...so , i would like to have a separator like an horizontal line

But..when i add CommandBarSeparator (at runtime) the commandBar shows a separator like a vertical line

I have tried to set commandBarSeparator.orientation to horizontal , but has no effects.

 

Nadya | Tech Support Engineer
Telerik team
 answered on 07 Nov 2023
1 answer
147 views

Hi

There is a List<Class> bound to the ListView, and the data in the list is changed from time to time by the user's. At that time, I want to apply Auto Elipsis, which is shown as... when the letter of the item is longer than the column width with each column width fixed, but I don't know how.

Nadya | Tech Support Engineer
Telerik team
 answered on 06 Nov 2023
3 answers
159 views

So we are populating rad grid from data which we get from database.
my requirement is like based on datatype which we get from service(database) I need to show checkbox or datetime or text in same column.
if I will be receiving 1 or 0 I need to show checkbox marked as checked / unchecked respectively if got text than simple text need to be shown.
pls check below image for more reference.

Requirement

 What we tried:
so I am here sharing you my the things we tried.
Actually we tried using cell formatting event to change the cell element based on data it is working fine but we are experiencing visual glitch's.
glitch is like have checkbox on all columns of same row as we scroll right or left in grid.

Note: on the first time its work fine but when we scroll than glitches come.

I am attaching the code snippet which we tried also attaching video clip which will show the glitches.

Code snippet:

private void GrdHistory2_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement is GridDataCellElement)
    {
        // Assuming you have a data source where the column "MixedTypeData" determines the cell type
        if (e.Column.Name == grdHistoryColNewValue.Name)
        {
            if (e.Row.Cells["New Value"].Value != null)
            {
                if (e.Row.Cells["New Value"].Value.ToString() == "0")
                {
                    e.CellElement.Children.Clear();
                    RadCheckBoxElement checkBoxElement = new RadCheckBoxElement();
                    e.CellElement.Children.Add(checkBoxElement);
                }
                else if(e.Row.Cells["New Value"].Value.ToString() == "1")
                {
                    e.CellElement.Children.Clear();
                    RadCheckBoxElement checkBoxElement = new RadCheckBoxElement();
                    e.CellElement.Children.Add(checkBoxElement);
                }
            }
        }
    }
}

pls check below gif image. 
Here I just need to show in
column "New Value" but it also coming on all other column while scrolling. disappear after while .
Please suggest me some solution so that it would work for my use case. 

Thanks,
Shubham Jain
Nadya | Tech Support Engineer
Telerik team
 answered on 06 Nov 2023
1 answer
90 views

Hi,

 

I’m trying to draw CartesianGridLineAnnotation in front of each Y axis tick.

 

The Y axis number of ticks depends on the size of the RadChartView. The property DesiredTickCount is update into the SizeChanged event of the Chart. (Same issue with the resize event of the RadChartView).

 

It’s working fine when the form is resize with the mouse drag, but when I resize the form by double clicking the form (switch to full screen), it’s not working as expected.

 

ActualRange property seems not updated in the non working case, is there a way to avoid that ?

 

Thanks.

Nadya | Tech Support Engineer
Telerik team
 answered on 06 Nov 2023
1 answer
248 views

I have a .Net6 winform app and was trying to bind sqlite to radgridview.

Has anyone bound the radGridView to a SQLite db via entityframework?  If so what is the best way to go about it?  I have not yet been able to find anything on it.

thanks!

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 06 Nov 2023
1 answer
92 views

Hi,

I would like to know how to get the size of the cartesian area (red square above).

I tried with radspy to get the right element, but there is no size set, everything is "0,0", any idea?

Thanks in advance

Nadya | Tech Support Engineer
Telerik team
 answered on 06 Nov 2023
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
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
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
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Styling
Barcode
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
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
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?