Telerik Forums
UI for WPF Forum
5 answers
496 views

I am importing some HTML to RadRichTextBox using HTMLFormatProvider Import.  Some of the font-family values are changing to Arial when viewing the export of HTML or XAML.

This is the import code, where editor is a RadRichTextBox:

private void ImportHtml(string HTML)
{
    HtmlFormatProvider _provider = new HtmlFormatProvider();
    HtmlImportSettings settings = new HtmlImportSettings();
  
    _provider.ImportSettings = settings;
    settings.UseDefaultStylesheetForFontProperties = true;
   editor.Document = _provider.Import(HTML);
}

 

This is the HTML being imported:

<p>
  <span style="font-family:Arial;">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span>
</p>
<p>
  <span style="font-family:Helvetica;">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span>
</p>
<p>
  <span style="font-family:TimesNewRoman;">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span>
</p>
<p>
  <span style="font-family:Verdana;">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span>
</p>

 

This is the HTML after import (exported using HTMLFormatProvider).  Notice that Verdana remains the same, but Helvetica and Times New Romans are changed to Arial in the class s_51202CB4:

"<style type=\"text/css\">\r\np { margin-top: 0px;margin-bottom: 0px;line-height: 1.15; } \r\nbody { font-family: 'Verdana'; } \r\n.Normal { telerik-style-type: paragraph;telerik-style-name: Normal;border-collapse: collapse; } \r\n.TableNormal { telerik-style-type: table;telerik-style-name: TableNormal;font-family: 'Verdana';margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;text-indent: 0px;line-height: 1.15;text-align: left;border-left: 0px none #000000;border-top: 0px none #000000;border-right: 0px none #000000;border-bottom: 0px none #000000;border-collapse: collapse; } \r\n.NormalWeb { telerik-style-type: paragraph;telerik-style-name: NormalWeb;margin-top: 0px;margin-bottom: 0px;border-collapse: collapse; } \r\n.s_51202CB4 { telerik-style-type: local;font-family: 'Arial'; } \r\n.s_DF7D34AD { telerik-style-type: local;font-family: 'Verdana'; } </style><p class=\"NormalWeb \"><span class=\"s_51202CB4\">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span></p><p class=\"NormalWeb \"><span class=\"s_51202CB4\">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span></p><p class=\"NormalWeb \"><span class=\"s_51202CB4\">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span></p><p class=\"NormalWeb \"><span class=\"s_DF7D34AD\">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span></p>"

 

This is the XAML:

"<t:RadDocument xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:t=\"clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents\" xmlns:s=\"clr-namespace:Telerik.Windows.Documents.Model.Styles;assembly=Telerik.Windows.Documents\" xmlns:r=\"clr-namespace:Telerik.Windows.Documents.Model.Revisions;assembly=Telerik.Windows.Documents\" xmlns:n=\"clr-namespace:Telerik.Windows.Documents.Model.Notes;assembly=Telerik.Windows.Documents\" xmlns:th=\"clr-namespace:Telerik.Windows.Documents.Model.Themes;assembly=Telerik.Windows.Documents\" version=\"1.4\" LayoutMode=\"Flow\" LineSpacing=\"1.15\" LineSpacingType=\"Auto\" ParagraphDefaultSpacingAfter=\"0\" ParagraphDefaultSpacingBefore=\"0\" StyleName=\"defaultDocumentStyle\">\r\n  <t:RadDocument.Captions>\r\n    <t:CaptionDefinition IsDefault=\"True\" IsLinkedToHeading=\"False\" Label=\"Figure\" LinkedHeadingLevel=\"0\" NumberingFormat=\"Arabic\" SeparatorType=\"Hyphen\" />\r\n    <t:CaptionDefinition IsDefault=\"True\" IsLinkedToHeading=\"False\" Label=\"Table\" LinkedHeadingLevel=\"0\" NumberingFormat=\"Arabic\" SeparatorType=\"Hyphen\" />\r\n  </t:RadDocument.Captions>\r\n  <t:RadDocument.ProtectionSettings>\r\n    <t:DocumentProtectionSettings EnableDocumentProtection=\"False\" Enforce=\"False\" HashingAlgorithm=\"None\" HashingSpinCount=\"0\" ProtectionMode=\"ReadOnly\" />\r\n  </t:RadDocument.ProtectionSettings>\r\n  <t:RadDocument.Styles>\r\n    <s:StyleDefinition DisplayName=\"defaultDocumentStyle\" IsCustom=\"False\" IsDefault=\"False\" IsPrimary=\"True\" Name=\"defaultDocumentStyle\" Type=\"Default\">\r\n      <s:StyleDefinition.ParagraphStyle>\r\n        <s:ParagraphProperties LineSpacing=\"1.15\" />\r\n      </s:StyleDefinition.ParagraphStyle>\r\n      <s:StyleDefinition.SpanStyle>\r\n        <s:SpanProperties FontFamily=\"Verdana\" FontSize=\"16\" FontStyle=\"Normal\" FontWeight=\"Normal\" ForeColor=\"#FF000000\" />\r\n      </s:StyleDefinition.SpanStyle>\r\n    </s:StyleDefinition>\r\n    <s:StyleDefinition DisplayName=\"Normal\" IsCustom=\"False\" IsDefault=\"True\" IsPrimary=\"True\" Name=\"Normal\" Type=\"Paragraph\" UIPriority=\"0\" />\r\n    <s:StyleDefinition DisplayName=\"Normal (Web)\" IsCustom=\"False\" IsDefault=\"False\" IsPrimary=\"False\" Name=\"NormalWeb\" Type=\"Paragraph\" UIPriority=\"99\">\r\n      <s:StyleDefinition.ParagraphStyle>\r\n        <s:ParagraphProperties AutomaticSpacingAfter=\"True\" AutomaticSpacingBefore=\"True\" SpacingAfter=\"0\" SpacingBefore=\"0\" />\r\n      </s:StyleDefinition.ParagraphStyle>\r\n    </s:StyleDefinition>\r\n    <s:StyleDefinition DisplayName=\"Table Normal\" IsCustom=\"False\" IsDefault=\"True\" IsPrimary=\"False\" Name=\"TableNormal\" Type=\"Table\" UIPriority=\"59\" />\r\n  </t:RadDocument.Styles>\r\n  <t:Section>\r\n    <t:Paragraph StyleName=\"NormalWeb\">\r\n      <t:Span FontFamily=\"Arial\" Text=\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" />\r\n    </t:Paragraph>\r\n    <t:Paragraph StyleName=\"NormalWeb\">\r\n      <t:Span FontFamily=\"Arial\" Text=\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" />\r\n    </t:Paragraph>\r\n    <t:Paragraph StyleName=\"NormalWeb\">\r\n      <t:Span FontFamily=\"Arial\" Text=\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" />\r\n    </t:Paragraph>\r\n    <t:Paragraph StyleName=\"NormalWeb\">\r\n      <t:Span FontFamily=\"Verdana\" Text=\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" />\r\n    </t:Paragraph>\r\n  </t:Section>\r\n</t:RadDocument>"

 

Please let me know if I am missing something here to maintain the correct font families.

Martin
Telerik team
 answered on 09 Jan 2020
1 answer
146 views

Hi,

In my application, I am using SplineSeries in RadCartesianChart.

I am using CategoricalAxis as horizontal axis.

I want to use CategoricalAxis as vertical axis as well.

How can I achieve the same?

Dinko | Tech Support Engineer
Telerik team
 answered on 09 Jan 2020
4 answers
279 views

Are there plans to support DataFrame as DataSource in your controls?

eg. to bind the DataGrid's ItemsSource with a DataFrame

 

https://devblogs.microsoft.com/dotnet/an-introduction-to-dataframe/

Dilyan Traykov
Telerik team
 answered on 09 Jan 2020
2 answers
92 views

If I have  a small range the gauge creates duplicate labels (see attachment) note that -1, 0, 2, and 3 are on the gauge twice and  1 is there 3 times. Is there a way to not allow this to happen or make them show numbers after the decimal ex 1.5 1.75 ect...? It is using whatever the default is for tick intervals as I have not set them. 

 

Thanks!

Dinko | Tech Support Engineer
Telerik team
 answered on 09 Jan 2020
1 answer
126 views

Hi,
I am using MultipleRowsAndColumnsPanel in my application. 
I am facing some issues with it:
1. Scrolling behaviour is not working
2. When I add new tile in the view, it is not visualized. when I restart the application, all the tiles are visible as expected.
when I call base.MeasureOverride(availableSize) and base.ArrangeOverride(finalSize) methods in my overriden methods, all the newly added tiles display at position 0.

expected behaviour:
1. scrolling behaviour should work on when tiles goes out of view.
2. newly added tile should display on the view at the next position(1st position after last tile view item).

(MultipleRowsAndColumnsPanel  is copied from https://github.com/telerik/xaml-sdk/tree/master/TileView/RestoredTilesToSpanMultipleRowsAndColumns)

Dinko | Tech Support Engineer
Telerik team
 answered on 08 Jan 2020
3 answers
270 views

Hello,

    I am trying to create view containing collection of items with with specified Row, RowSpan, Coulumn and ColumnSpan properties in RadTileView. So far I've created VM ParamsEditionViewModel containing observable collection of BindableProfileData, which wraps 

public class BindableProfileData : BindableBase
    {
        
        private ProfileItem _profileModel;
        private BindableDPDataItem _dataModel;
 
        public int Row
        {
            get { return _profileModel.DrawingSettings.Row; }
        }
 
        public int Column
        {
            get
            {
                return _profileModel.DrawingSettings.Column;
            }
        }
         
        public int RowSpan
        {
            get { return _profileModel.DrawingSettings.RowSpan; }
        }
 
         
 
        public int ColumnSpan
        {
            get { return _profileModel.DrawingSettings.ColumnSpan; }
        }
}

 

To make possible settings custom tiles size I used MultipleRowsAndColumnsPanel provided by You in one of RadGridView developers examples (link).

Whole view looks like this:

<Grid>
      <FrameworkElement.Resources>
            <DataTemplate x:Key="ItemTemplate" >
                <TextBlock Text="{Binding Name}" />
            </DataTemplate>
 
            <DataTemplate x:Key="ContentTemplate">
                <StackPanel>
                    <TextBlock Text="{Binding Row, StringFormat='Row: {0}'}"/>
                    <TextBlock Text="{Binding Column, StringFormat='Column: {0}'}"/>
                    <TextBlock Text="{Binding RowSpan, StringFormat='RowSpan: {0}'}"/>
                    <TextBlock Text="{Binding ColumnSpan, StringFormat='ColumnSpan: {0}'}"/>
                </StackPanel>
            </DataTemplate>
        </FrameworkElement.Resources>
        <Grid>
            <telerik:RadTileView x:Name="xTileView"
                             ItemTemplate="{StaticResource ItemTemplate}"
                             ContentTemplate="{StaticResource ContentTemplate}"
                             ItemsSource="{Binding SelectedCategory}"
                             IsAutoScrollingEnabled="True"
                             ColumnWidth="500"
                             RowHeight="300">
 
                <telerik:RadTileView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <controlls:MultipleRowsAndColumnsPanel RowsCount="4" ColumnsCount="3"/>
                    </ItemsPanelTemplate>
                </telerik:RadTileView.ItemsPanel>
                <telerik:RadTileView.ItemContainerStyle>
                    <Style TargetType="telerik:RadTileViewItem">
                        <Setter Property="controlls:TileViewAttachedProperties.Row" Value="{Binding Row}"/>
                        <Setter Property="controlls:TileViewAttachedProperties.Column" Value="{Binding Column}"/>
                        <Setter Property="controlls:TileViewAttachedProperties.RowSpan" Value="{Binding RowSpan}"/>
                        <Setter Property="controlls:TileViewAttachedProperties.ColumnSpan" Value="{Binding ColumnSpan}"/>
                    </Style>
                </telerik:RadTileView.ItemContainerStyle>
            </telerik:RadTileView>
        </Grid>
    </Grid>

 

The problem is that the view don't appears when I load collection to VM after button click. When I remove this block 

<telerik:RadTileView.ItemsPanel>
        <ItemsPanelTemplate>
             <controlls:MultipleRowsAndColumnsPanel RowsCount="4" ColumnsCount="3"/>
        </ItemsPanelTemplate>
</telerik:RadTileView.ItemsPanel>

The view appears but of course not if a expected format. When I paste ItemsPanel block when app is running with (Edit and Continue mode in VS), view looks just how it should be. So I have two questions. How to fix this issue and second how can I uprgrade view to load different data templates if VM observable collection contains different objects inheritating from base BindableProfileData.

Dinko | Tech Support Engineer
Telerik team
 answered on 08 Jan 2020
3 answers
547 views

I'm trying to use RadPdfViewer in my WPF app but it seems unwieldy.  I am wondering if I misunderstand it.

With the normal WPF DocumentViewer and FixedDocument, I can lay out a page in XAML just as I want it and then just add that the the FixedDocument.  Can I do this with RadPdfViewer?   

Every example I see (in the PdfProcessing examples) has the user creating text blocks, tables and annotations in code-behind and then individually adding them to RadFixedPages.  That completely defeats the purpose of using WPF in the first place.  I don't want to lay out a report in code-behind.  I want to lay out out a XAML page and add it to the report.

But since this stuff comes with your UI for WPF, I assume I must be missing something fundamental.

To be explicit, here is what I do right now when the user tries to generate a report. 

  • I start off with a view model "PageVm"
  • The main report is laid out in ReportView.xaml .
  • I've already laid out my report pages with ReportPageView.xaml

 

// Code behind of ReportView.xaml.cs
         
private void GenerateViewerDoc(ReportPageVm page,Vm Size pageSize)
{

     // Create the document, PageView

    var doc = new FixedDocument();
    var rc = new ReportPageView { DataContext    = pageVm  };
    doc.DocumentPaginator.PageSize = pageSize;
    var content = new PageContent() { DataContext = pageVm };
 
    var page = new FixedPage  {  DataContext = pageVm };
 
    page.Children.Add(rc);
    ((IAddChild)content).AddChild(page);
    doc.Pages.Add(content);
             
     // Put this new document into the Document Viewer (which is declared in XAML)
     Viewer.Document = doc;
 }

 

Is this possible with Telerik's UI?  How do I do it?

 

Dimitar
Telerik team
 answered on 08 Jan 2020
1 answer
115 views

In the Search Location article, I've successfully tried out both Examples 2 and 3.  Each of them use SearchLocationAsync to make the request and restProvider_SearchLocationCompleted to handle the return.  In my app, I'd like to provide the user with the ability to search by address or location, and to do other things, too, but it looks like there can be only one implementation of restProvider_SearchLocationCompleted.  Of course, each request will need its own handling of the return, so how is that best accomplished?

I noticed that BingRestSearchLocationCompletedEventArgs has a UserData property that's an Object, so I assume the caller can create an object of their own design, populate it as desired and have it returned through this property.  If so, I could include an enum which my handler could use to determine how to process the return, which would solve my need.

The problem I'm having, though, is that I don't know how to send that UserData object along with my request.  There doesn't seem to be a parameter in the BingRestSearchLocation method that would allow me to.

So, I have two questions:

1. Is what I'm suggesting the normal way of handling this?  If not, what is normally done?

2. How does one send UserData in the request, so that it comes through in the completion handler?

Ken
Top achievements
Rank 1
 answered on 07 Jan 2020
3 answers
114 views

I am using the ScheduleView control to build a program that will replace a spreadsheet my coworkers and I currently use to coordinate our field work. Here is a summary of the information for each appointment I want to display:

  • Supervisor initials
  • Which of our crews you are supervising
  • Which shift you are covering (day/night)
  • Shift start
  • Shift end

I am going to have each appointment item be colored by which crew, but I am looking for a custom behavior with how "Shifts" work in the program. The start/stop times of each shift never change. Instead, we work either "Day" or "Night" shift. Because of this, the ScheduleView control will always be in MonthView format.

I am looking for a good way essentially split each day on the MonthView into a "day" and "night" section, whether by a time range (12am-12pm & 12pm-11:59pm), or by some kind of special container that is categorized as "Day" or "Night". Then when we add an assignment inside the "Night" container, or on the night half of the cell, the code would be able to automatically set that record's "Shift" field to "Night", or visa versa for days.

What would be the best way to do this? I have looked at custom containers, but I can't find an example that shows what I am wanting. I have included an image showing what I would want it to look like.

Users will need to be able to drag/drop their assignments around to trade shifts, and users will need to be able to click the "Day" or "Night" containers to add new shift assignments.

I am also open to any suggestions that someone may have on a better way to display this information.

Thank you for any feedback/help!

Dinko | Tech Support Engineer
Telerik team
 answered on 06 Jan 2020
0 answers
133 views

Hi Progress Telerik,

We are using RadAutoCompleteBox for WPF.

Sometimes, while searching with Text, it displays with improper UI.

It is happening very rarely or at least once in a day.

Please find the attachment.

Kindly suggest on this.

 

Below is the code used in xaml:

<tk:RadAutoCompleteBox
                        Name="CountryRadComboBox"
                        Grid.Column="1"
                        VerticalAlignment="Center"
                        DropDownItemTemplate="{StaticResource CountryNameTemplate}"
                        ItemsSource="{Binding CountryList}"
                        SearchText="{Binding CountryTextChanged, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        SelectedItem="{Binding SelectedCountry, Mode=TwoWay, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}"
                        SelectionMode="Single"
                        TextSearchMode="Contains"
                        TextSearchPath="Description">
      <tk:RadAutoCompleteBox.FilteringBehavior>
           <tk:AsyncFilteringBehavior />
      </tk:RadAutoCompleteBox.FilteringBehavior>
</tk:RadAutoCompleteBox>

 

Thanks and Regards,

Muhammad Azhar Shah

Azharshah
Top achievements
Rank 1
 asked on 06 Jan 2020
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?