Telerik Forums
UI for WPF Forum
19 answers
1.1K+ views

Hello admins.

I have a problem with RadPdfViewer.

normal case is good.

--MainWindow.cs------------------------------------------

    public partial class MainWindow : Window
    {
        string pdfFilePath = @"C:\Temp\PDFs\20170707 learnwpf.pdf";

        public MainWindow()
        {
            InitializeComponent();
            
            this.pdfViewer.DocumentSource = new PdfDocumentSource(new System.Uri(pdfFilePath, System.UriKind.RelativeOrAbsolute));
        }
    }

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

 

But, in MvvM not working.

--MainWindow.xaml------------------------------------

<Window x:Class="TelerikWpfPDFViewerBinding.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <telerik:RadPdfViewerToolBar RadPdfViewer="{Binding ElementName=pdfViewer, Mode=OneTime}" SignaturePanel="{Binding ElementName=signaturePanel, Mode=OneTime}"/>
            <telerik:SignaturePanel x:Name="signaturePanel" PdfViewer="{Binding ElementName=pdfViewer, Mode=OneWay}" Grid.Row="1"/>
            <telerik:RadPdfViewer x:Name="pdfViewer" 
                                  DataContext="{Binding CommandDescriptors, ElementName=pdfViewer}" 
                                  telerik:RadPdfViewerAttachedComponents.RegisterSignSignatureDialog="True" 
                                  telerik:RadPdfViewerAttachedComponents.RegisterFindDialog="True" 
                                  Grid.Row="2" 
                                  telerik:RadPdfViewerAttachedComponents.RegisterSignaturePropertiesDialog="True" 
                                  telerik:RadPdfViewerAttachedComponents.RegisterContextMenu="True"
                                  Document="{Binding PDFDocument,Mode=TwoWay}"/>
        </Grid>

    </Grid>
</Window>

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

--MainWindow.xaml.cs-------------------------------------------------------

namespace TelerikWpfPDFViewerBinding
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = new MainWindowViewModel();
        }
    }
}

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

--MainWindowViewModel.cs-------------------------------------------

using System.IO;

using Telerik.Windows.Controls;

using Telerik.Windows.Documents.Fixed.FormatProviders;
using Telerik.Windows.Documents.Fixed.FormatProviders.Pdf;
using Telerik.Windows.Documents.Fixed.Model;

namespace TelerikWpfPDFViewerBinding
{
    public class MainWindowViewModel: ViewModelBase
    {
        private RadFixedDocument _PDFDocument;
        public RadFixedDocument PDFDocument {
            get { return _PDFDocument; }
            set {
                _PDFDocument = value;
                OnPropertyChanged("PDFDocument");
            }
        }
        public MainWindowViewModel()
        {
            string pdfFilePath = @"C:\Temp\PDFs\20170707 learnwpf.pdf";
            LoadPDFDocument(pdfFilePath);
        }

        private void LoadPDFDocument(string pdfFilePath)
        {
            MemoryStream stream = new MemoryStream();

            using (Stream input = File.OpenRead(pdfFilePath))
            {
                input.CopyTo(stream);
            }

            FormatProviderSettings settings = new FormatProviderSettings(ReadingMode.OnDemand);
            PdfFormatProvider provider = new PdfFormatProvider(stream, settings);
            PDFDocument = provider.Import();
        }

    }
}
----------------------------------------------------------------------------------------------

Where am I wrong?

thanks.

Georgi
Telerik team
 answered on 16 Oct 2019
7 answers
284 views

Hi,

SizeAll cursor(Four headed Sizing Cursor) only appears when we hover the mouse pointer on the sides of RadDiagram shapes .But expectation is , SizeAll Cursor has to enable before the mouse pointer touches the sides of shapes (approximately in 0.5 gap). we would like to show the cursor behavior as like powerPoint.

In powerpoint , we could see SizeAll cursor appears in some distance when we move the mouse pointer closer to the shapes. I have attached screenshot for reference .

We have also tried the solution which is given in previous post, yet couldn’t find a solution to fix this issue. Can you kindly check and let us know a appropriate solution.
Note: Need to implement a cursor behavior out of the RadDiagram Shapes (Distance of 0.5 gap).

Regards,

Jeevitha S.

 

 

Martin Ivanov
Telerik team
 answered on 16 Oct 2019
6 answers
421 views

Hello,

 I was wondering if there is any way to set up a TimeSpanPicker so that negative values can be provided?

I tried setting the "Minimum" option on the components to a negative value, but it seems this isn't respected and the minimum remains at 0.

 Any help would be appreciated

Cheers

Dinko | Tech Support Engineer
Telerik team
 answered on 16 Oct 2019
5 answers
748 views

This seems like an easy one and I'm probably missing something obvious.  If so, I apologize in advance.  But I'm confused how to style the Busy indicator associated with the RadGridView.  If I drop an independent RadGridView on my UI, I can used Blend to create a copy of the template and style it.  But I can't figure out how to bind that with my GridView. 

I included a screenshot that is a composite of 2 screenshots.  The top is GridView.IsBusy = false.  The bottom is GridView.IsBusy = true.  The arrows include the Busy Indicator I'm trying to style.  

 

Scott
Top achievements
Rank 1
 answered on 15 Oct 2019
5 answers
278 views

I am trying to use the RadWindow.Alert() dialog however when I am trying to call it I get an "infinite loop". It seems the code never returns from the Win32 call. It can be seen clearly when the Alert() is executed and "debugger pause" is pressed in Visual Studio. The problem is quiet strange. I checked the demo on two additional computers. It was working with none. All three are using Windows 10. The issue also occurs for Confirm(). Please see the attached project (disguised as a .gif) as a very trivial example.

 

System information:

Visual Studio 2019, Project build with .NET v4.6

Windows 10

Telerik WPF v2019.3 (.NET v4.5) and Telerik WPF v2019.2 (.NET v4.5)

Dilyan Traykov
Telerik team
 answered on 15 Oct 2019
6 answers
166 views

     Hi,

I'm facing an issue with RadCalendar placed inside a RadDocking control. The DisplayDateChanged event is called whenever I dock or undock the calendar from the docking control. I've bound a data refresh command to the said event, but dock/undock causes the command to be fired without being needed.

Here is the Xaml:

<telerik:RadCalendar>

<behaviors:EventTrigger EventName="DisplayDateChanged">
       <behaviors:InvokeCommandAction Command="{Binding Path=RefreshDataCommand}" CommandParameter="{Binding                        ElementName=ctrlCalendarView, Path=DisplayDate}">
</behaviors:InvokeCommandAction>
</telerik:RadCalendar>

RefreshDataCommand is coming from ViewModel.

What the issue is this, please look into the matter.

Thanks.

Vladimir Stoyanov
Telerik team
 answered on 15 Oct 2019
6 answers
290 views

As far as I can tell, MultiColumnComboBox does not have a TextSearchMode or IsSynchronizedWithCurrentItem property like the RadComboBox.  I'm looking to implement the Contains value of TextSearchMode. 

I also want the MultiColumbComboBox to display the current item at startup.  (using only one item at a time)  Is there another way to do these things?  Thanks.

Yoan
Telerik team
 answered on 14 Oct 2019
7 answers
328 views

Hello, I need to convert a RadDiagram to PDF/A-1a. I managed to convert it as an image, but that's not good enough. I need a vector format, because I need the text in the shapes, and my custom templates. Converting to SVG would be good enough, I can try to take it from there.

I saw your sample in http://docs.telerik.com/devtools/wpf/controls/raddiagram/features/html-support, but I need images, and I use custom templates.

I tested the ExportToPdf sample in the SDK, and it looks like a good start. I was thinking of adding image and custom shape support to it, but if it doesn't export to PDF/A-1a in the first place, it's a non starter.

Is there a way to export a RadDiagram to a PDF/A-1a document, even if images and custom shapes aren't supported ?

Martin Ivanov
Telerik team
 answered on 14 Oct 2019
11 answers
2.8K+ views
Hello Telerik,

Any tips on how to enable selection of a GridViewRow from a right mouse click?

There are plenty of examples demostrating how to do this when a ContextMenu is involved, but I do now want a ContextMenu in my case.

Thanks in advance!

Regards,
Roland
Martin Ivanov
Telerik team
 answered on 14 Oct 2019
2 answers
191 views

Hi Gyus,

we have the following scenario:

UI with a RadListBox and a RadScheduleView
The ListBox contains custom business objects

We want to drag and drop these business objects to the ScheduleView.

So we need the following:

A custom DragSourceBehaviour for the RadListBox (checked and works)
A custom DragDropBehaviour for the ScheduleView (checked and works)
So far so good...

But now the problems starts:

We need a custom appointment that implements the only interface IAppointment.
We don't need any further appointment interface like IExtendedAppointment or IObjectGenerator.
But we can't inherit from the Appointment base class, because we already inherit from our own base class.

If we implement the IAppointment interface, the drop on the schedule view doesn't work!
And unfortunately we don't understand why. And believe me, we have tried many variants.

We know all your samples from the sdk and from the forum (for example: WithDB and the example from 2012)
But all these examples don't just implement the IAppointment interface.

And when is the Drop operation completed?
If you drag and drop only inside the ScheduleView there is as DragAndDropCompleted event. 
But, if you drop from another control, there is no completed event!
We have to write the changed data directly into the database. So we need to know when the drop processes are completed.

Can you please tell me the two drag and drop lifecycles (internal drag and drop as well as drop from another control)?

Thank you very much.
 

Markus
Top achievements
Rank 1
Veteran
 answered on 14 Oct 2019
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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?