Telerik Forums
UI for WPF Forum
3 answers
529 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
103 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
105 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
130 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
3 answers
375 views

I have a web application that is using your Kendo editor.  The HTML output of the Kendo editor is saved in a database and can be opened in another WPF application to be edited in a RadRichTextBox.  The HTML is imported as follows, 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);
}

 

When tables are created in the Kendo editor and imported to the RadRichTextBox, several issues are seen:

  1. Table, row, and cell heights are not maintained.  All rows and cells become the same height.
  2. Cell padding is not correct.  I can see the padding in the imported HTML as <td style="padding:5px;", but after import the padding is changed to padding: 5px 0px 0px 0px; (Padding="0,5,0,0" in the XAML).
  3. Table borders are not visible.  The borders are still in the HTML and can be seen in the Table Borders properties dialog, but are not visible in the editor and seem to not always work correctly if modified in the Table Borders properties dialog.  If cell spacing is added to the table in Kendo, then the borders will display in WPF.  Therefore, it appears as if the outer cell borders are covering the table borders.

Please let me know if there is anything I am missing here that will provide proper display of the tables in the RadRichTextBox.

Thanks!

Georgi
Telerik team
 answered on 03 Jan 2020
2 answers
826 views

Hi,

I'm working with the RadSyntaxEditor (WPF R3 2019) and loving it. It is a great control with lots of potential for our team.

 

The issue I have is simple and I feel silly having to ask something so trivial, but is there a way access the underlying text of the TextDocument? We need it to write to a stream and save the document after editing. I've tried looking in the TextDocument and TextSnapShot objects, iterating all the lines and spans, and calling all their ToString() methods, but nothing seemed to work. Is there a way to access the raw text from the rope, or even the rope itself?

 

Thank you ahead of time for your help,

Happy New Year.

Tim

Tim
Top achievements
Rank 1
 answered on 03 Jan 2020
4 answers
136 views
I was able to bind a model's text and tooltip to the SelectionBoxTemplate. However, sometimes the tooltip is empty and sometimes it is populated.
However, without a datatrigger in place, even on the empty tooltips, I see an empty tooltip window popup which is a bit of annoyance. Any possible way to fix this?
John
Top achievements
Rank 1
 answered on 02 Jan 2020
8 answers
208 views

Hi,

I am trying to drop shape into a container shape, but the shape is not displaying inside the container. Could anyone help me solve it? Here is my code.

 

EventManager.RegisterClassHandler(typeof(RadDiagramContainerShape), RadDiagramShape.DropEvent, new System.Windows.DragEventHandler(OnDrop));

 

 

private void OnDrop(object sender, System.Windows.DragEventArgs e)
        {
            e.Handled = true;
            if ((e.Data as DataObject)?.GetData(typeof(DragObject)) is DragObject dragObject)
            {
                var itemBase = (ActivityBase)Activator.CreateInstance(dragObject.ContentType);
                var p = e.GetPosition(MainDiagram);
                var shape= createDiagramShape(itemBase);
 
                RadDiagramContainerShape target = (sender as RadDiagramContainerShape);
                target.Items.Add(shape);
            }
        }
 
 
private RadDiagramShape createDiagramShape(ActivityBase activity)
        {
            var shape = new RadDiagramShape
            {
                Content = activity,
                BorderThickness = new Thickness(1),
                UseGlidingConnector = true,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                VerticalContentAlignment = VerticalAlignment.Stretch,
                DataContext = activity,
                UseDefaultConnectors = false,
                IsRotationEnabled = false,
                 
                Background = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)),
                GlidingStyle = GlidingStyle.Rectangle
            };
 
            var outconnector = new InOutConnector
            {
                Offset = new Point(1, 0.2),
                Direction = eDirection.drOut,
                Name = "out" + DateTime.Now.Millisecond
            };
            shape.Connectors.Add(outconnector);
 
            var inconnector = new InOutConnector
            {
                Offset = new Point(0, 0.2),
                Direction = eDirection.drIn,
                Name = "in" + DateTime.Now.Millisecond,
            };
            shape.Connectors.Add(inconnector);
            return shape;
        }

 

 

The following function to drop shape inside the diagram works.

private void OnDropShape(object sender, DragEventArgs e)
        {
            e.Handled = true;
            if ((e.Data as DataObject)?.GetData(typeof(DragObject)) is DragObject dragObject)
            {
                var itemBase = (ActivityBase) Activator.CreateInstance(dragObject.ContentType);
                var p = e.GetPosition(MainDiagram);
                var shape = createDiagramShape(itemBase);
 
                MainDiagram.AddShape(shape, MainDiagram.GetTransformedPoint(p));
                _mainViewModel.ShapeCollection = MainDiagram.Shapes;
                _mainViewModel.SelectedActivity = calendar.DataContext as ActivityBase;
                 
            }
        }

 

 

Thanks,

Rahul

Martin Ivanov
Telerik team
 answered on 02 Jan 2020
1 answer
96 views

If there is only one wizardpage in the WizardPages collection, the AllowFinish property is ignored completely and the Finish button is enabled even if set to false directly or using a binding.

 

Using the latest version of UI for WPF.


Martin Ivanov
Telerik team
 answered on 01 Jan 2020
3 answers
332 views

I tried looking at the WPF GridView example for server side paging/sorting/filtering and it failed with an error. However I looked at the code and you are simply using entity framework to do all the work.

Are there any examples where I can use a different ORM like Ormlite? We don't use entity framework and frankly don't want to.

The only other solution for us would be to switch to using something like Kendo because then it is much easier in the web.

Aseman
Top achievements
Rank 1
Veteran
 answered on 01 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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
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
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?