Telerik Forums
UI for WPF Forum
1 answer
640 views

So, I went out and specifically bought Telerik UI for WPF because we needed a good PDF Viewer.

My structure is rather simple

WPF:

<Window
        xmlns:local="clr-namespace:Catalogo"
        xmlns:controls="clr-namespace:Controls;assembly=Controls"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="Catalogo.Catalogos"
        mc:Ignorable="d"
        Title="Catalogo" WindowStartupLocation="CenterScreen" SnapsToDevicePixels="False"
        VisualEdgeMode="Aliased"
        ResizeMode="NoResize"
        Height="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}"
        Width="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}" WindowStyle="None"
        Loaded="Window_Loaded" Background="{DynamicResource primary_dark}">
    <Window.Resources>
        <ResourceDictionary Source="/Styles;component/Merged.xaml"/>
    </Window.Resources>
    <Grid>
        <telerik:RadBook RightPageIndex="1" BorderBrush="Transparent" >
            <telerik:RadBookItem Width="960" Height="1060" >
                <Grid>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <telerik:RadPdfViewerToolBar RadPdfViewer="{Binding ElementName=pdfViewerIzq, Mode=OneTime}"/>
                        <telerik:RadPdfViewer x:Name="pdfViewerIzq" DataContext="{Binding CommandDescriptors, ElementName=pdfViewerIzq}" Grid.Row="1"/>
                    </Grid>
 
                </Grid>
            </telerik:RadBookItem>
            <telerik:RadBookItem  Width="960" Height="1060">
 
                <Grid>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <telerik:RadPdfViewerToolBar Name="barraDer" RadPdfViewer="{Binding ElementName=pdfViewerDer, Mode=OneTime}"/>
                        <telerik:RadPdfViewer x:Name="pdfViewerDer" DataContext="{Binding CommandDescriptors, ElementName=pdfViewerDer}" Grid.Row="1"/>
                    </Grid>
 
                </Grid>
            </telerik:RadBookItem>
        </telerik:RadBook>
    </Grid>
</Window>

 

Then I have two methods for setting the source for the left and right viewers:

public void setPageIzq(string ruta)
        {
            pdfViewerIzq.DocumentSource = new PdfDocumentSource(new System.Uri(ruta));
            pdfViewerIzq.FitToPage();
            pdfViewerIzq.Mode = Telerik.Windows.Documents.Fixed.UI.FixedDocumentViewerMode.TextSelection;
            pdfViewerIzq.CommandDescriptors.FitToPageFixedDocumentSinglePageViewPresenterCommandDescriptor.IsEnabled = true;
            pdfViewerIzq.CommandDescriptors.FitToPageFixedDocumentSinglePageViewPresenterCommandDescriptor.Command.Execute(null);
            pdfViewerIzq.ScaleMode = Telerik.Windows.Documents.Fixed.UI.ScaleMode.FitToPage;
        }
 
        public void setPageDer(string ruta)
        {
            pdfViewerDer.DocumentSource = new PdfDocumentSource(new System.Uri(ruta));
            pdfViewerIzq.CommandDescriptors.FitToPageCommandDescriptor.IsEnabled = true;
            pdfViewerIzq.CommandDescriptors.FitToPageCommandDescriptor.Command.Execute(null);
        }

 

 

As you can see, I tried a bunch of different ways to set the viewer to fit to page. If I use the navbar up top, I can make it fit to page, but none of the methods I tried worked for my manual setting.

 

I had to take this approach because we need to display the document two pages at a time, any good ideas?

Anna
Telerik team
 answered on 07 Sep 2018
1 answer
89 views
Hi

I want to use the arrows of the RootCompass to insert a new RadPaneGroup to an existing RadSplitContainer – instead of docking the dragged pane.

Is it possible to conditionally cancel the docking and insert the panes manually?

/Flemming Rosenbrandt
Kalin
Telerik team
 answered on 07 Sep 2018
7 answers
2.0K+ views

Hello,

  I am using the PDFViewer control and my intent is to show a PDF (prior to writing to disk), the issue I am having is that once the PDF attempts to load into the PDF Viewer it is incredibly slow.  The PDF is larger in size (roughly 167+ pages) but that is not uncommon for the average pdf we are generating.  My question is, is there anyway to optimize loading information into this control to make PDF's not take an upward of 10-15 minutes to load?

Code Example:

private void LoadPdfToView()
{
  try
  {
     //Create a memory stream we will use to hold our PDF
     MemoryStream DocumentStream = new MemoryStream();
     //A 3rd party control that creates the PDF document (this save feature can save to memory stream or to disk)
     TheDoc.Save(DocumentStream);
     //Create the Fixed document based on the PDF document in memory
     RadFixedDocument document = new PdfFormatProvider DocumentStream, FormatProviderSettings.ReadOnDemand ).Import();
     //Load the pdf document into our control
     pdfViewer.Document = document;
   }
   catch (Exception ex)
   {
     MessageBox.Show("Error Loading PDF to view: " + ex.Message);
   }
}

Tanya
Telerik team
 answered on 07 Sep 2018
1 answer
109 views

I've looked quite extensively for this in the grid control, but I'll ask before I request the enhancement.

We are using the RadGridView quite extensively, and we have one major UI problem with it.  The issue has two parts:

  1. When a row is selected, hovering over it makes no visible difference.
  2. When a row is in error, it is impossible to tell whether the row is also selected and/or being hovered over.

These may seem minor, but they are a growing annoyance to our users, especially since error conditions and multi-row-select are common in their use case.

Is it possible for me to work around this without extracting a large chunk of template and changing it? (That's the only option I've come up with so far.)  If so, how?  If not, how can I add this as a feature request for Telerik?

 

Thanks!

Brad.

Stefan
Telerik team
 answered on 07 Sep 2018
1 answer
232 views

Hi,
I use the Wizard in a MVVM Based App.

I have a WizardControlView and a WizardControlViewModel.

<telerik:RadWizard x:Name="wizard"                           
                               HorizontalAlignment="Left"
                               Height="300"
                               VerticalAlignment="Top"
                               Width="500"                           
                               IsContentPreserved="True"
                               localControlsBindings:RadWizardPageBinding.ItemSource ="{Binding WizardPages}">       
</telerik:RadWizard>

Inside the WizardPages are no footer with buttons defined.
I use the default footer.

No I can see the buttons in the footer.
When I click e.g. the Cancel Button I want to react inside the WizardControlViewModel and not in the WizardControlView (according MVVM).

Is it possible ?

Regards
Stefan

Stefan
Top achievements
Rank 1
 answered on 07 Sep 2018
1 answer
83 views
Hi

Is it possible to insert a separator between the RadPane headers in a RadPaneGroup?

/Flemming Rosenbrandt
Stefan
Telerik team
 answered on 07 Sep 2018
1 answer
427 views

Hi, I have a chart that display gridlines using the cartesianchartgrid, defined like this in xaml:

<telerik:RadCartesianChart.Grid>
    <telerik:CartesianChartGrid MajorLinesVisibility="XY"/>
</telerik:RadCartesianChart.Grid>

 

But I can't figure out how to change the color of the gridlines. I don't see any brush or color properties for it on the class, changing the foreground etc brush does not work.

Kalin
Telerik team
 answered on 07 Sep 2018
0 answers
115 views

I have a and that are synced. When one or more appointments are selected in the , it updates the above by adding tasks (only the root task) to the source of the only if those tasks are not already in the list else the list is left as is. 

Now sometimes when I am selecting multiple appointments the bindings on the Textblock display incorrectly in the Ganttview as seen in the before and after pics. It's the correct object behind the display UI element, only its binding seems to be boggled up for some reason. Sometimes when selecting another appointment, the UI updates correctly but most of the time it doesn't.

I modified the event container -  

<ControlTemplate  x:Key="EventContainerTemplate2" TargetType="telerik:EventContainer">

- that I found in Telerik's dictionaries and added the following in order to display the text on the bars:

<TextBlock x:Name="txtBlock" Padding="5"
   Text="{Binding DataItem.Title}"
   FontSize="{Binding DataItem.Appearance.FontSize}"
   FontWeight="{Binding DataItem.Appearance.FontWeight, Converter={StaticResource ConvertStringToFontWeight}}"
   Foreground="{Binding DataItem.Appearance.HexForeground, Converter={StaticResource ConvertHexToBrush}}"/>

DataItem is a GanttTask that implements the IGanttTask interface.

 

Here is the code that executes when appointments are selected (on selection changed event) in the ScheduleView:

private void scheduleView_AppointmentSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    if (vm != null && vm.SelectedAppointment != null && ViewMode == "Resource")
    {
        vm.GanttTaskList = new ObservableCollection<GanttTask>();
        List<string> ids = new List<string>();
        foreach(object o in this.scheduleView.SelectedAppointments)
        {
            AppointmentTask app = o as AppointmentTask;
            IPlanTask task = app.UnderlyingTask.RootParent;
            if(!ids.Contains(task.IPlanTaskID))
            {
                vm.GanttTaskList.Add(new GanttTask { UnderlyingTask = task });
                ids.Add(task.IPlanTaskID);
            }
        }
        
        this.ganttView.TasksSource = vm.GanttTaskList;
        vm.RaisePropertyChanged(nameof(vm.GanttTaskList));
    }
}
Natasha
Top achievements
Rank 1
 asked on 06 Sep 2018
1 answer
146 views

How do I hide the Time Ruler above the ScheduleView i.e. the TimeRulerItem and TimeRulerGroupItem? 

 

I have tried the following:

<scheduleView:TimeRulerItemTemplateSelector x:Key="TimeRulerItemTemplateSelector">
    <scheduleView:TimeRulerItemTemplateSelector.HorizontalTimelineMajorItemTemplate>
        <DataTemplate>
            <WrapPanel Background="{StaticResource Palette_7}">
                <TextBlock Padding="5" Text="{Binding FormattedValue}"
                        Foreground="{StaticResource White_Colour}"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        FontSize="11"/>
            </WrapPanel>
        </DataTemplate>
    </scheduleView:TimeRulerItemTemplateSelector.HorizontalTimelineMajorItemTemplate>
    <scheduleView:TimeRulerItemTemplateSelector.HorizontalTimelineMinorItemTemplate>
        <DataTemplate>
            <WrapPanel Background="{StaticResource Palette_7}">
                <!--<TextBlock Padding="5" Text="{Binding FormattedValue}"
                        Foreground="{StaticResource White_Colour}"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        FontSize="11"/>-->
            </WrapPanel>
        </DataTemplate>
    </scheduleView:TimeRulerItemTemplateSelector.HorizontalTimelineMinorItemTemplate>
    <scheduleView:TimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>
        <DataTemplate>
            <WrapPanel Background="{StaticResource Palette_2}">
                <TextBlock Padding="5" Text="{Binding FormattedValue}"
                        Foreground="{StaticResource White_Colour}"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        FontSize="14"
                        MinWidth="50"/>
            </WrapPanel>
        </DataTemplate>
    </scheduleView:TimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>
</scheduleView:TimeRulerItemTemplateSelector>
<Style TargetType="scheduleView:TimeRulerGroupItem" x:Key="TimeRulerGroupItemStyle">
 <Setter Property="Visibility" Value="Collapsed"></Setter>
</Style>
<Style TargetType="scheduleView:TimeRulerItem" x:Key="TimeRulerItemHide">
 <Setter Property="Visibility" Value="Collapsed"></Setter>
</Style>
<scheduleView:OrientedTimeRulerItemStyleSelector
 HorizontalGroupItemStyle="{StaticResource TimeRulerGroupItemStyle}"
 MajorHorizontalTickStyle="{StaticResource TimeRulerItemHide}"
 MinorHorizontalTickStyle="{StaticResource TimeRulerItemHide}"
 x:Key="TimeRulerItemStyleSelector">
</scheduleView:OrientedTimeRulerItemStyleSelector>
<telerik:RadScheduleView 
   TimeRulerItemTemplateSelector="{StaticResource TimeRulerItemTemplateSelector}"
   TimeRulerItemStyleSelector="{StaticResource TimeRulerItemStyleSelector}"
</telerik:RadScheduleView>

 

But it causes incredibly weird behavior that has left me stumped. When I scroll it shows the time ruler but only half rendered and it only seems to apply the rule to some of the items. See the attached picture to see what I mean.

Natasha
Top achievements
Rank 1
 answered on 06 Sep 2018
1 answer
161 views
I found an intriguing problem in my WPF application. I'm using the AssemblyResolve feature to manage dependencies on Telerik DLLs. So far everything works normally. Telerik.Windows. * DLLs, when prompted, are loaded and returned by the AssemblyResolve event. I noticed that in some situations, the requested name is terminated by ".resources". In this case the event returns null (procedure I checked on some forums).

The RadRichTextbox component is instantiated and loaded normally in my application. But I noticed that some functions do not work. For example the context menu on the document does not appear when triggered by the right mouse button. By performing some tests I found that when I put the Telerik.Windows.Controls.RichTextBoxUI.dll DLL in the same folder as my EXE, everything works perfectly. The context menu appears as expected.

Because the Telerik components use many dependencies, I would very much like to make them available in a specific directory. What am I doing wrong in my AssemblyResolve event? The procedure to return null when the event is triggered with the name ".resources" is correct?
Tanya
Telerik team
 answered on 06 Sep 2018
Narrow your results
Selected tags
Tags
+? 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?