Telerik Forums
UI for WinForms Forum
1 answer
89 views

Hello.

I'm tring to make a custom cell with radtimepickerelement but something is not working in SetContentCore because any value I set in the timepicker editor when i see the value it's always nothing.

 

And in the other hand I can't use the custom editor in the row witch is used for add new rows in the grid.

 

I've done a sample code if you could help me

Thx.

 

 

  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim colnombre As New GridViewTextBoxColumn("nombre")
        Dim colHora As New TimePickerColumn("hora")

        GVPrueba.Columns.Add(colnombre)
        GVPrueba.Columns.Add(colHora)

        GVPrueba.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill


    End Sub

    Private Sub GVPrueba_SelectionChanged(sender As Object, e As EventArgs) Handles GVPrueba.SelectionChanged
        If GVPrueba.SelectedRows.Count = 1 Then

            If GVPrueba.SelectedRows(0).Cells("hora").Value IsNot Nothing Then
                MsgBox(GVPrueba.SelectedRows(0).Cells("hora").Value.ToString)

            End If
        End If
    End Sub




    Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
        If GVPrueba.Rows.Count > 0 Then
            GVPrueba.Rows(0).Cells("hora").Value = Now
        End If
    End Sub


    Public Class TimePickerCellElement
        Inherits GridDataCellElement

        Public Sub New(ByVal column As GridViewColumn, ByVal row As GridRowElement)
            MyBase.New(column, row)
        End Sub

        Private oRadTimePickerElement As RadTimePickerElement
        Protected Overrides Sub CreateChildElements()
            MyBase.CreateChildElements()
            oRadTimePickerElement = New RadTimePickerElement()
            Me.Children.Add(oRadTimePickerElement)
        End Sub

        Protected Overrides Sub SetContentCore(value As Object)
            If Me.Value IsNot Nothing AndAlso Me.Value IsNot DBNull.Value Then
                DateTime.TryParse(value, oRadTimePickerElement.Value)
                '       MyBase.SetContentCore(value)
            End If
        End Sub

        Public Overrides Function IsCompatible(ByVal data As GridViewColumn, ByVal context As Object) As Boolean
            Return TypeOf data Is TimePickerColumn AndAlso (TypeOf context Is GridDataRowElement OrElse TypeOf context Is GridNewRowElement)
        End Function

    End Class

    Public Class TimePickerColumn
        Inherits GridViewDataColumn
        Public Sub New(ByVal fieldName As String)
            MyBase.New(fieldName)
        End Sub

        Public Overrides Function GetCellType(ByVal row As GridViewRowInfo) As Type
            If TypeOf row Is GridViewDataRowInfo Then
                Return GetType(TimePickerCellElement)
            End If
            Return MyBase.GetCellType(row)
        End Function

    End Class

 


Nadya | Tech Support Engineer
Telerik team
 answered on 20 Feb 2020
7 answers
605 views

 Is there a way to display an encrypted file in PdfViewer ?

I created a file:

formatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
formatProvider.ExportSettings.UserPassword = "xxx";
formatProvider.ExportSettings.IsEncrypted = true;

formatProvider.Export( ...)

And now I want to display it, but haven't found a place to pass a password to the viewer.
It's not displaying any error, it's just displaying - the correct number of - empty pages.

 

Tanya
Telerik team
 answered on 20 Feb 2020
4 answers
658 views

Hi there,

I've been tasked with migrating DataTable functionality to Telerik RadGridView in a C# WinForms app.

DataTable code sample:

   var taxColumn = new DataColumn();
   taxColumn.DataType = System.Type.GetType("System.String");
   taxColumn.ColumnName = "tax";
   taxColumn.Expression = "SUBSTRING('ABC',2,3)";

My attempt to do the equivalent using a RadGridView TextBoxColumn fails with "unknown function SUBSTRING()".

Is there any similar functionality in RadGridView to the Substring function in DataColumn please? It's essential to be able to write expressions that do substirng operations in the app I'm working on.

 

Thanks as ever for your help!

Kind regards, James

James
Top achievements
Rank 1
 answered on 19 Feb 2020
3 answers
114 views

I am happy Telerik created these dialogs for aesthetic reasons.

Is there a way to restrict access to file operations (Delete, copy, et. al.)?? I want to restrict file functions that can be performed via these dialogs. For example, I want to prevent someone from copying files from a USB when selecting a folder or selecting a file.

 

Thanks,

 

Jim

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 19 Feb 2020
15 answers
1.0K+ views

Hi,

I need to build a solution to export text from PDF including their X,Y cordinates. 

Could it be done with PDFViewer or other Telerik product?

Best regards,
André

Tanya
Telerik team
 answered on 19 Feb 2020
2 answers
154 views

Hi, i read the documentation for "custom-sorting" and "Setting Sorting Programmatically" but that´s not my case.

i need a possibility to add a custom-sorting only for one column and sort with the data of a hidden column.

What´s the right way to do that?

Best regards

Martin

Martin
Top achievements
Rank 1
 answered on 19 Feb 2020
1 answer
213 views

I am trying to achieve a similar experience as in your CardView demo with the cities. The images are stored as block blobs in an Azure storage account. The blobs have tags, which i want to expose , similar to the meta from the demo where we have city name, population, country).

As far as i saw, there is no direct integration for CloudBlockBlob, so i am trying to place this in a byte array in order to display. Yet the outcome is an empty box in the grid, for each item from the container. the blobs are correctly downloaded, verified by writing the fileContent byte array to disk via filestream.

Any idea on how to achieve this?

 

Thank you!

 

 public partial class Form1 : Form
    {
        string sasToken = "?st=2020-02-12T21%3A05%3A08Z&se=2021-02-13T21%3A05%3A00Z&sp=rl&sv=2018-03-28&sr=c&sig=*redacted*";
        public Form1()
        {
            InitializeComponent();
            
        }


        public List<IListBlobItem> MainBody3(string id)
        {
            StorageCredentials accountSAS = new StorageCredentials(sasToken);

            // Use these credentials and the account name to create a Blob service client.
            CloudStorageAccount account = new CloudStorageAccount(accountSAS, "storage_account_name", endpointSuffix: null, useHttps: true);

            CloudBlobClient client = account.CreateCloudBlobClient();
            CloudBlobContainer container = client.GetContainerReference("images-analyzed-sampled");

            BlobContinuationToken token = null;
            List<BlobInfo> blobi = new List<BlobInfo>();
            List<IListBlobItem> poze = new List<IListBlobItem>();
            BlobRequestOptions options = new BlobRequestOptions();
            var myResults = new DataSet();
            do
            {
                var result = container.ListBlobsSegmented(null, true, new BlobListingDetails(), 20, token, null, null);
                token = result.ContinuationToken;

                var blobs = result.Results;
                foreach (IListBlobItem item in blobs)
                {
                    var blob = item as CloudBlockBlob;

                    long fileByteLength = blob.Properties.Length;
                    byte[] fileContent = new byte[fileByteLength];
                    for (int i = 0; i < fileByteLength; i++)
                    {
                        fileContent[i] = 0x20;
                    }
                   
                    radCardView1.Items.Add(blob.DownloadToByteArray(fileContent, 0));

                }
            } while (token != null);


            return poze;

        }




        private bool HasMatchingMetadata(CloudBlockBlob blob, string term)
        {
            foreach (var item in blob.Metadata)
            {
                if (((item.Key.StartsWith("Tag") || (item.Key.StartsWith("PredictedImageType"))) && item.Value.Equals(term, StringComparison.InvariantCultureIgnoreCase)))
                    return true;
            }

            return false;
        }

        private void radButton1_Click(object sender, EventArgs e)
        {
            MainBody3("");
        }
    }
    public class BlobInfo
    {
        public string ImageUri { get; set; }
        public string ThumbnailUri { get; set; }
        public string Caption { get; set; }
    }
}

Nadya | Tech Support Engineer
Telerik team
 answered on 19 Feb 2020
1 answer
96 views

public RadForm1() 
        {
            RadMapElement.VisualElementFactory = new MyMapVisualElementFactory();
            InitializeComponent();

            <..filling data and asigning clustering here>

        } 

public class MyMapVisualElementFactory : MapVisualElementFactory
    {
        public override MapCluster CreateCluster()
        {
            System.Diagnostics.Debug.WriteLine("FIRE!");
            return new MapCluster();
        }
    }

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 19 Feb 2020
2 answers
369 views

Hi, 

Can I load pictures via LoadImageFromUrl from a local disk without async methods?

The code below works, but it works poorly and often the images do not load, or not all are loaded.

Uri uri = new Uri(Path.Combine(Holder.TempPath, e.Url), UriKind.Absolute);

WebClient client = new WebClient();
client.OpenReadCompleted += (w, a) =>
    {
     if(a.Error == null)
      {
    try
     {
             e.ImageElement.Init(a.Result, new Telerik.WinControls.RichTextEditor.UI.Size(16, 16), extension);
     }
      catch
     {
       //Handle errors
      }
    }
    };
    client.OpenReadAsync(uri);

Sergey
Top achievements
Rank 2
 answered on 19 Feb 2020
2 answers
173 views

Hi,

i would like to change cursor for data field label in RadDataLayout, to make it work as hyperlink, I set it font as below, but can't find any cursor property, is it possible?

Private Sub RadDataLayout1_ItemInitialized(sender As Object, e As Telerik.WinControls.UI.DataLayoutItemInitializedEventArgs)

            Dim ci As DataLayoutControlItem = e.Item
            e.Item.Font = New System.Drawing.Font(e.Item.Font.Name, e.Item.Font.Size, FontStyle.Underline)

end sub

Thanks

Alex

Alex Dybenko
Top achievements
Rank 2
 answered on 19 Feb 2020
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?