Telerik Forums
UI for WPF Forum
2 answers
177 views
I have a DocumentViewer that is displaying XPS content, I also use Telerik's controls for showing a report content. What I am attempting to do is get my XPS and report to have the same look, and I have everything matching except the scroll bars.

I have the style defined of the report as follows

<Style TargetType="telerikReporting:ReportViewer">
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="telerikReporting:ReportViewer">
        <Grid x:Name="LayoutRoot">
          <Border BorderBrush="{StaticResource OuterControlBorderBrush}"
              BorderThickness="1"
              CornerRadius="6">
            <Border
              Margin="0"
              Padding="6"
              Background="{StaticResource ControlBackgroundBrush}"
              BorderBrush="{StaticResource InnerControlBorderBrush}"
              BorderThickness="1"
              CornerRadius="5">
              <Grid>
                <Grid.RowDefinitions>
                  <RowDefinition Height="auto" />
                  <RowDefinition Height="*" />
                  <RowDefinition Height="2" />
                  <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
 
                <!-- Toolbar -->
                <telerik:RadToolBar Grid.Row="0"  >
                  <!-- Cut out to make the post shorter-->
                </telerik:RadToolBar>
 
                <Grid Grid.Row="1" >
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                  </Grid.ColumnDefinitions>
 
                  <!-- Viewer Area -->
                  <Border Grid.Column="2"
                    CornerRadius="4"
                    BorderThickness="1"
                    BorderBrush="{StaticResource OuterViewerAreaBorderBrush}">
                    <Border BorderThickness="1"
                      Margin="0"
                      CornerRadius="3"
                      Background="{StaticResource InnerViewerAreaBackground}"
                      BorderBrush="{StaticResource InnerViewerAreaBorderBrush}">
                      <Grid>
                        <ScrollViewer x:Name="PageScrollViewer"
                          Visibility="Visible"
                          BorderThickness="0"
                          HorizontalScrollBarVisibility="Auto"
                          VerticalScrollBarVisibility="Visible">
                          <telerik:StyleManager.Theme>
                            <telerik:Office_SilverTheme/>
                          </telerik:StyleManager.Theme>
                          <ContentControl x:Name="PageContainer">
                            <ContentControl.Resources>
                              <ControlTemplate x:Key="PrintPreviewTemplate">
                                <Border x:Name="PageBorder"
                                  Background="{StaticResource PageBorderBackground}"
                                  BorderBrush="{StaticResource PageBorderBorderBrush}"
                                  BorderThickness="1"
                                  Margin="10"
                                  VerticalAlignment="Center"
                                  HorizontalAlignment="Center">
                                  <telerik:LayoutTransformControl
                                x:Name="PageContainer"
                                LayoutTransform="{Binding PageTransform}"
                                Content="{Binding PageRoot}" />
                                </Border>
                              </ControlTemplate>
                              <ControlTemplate x:Key="InteractiveTemplate">
                                <ContentPresenter Margin="10"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Top">
                                  <ContentPresenter.Content>
                                    <telerik:LayoutTransformControl
                                    x:Name="PageContainer"
                                    LayoutTransform="{Binding PageTransform}"
                                    Content="{Binding PageRoot}" />
                                  </ContentPresenter.Content>
                                </ContentPresenter>
                              </ControlTemplate>
                            </ContentControl.Resources>
                          </ContentControl>
                        </ScrollViewer>
 
                        <!-- Progress -->
                        <telerikReporting:DialogBox x:Name="ViewerProgressMessage">
                          <!-- Cut out to make the post shorter-->
                        </telerikReporting:DialogBox>
 
                        <!-- Error message -->
                        <TextBox x:Name="ViewerError">
                            <!-- Cut out to make the post shorter-->
                        </TextBox>
 
                        <!-- Export dialog -->
                        <telerikReporting:DialogBox x:Name="ExportDialog">
                          <!-- Cut out to make the post shorter-->
                        </telerikReporting:DialogBox>
                      </Grid>
                    </Border>
                  </Border>
                </Grid>
 
                <!-- Status Area -->
                <Grid  Grid.Row="4">
                  <!-- Cut out to make the post shorter-->
                </Grid>
              </Grid>
            </Border>
          </Border>
        </Grid>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>


I extrated the style of the DocumentViewer using Blend and attempted to override the ScrollViewer's style to use the same theme

<!-- Office_SilverTheme -->
<SolidColorBrush x:Key="OuterControlBorderBrush" Color="#3FFFFFFF" />
<SolidColorBrush x:Key="InnerControlBorderBrush" Color="#FF7E7E95" />
<LinearGradientBrush x:Key="ControlBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
  <GradientStop Color="#FFF0F0F9"/>
  <GradientStop Color="#FF9F9FBB" Offset="0.1"/>
  <GradientStop Color="#FFE1E1EA" Offset="1"/>
</LinearGradientBrush>
 
<SolidColorBrush x:Key="OuterViewerAreaBorderBrush" Color="#66FFFFFF" />
<SolidColorBrush x:Key="InnerViewerAreaBorderBrush" Color="#FF7E7E95" />
<SolidColorBrush x:Key="InnerViewerAreaBackground" Color="White" />
<SolidColorBrush x:Key="ForegroundBrush" Color="Black" />
<SolidColorBrush x:Key="PageBorderBackground" Color="White" />
<SolidColorBrush x:Key="PageBorderBorderBrush" Color="DarkGray" />
<SolidColorBrush x:Key="ErrorMessageForeground" Color="Gray" />
<!-- Office_SilverTheme -->
 
<Style x:Key="TelerikDocumentStyle" BasedOn="{x:Null}" TargetType="{x:Type DocumentViewer}">
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type DocumentViewer}">
        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Focusable="False">
          <Grid Background="{TemplateBinding Background}" KeyboardNavigation.TabNavigation="Local">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="*"/>
              <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <ContentControl Grid.Column="0" Focusable="{TemplateBinding Focusable}" Grid.Row="0" Style="{DynamicResource {ComponentResourceKey ResourceId=PUIDocumentViewerToolBarStyleKey, TypeInTargetAssembly={x:Type Documents:PresentationUIStyleResources}}}" TabIndex="0"/>
            <ScrollViewer x:Name="PART_ContentHost" CanContentScroll="true" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalScrollBarVisibility="Auto" IsTabStop="true" Grid.Row="1" TabIndex="1">
              <telerik:StyleManager.Theme>
                <telerik:Office_SilverTheme/>
              </telerik:StyleManager.Theme>
            </ScrollViewer>
            <DockPanel Grid.Row="1">
              <FrameworkElement DockPanel.Dock="Right" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
              <Rectangle Height="10" Visibility="Visible" VerticalAlignment="top">
                <Rectangle.Fill>
                  <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <LinearGradientBrush.GradientStops>
                      <GradientStopCollection>
                        <GradientStop Color="#66000000" Offset="0"/>
                        <GradientStop Color="Transparent" Offset="1"/>
                      </GradientStopCollection>
                    </LinearGradientBrush.GradientStops>
                  </LinearGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
            </DockPanel>
            <ContentControl x:Name="PART_FindToolBarHost" Grid.Column="0" Focusable="{TemplateBinding Focusable}" Grid.Row="2" TabIndex="2"/>
          </Grid>
        </Border>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>


However when I try it the scroll arrows are missing and the three dashes are missing from the middle of the bars. What do I need to do to correctly style a DocumentViewer to have the same scroll bar style as the Report controll?
Dennis
Top achievements
Rank 1
 answered on 14 Sep 2016
1 answer
179 views
Hi All,

I have a requirement to get the data from telerik radgridview and pass it to view model for manipulation.  The data in the grid may be after filtering/sorting/pagination and I want to get the collection from the grid that is presently in the grid and sent it to delegate command for operation.  I have placed a button to call Approve delegate command and I want to pass the gridview collection to the particular delegate method.

Can any one help me how can I pass filtered grid view collection to view model command?


<Button Height="30" Width="30" Margin="1,0,0,0" ToolTip="Approve" Command="{Binding Approve}" Cursor="Hand"></Button>

<telerik:RadGridView x:Name="GridView">
....
....
</telerik:RadGridView>

<telerik:RadDataPager Margin="5,0,15,0" x:Name="GridviewPager" Source="{Binding Items, ElementName=GridView}" PageSize="33" />

Thanks
Selvakumar R
Selvakumar
Top achievements
Rank 1
 answered on 13 Sep 2016
1 answer
193 views

Hi,

We use the latest telerik wpf version and found RichTextBox performance very bad when it come to the documents that have more than 150 pages(have 50 tables atleast).

We find latency when we type, the letters appear 5 secs after typing. Is there a way to improve this performance ? I have seen many reported performance issue but couldn't find any working solution. Could you help us in this issue please ?

Regards

Anand

Anand
Top achievements
Rank 1
 answered on 13 Sep 2016
7 answers
657 views
Greetings,

I put this RadGridView on my WPF form:

<telerikStyle:RadGridView x:Name="gvOutbox" IsReadOnly="True" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserSortColumns="True"                   
SelectionMode="Extended" telerikStyle:StyleManager.Theme="Office_Blue"/>

This C# code simply loads data from database using Linq to EF:

var db = new MyEntities();
  
var records = from d in db.Records
              select d;
  
gvOutbox.ItemsSource = records;

Everything's fine. Data is loaded into my grid, but one of my database field is of type TEXT and it holds multiline text. Now when I scroll horizontally through columns, GridView changes the height of the rows automatically when the multiline column is visible/invisible.
How can I turn this behavior off? I'd like to see just first line of the multiline text and elipses button in that column and of course I want to have static height of my rows.

Thank you
Dilyan Traykov
Telerik team
 answered on 13 Sep 2016
1 answer
103 views

we have recently updated to the current Telerik version from a 2013 version.  We have the following

 

<telerik:RadPieChart Palette="Windows8" Grid.Column="0" Grid.Row="0" ToolTip="Mill Department">

  <telerik:RadPieChart.Series>

    <telerik:PieSeries ValueBinding="CountOfMachines" ShowLabels="True" ItemsSource="{Binding MachinesUsedYesterByCustomerInMill}" RadiusFactor="0.35">

       <telerik:PieSeries.LabelDefinitions>

          <telerik:ChartSeriesLabelDefinition Binding="Customer" Margin="-8,0,0,0">

               <telerik:ChartSeriesLabelDefinition.Template>

                    <DataTemplate>

                         <StackPanel>

                             <TextBlock Text="{Binding DataItem.Customer}" Margin="0"/>

                       </StackPanel>

                  </DataTemplate>

              </telerik:ChartSeriesLabelDefinition.Template>

          </telerik:ChartSeriesLabelDefinition>

       </telerik:PieSeries.LabelDefinitions>

     </telerik:PieSeries>

   </telerik:RadPieChart.Series>

</telerik:RadPieChart>

 

_______________

Before the upgrade this worked fine, now the chart still comes out, but no labels are on it.  What needs to change to have the labels show up now?

Dinko | Tech Support Engineer
Telerik team
 answered on 13 Sep 2016
18 answers
451 views

Hello,

I want to know the number of filter values in my RadGridView.

I know that gridVariables.FilterDescriptors.Count gives me the value '0' or '1' if a filter value is selected, but, i don't find how i can get the number of selected values in the filter.

 

Thank you.

 

Valentin.

Valentin
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 13 Sep 2016
1 answer
158 views

I am working on a project that takes some basic controls and some telerik wpf controls, places them on a canvas, and saves these for redisplay later. All of the controls are generated at runtime.

Whenever I attempt to save the Xaml of a RadChart, after approximately 30 seconds, the XamlWriter.Save method throws a StackOverflow exception. The problem is reproducible.

Create project referencing the .NET Framework 4.

Telerik.Window.Controls
Telerik.Window.Controls.Chart
Telerik.Window.Controls.Charting
Telerik.Window.Controls.Data
Telerik.Window.Controls.DataVisualization
Telerik.Window.Data

Place the following code on a new window:

<Canvas Name="testCanvas" Height="350" Width="525">
    <telerik:RadChart Name="testChart" Height="350" Width="525"/>
</Canvas>

Place this in code-behind:

public MainWindow()
{
    InitializeComponent();
    this.PreviewMouseDoubleClick += Window_PreviewMouseDoubleClick;
    testCanvas.Loaded += testCanvas_Loaded;
}
private void testCanvas_Loaded(object sender, RoutedEventArgs e)
{
    testChart.DefaultView.ChartLegend.UseAutoGeneratedItems = true;
    Telerik.Windows.Controls.Charting.DataSeries barSeries = new Telerik.Windows.Controls.Charting.DataSeries();
    barSeries.LegendLabel = "Expenses";
    barSeries.Definition = new Telerik.Windows.Controls.Charting.BarSeriesDefinition();
    barSeries.AddRange(new List<Telerik.Windows.Controls.Charting.DataPoint> {
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 45, XCategory = "Jan" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 48, XCategory = "Feb" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 53, XCategory = "Mar" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 41, XCategory = "Apr" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 32, XCategory = "May" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 28, XCategory = "Jun" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 63, XCategory = "Jul" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 74, XCategory = "Aug" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 77, XCategory = "Sep" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 85, XCategory = "Oct" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 89, XCategory = "Nov" },
        new Telerik.Windows.Controls.Charting.DataPoint() { YValue = 80, XCategory = "Dec" }
    });
    testChart.DefaultView.ChartArea.DataSeries.AddRange(new List<Telerik.Windows.Controls.Charting.DataSeries> { barSeries });
}
 
private void Window_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
 
    var fileName = @"c:\temp\tester.xaml";
    using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Read))
    using (var xw = new XmlTextWriter(fs, System.Text.Encoding.UTF8))
    {
        xw.Formatting = Formatting.Indented;
        xw.Indentation = 4;
        xw.IndentChar = ' ';
 
        //place breakpoint here
        XamlWriter.Save(testCanvas, xw);
    }
}

Run project and then double-click the window. At the "XamlWriter.Save(testCanvas, xw)", a stackoverflow exception will eventually occur

Please let me know what I can do to correct this issue.

 

Thanks

Martin Ivanov
Telerik team
 answered on 13 Sep 2016
3 answers
128 views

I am working on a project that takes some basic controls and some telerik wpf controls, places them on a canvas, and saves these for redisplay later. All of the controls are generated at runtime.

One problem I am having is with some of the relative and scale values on all gauge controls that use the Telerik.Windows.Controls.Gauge.GaugeMeasure for storing values. instead of saving the actual value set on the property (such as 0.15*), when I save the Xaml, I get the text "Telerik.Windows.Controls.Gauge.GaugeMeasure" as the property value.

To reproduce, place the following on a wpf window:

<Border Name="meterBorder" BorderThickness="1" BorderBrush="Black" Background="White" Width="80" Height="300" CornerRadius="3">
        <telerik:RadVerticalLinearGauge Padding="5" Background="Transparent" BorderThickness="0" OuterBackground="Transparent" OuterBorderThickness="0" >
            <telerik:VerticalLinearScale Min="0" Max="1" RelativeY="0" RelativeHeight="0.9" VerticalAlignment="Center" Fill="#FF787878" StartWidth="0.015" EndWidth="0.015" MajorTickOffset="0.0" MinorTickOffset="0.0" MiddleTicks="1" MinorTicks="2" MajorTickStep="0.1" MajorTicks="10" LabelFormat="{}{0:F2}" LabelLocation="OverOutside" MajorTickLocation="Outside" Margin="10" FontSize="8" Foreground="Black" MajorTickStrokeThickness="1" MajorTickStroke="Black" MinorTickStrokeThickness="1" MinorTickStroke="Black">
                <telerik:VerticalLinearScale.Indicators>
                    <telerik:BarIndicator Name="valueIndicator" HorizontalAlignment="Left" Margin="-20,0,0,0" Value="0.5" Background="#FF7171FF" StartWidth="0.2" EndWidth="0.2" StrokeThickness="0" Width="13" />
                </telerik:VerticalLinearScale.Indicators>
                <telerik:VerticalLinearScale.Ranges>
                    <telerik:GaugeRange x:Name="LowLowIndicator"  Background="Red" StartWidth="0.05" EndWidth="0.05" Min="0" Max="0.05" IndicatorBackground="{x:Null}" />
                    <telerik:GaugeRange x:Name="LowIndicator" Background="#FFE8FF00" StartWidth="0.05" EndWidth="0.05" Min="0.05" Max="0.15" IndicatorBackground="{x:Null}" />
                    <telerik:GaugeRange x:Name="HighIndicator" Background="#FFE8FF00" StartWidth="0.05" EndWidth="0.05" Min="0.85" Max="0.95" IndicatorBackground="{x:Null}" TickBackground="{x:Null}" StrokeThickness="0" />
                    <telerik:GaugeRange x:Name="HighHighIndicator" Background="Red" StartWidth="0.05" EndWidth="0.05" Min="0.95" Max="1" IndicatorBackground="{x:Null}" />
                </telerik:VerticalLinearScale.Ranges>
            </telerik:VerticalLinearScale>
        </telerik:RadVerticalLinearGauge>
    </Border>

On top of code-behind:

using System.IO;
using System.Xml;
using System.Windows.Markup;

then in window MouseDoubleClick (or some other event) place the following to save the file:

var fileName = @"c:\temp\tester.xaml";
using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Read))
using (var xw = new XmlTextWriter(fs, System.Text.Encoding.UTF8))
{
 xw.Formatting = Formatting.Indented;
 xw.Indentation = 4;
 xw.IndentChar = ' ';
 
 
 XamlWriter.Save(meterBorder, xw);
}

throughout the saved Xaml, there will be numerous Telerik.Windows.Controls.Gauge.GaugeMeasure where values should be. Is this a bug in the Telerik controls, or is there some way for me to properly save the correct values for the telerik controls?

 

Thanks

Thanks

Martin Ivanov
Telerik team
 answered on 13 Sep 2016
3 answers
222 views

Hi,

I'm using: 

<telerikScheduleView:RadScheduleView x:Name="ScheduleView"...

 

and we have the custom localization going for Swedish, but I can't find the resource keys for the individual week days that you can see in Week view mode.

 

               case "Day":
                    return "Day[ENG]";
                case "Week":
                    return "Week[ENG]";
                case "Monday":
                    return "?????";

 

...in the end we need keys for ALL of the text strings, not just the subset as listed in:

http://docs.telerik.com/devtools/wpf/controls/radscheduleview/localization#radscheduleview-resource-keys

 

Thanks,

 

Barry

Yana
Telerik team
 answered on 13 Sep 2016
2 answers
122 views

Hi, i test the sample:

Grouping By TimeMarker in the Sdk. (Trial versione 2016 Q2)

But i have this problem:

1) Run the sample and the scheduler view it's OK (image1)

2) Resize the window and the grid of the scheduler is wrong (image2)

 

Thanks

Aurelio


Aurelio Righetti
Top achievements
Rank 1
 answered on 13 Sep 2016
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
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
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?