Telerik Forums
UI for WinForms Forum
4 answers
1.8K+ views

Hi

I'm trying to save and load a RadDock layout to a database field using a MemoryStream but the code fails on loading the layout with error 'System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.'

I have very similar code to save and load layouts for RadDock and it works. Also I can save and load dock layouts if I use xml files but I don't want to use them.

I'm using Progress OpenEdge andthese are code snippets for saving and loading the layout.

METHOD PRIVATE VOID SaveDockLayout( ):
    DEF VAR l_MemoryStream AS System.IO.MemoryStream   NO-UNDO.
    DEF VAR l_UTF8Encoding AS System.Text.UTF8Encoding NO-UNDO.
    DEF VAR lc_char        AS LONGCHAR                 NO-UNDO.

    ASSIGN
        l_MemoryStream = NEW System.IO.MemoryStream()
        l_UTF8Encoding = NEW System.Text.UTF8Encoding()
        .
    radDock1:SaveToXml(l_MemoryStream).
    lc_char = l_UTF8Encoding:GetString(l_MemoryStream:ToArray()).
    COPY-LOB FROM lc_char TO tt_stored_layout.layout.

    l_MemoryStream:Close().
    l_MemoryStream = ?.
    DELETE OBJECT l_MemoryStream NO-ERROR.
    DELETE OBJECT l_UTF8Encoding NO-ERROR.

END METHOD.

METHOD PRIVATE VOID LoadDockLayout( ):
    DEF VAR l_MemoryStream AS System.IO.MemoryStream   NO-UNDO.
    DEF VAR l_UTF8Encoding AS System.Text.UTF8Encoding NO-UNDO.
    DEF VAR lc_char        AS LONGCHAR                 NO-UNDO.

    COPY-LOB FROM tt_stored_layout.layout TO lc_char.

    ASSIGN
        l_UTF8Encoding = NEW System.Text.UTF8Encoding()
        l_MemoryStream = NEW System.IO.MemoryStream(l_UTF8Encoding:GetBytes(lc_char), 0, l_UTF8Encoding:GetByteCount(lc_char))
        .
    radDock1:SuspendLayout().
    radDock1:LoadFromXml(l_MemoryStream).
    radDock1:ResumeLayout().

    l_MemoryStream:Close().
    l_MemoryStream = ?.
    DELETE OBJECT l_MemoryStream NO-ERROR.
    DELETE OBJECT l_UTF8Encoding NO-ERROR.

END METHOD.

Can you help or give me an example of using a method to save and load dock layouts withouth resorting to xml files?

Kind regards

Tung

Tung
Top achievements
Rank 1
 answered on 07 Apr 2017
1 answer
110 views

Hi. I was able to "remove" options and exit buttons which appear at run-time with this code:

this.radRibbonBar1.ExitButton.Visibility = ElementVisibility.Collapsed;
this.radRibbonBar1.OptionsButton.Visibility = ElementVisibility.Collapsed;

 

But how shall i remove this separator line over here which was above options and exit button? 

Hristo
Telerik team
 answered on 07 Apr 2017
2 answers
107 views

Hello

I'm using ThemeResolutionService.LoadPackageFile to load a tssp file and apply the theme for the whole application with ThemeResolutionService.ApplicationThemeName = AppliThemeName;

My RadForm (F1) has MdiChildren detect by a RadDock (RD1).

One of these MdiChildren is an other RadForm (F2) which contains a radDock (RD2) which contains some others RadForm (F3x) added with DockControl method.

The F3x RadForms are not themed.

Is there anything else to do for apply theme in this case?

Infos version:

.Net 4.6.1.

Telerik 2017.1.221.40

Hristo
Telerik team
 answered on 06 Apr 2017
3 answers
254 views
 Is there any direct feature available to resize the columns in grid by hovering over the left/right border of each Column and clicking/dragging to resize the column width or what is the approach to achieve this.
Hristo
Telerik team
 answered on 05 Apr 2017
2 answers
58 views

Hello dear,

I need to know the possibility of enable filtration with some values to show just rows that contain any value from parameters, regards.

Ammar
Top achievements
Rank 1
 answered on 05 Apr 2017
4 answers
256 views
I'm using a negative left margin on my tab items.  This causes the tab items to overlap each other a little.  This works during run time, but not at runtime.  At runtime, the tabs start out with the default spacing until I scroll the tabs.  If there aren't enough tabs to cause the scroller to appear, I have to shrink the form to get the scroller, then scroll the tabs and then resize the form again.

Ideally, the tabs would start out overlapping, but I've been looking for a workaround.  Unfortunately, I can't find one.  I've tried refreshing, repainting, invalidating, etc, etc.  The only way I can find to get the tabs to overlap is to scroll them.

Has anyone tried to overlap tabs?  If so, how do you do it?
Has anyone used negative margins before?  If so, have you seen this problem?
Can anyone think of anything to help me.

Thank you.
Shruti
Top achievements
Rank 1
 answered on 05 Apr 2017
6 answers
954 views
Got a chart and elsewhere user gets to pick a color.  How can I force a particular series to render in the user specified color?

Thanks -
Scott

Hristo
Telerik team
 answered on 03 Apr 2017
1 answer
249 views

I have changed the Label on the Trackball to the data I want to display. In this case it is 4 lines. I would like to change the color of each line of text individually. I can change the color of all of the text in the label, but not on a line by line basis. Here is a snippet of my code:

ChartTrackballController trackBallController = new ChartTrackballController();
trackBallController.TextNeeded += TrackBallController_TextNeeded;
radChartView1.Controllers.Add(trackBallController);

 

private void TrackBallController_TextNeeded(object sender, TextNeededEventArgs e)
{
        CategoricalDataPoint dataPoint1 = e.Points[0].DataPoint as CategoricalDataPoint;
        CategoricalDataPoint dataPoint2 = e.Points[1].DataPoint as CategoricalDataPoint;
        e.Element.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
        e.Element.ForeColor = System.Drawing.Color.Blue;
 
        float difference = Math.Abs((float)dataPoint1.Value - (float)dataPoint2.Value);
 
        e.Text = string.Format("Line1: {0}\nLine2: {1}\nLine3: {2}\nLine4: {3}", dataPoint1.Category, dataPoint1.Value, dataPoint2.Value, difference);           
}
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 03 Apr 2017
1 answer
217 views
I've upgraded multiple machines and installed multiple version of Visual Studio and Telerik Controls to no avail.  The designer is almost completely useless to use. I can't size anything correctly and all controls are very small.  Then when running my application, if I use the GridViewSpreadExport/Renderer, the entire application goes into "TinyFont" mode and nothing is scaled properly.

I've attempted all fixes I can think of, but there is no code that I'm writing that should cause any of this.  I've attached images.  Any help is appreciated.

Tim
-- Below is the code that causes issues with scaling after spreadsheet export:

 private void rbExcel_Click(object sender, EventArgs e)
        {
          
            this.progressBar.Visible = true;
            if (File.Exists(BusinessLogic.MyDocFolder + "MyTimeExport.xlsx"))
            {
                File.Delete(BusinessLogic.MyDocFolder + "MyTimeExport.xlsx");
            }

            var spreadExporter = new GridViewSpreadExport(this.rgvWorkEfforts);
            var exportRenderer = new SpreadExportRenderer();
            spreadExporter.HiddenColumnOption = Telerik.WinControls.UI.Export.HiddenOption.ExportAsHidden;
            spreadExporter.AsyncExportProgressChanged += spreadExporter_AsyncExportProgressChanged;
            spreadExporter.AsyncExportCompleted += spreadExporter_AsyncExportCompleted;
            spreadExporter.RunExportAsync(BusinessLogic.MyDocFolder + "MyTimeExport.xlsx", exportRenderer);

        }
Ralitsa
Telerik team
 answered on 03 Apr 2017
5 answers
172 views

Hello,

probably this will be a really simple and stupid question but nevertheless, I am stuck.

 

This is what I tried to do: We store rtf in a database and are planning to use Telerik controls in the future (there is a lot of impressive software inside).

Importing the rtf-text to RichTextEditor is quite easy. I simply put the content of the database field into a string variable and import it into RichtextEditore with this code:

Private Sub ImportRtf()
        Dim provider As New RtfFormatProvider()
        content = CStr(DataGridView.CurrentRow.Cells(xx).Value)
        Me.RadRichTextEditor1.Document = provider.Import(content)
    End Sub

This works perfectly.

After editing the text in RichTextEditor I need to export the new text as rtf to a string to store it in the database. I looked over the documentation and found this:

Public Function ExportToRtf(ByVal document As RadDocument) As String
        Dim provider As New RtfFormatProvider()
        Return provider.Export(document)
End Function

I tried to assign the function's return value to an another string variable:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim content1 As String = ExportToRtf()
        MsgBox(content1)
End Sub

VisualStudio puts a wiggled blue line under ExportToRtf() and demanded a missing argument for the functions's parameter "document".

Please tell me where my fault is.

Thanks in advance.

P. Arnold

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 03 Apr 2017
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?