public class ChartPrintBehaviour{ private const double ImageMargin = 100; private const double PageMargin = 10; private readonly RadChart chart; private readonly string header; private readonly bool portrait; public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(ChartPrintBehaviour), new PropertyMetadata(false, IsEnabledChanged)); public static readonly DependencyProperty HeaderProperty = DependencyProperty.RegisterAttached("Header", typeof(string), typeof(ChartPrintBehaviour)); public static readonly DependencyProperty PortraitProperty = DependencyProperty.RegisterAttached("Portrait", typeof(bool), typeof(ChartPrintBehaviour)); public ChartPrintBehaviour(RadChart chart, string header, bool portrait) { this.chart = chart; this.header = header; this.portrait = portrait; } public static void SetIsEnabled(DependencyObject dependencyObject, bool isEnabled) { dependencyObject.SetValue(IsEnabledProperty, isEnabled); } public static bool GetIsEnabled(DependencyObject dependencyObject) { return (bool)dependencyObject.GetValue(IsEnabledProperty); } public static void SetHeader(DependencyObject dependencyObject, string header) { dependencyObject.SetValue(HeaderProperty, header); } public static void SetPortrait(DependencyObject dependencyObject, bool portrait) { dependencyObject.SetValue(PortraitProperty, portrait); } private static void IsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var chart = d as RadChart; if (chart == null) { return; } if (!((bool)e.NewValue)) { return; } var header = d.GetValue(HeaderProperty); var beh = new ChartPrintBehaviour(chart, header == null ? string.Empty : header.ToString(), (bool)d.GetValue(PortraitProperty)); beh.Attach(); } private void Attach() { chart.CommandBindings.Add(new CommandBinding(ApplicationCommands.Print, PrintExecuted, CanPrintExecute)); } private void CanPrintExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = chart != null; } private void PrintExecuted(object sender, ExecutedRoutedEventArgs e) { if (chart == null) { return; } var dlg = new PrintDialog { PrintQueue = LocalPrintServer.GetDefaultPrintQueue() }; dlg.PrintTicket = dlg.PrintQueue.DefaultPrintTicket; if (!portrait) { dlg.PrintTicket.PageOrientation = PageOrientation.Landscape; } if (!dlg.ShowDialog().GetValueOrDefault()) { return; } var doc = new FlowDocument { PageWidth = dlg.PrintableAreaWidth - PageMargin, PageHeight = dlg.PrintableAreaHeight - PageMargin }; FillDocument(doc); var writer = PrintQueue.CreateXpsDocumentWriter(dlg.PrintQueue); writer.Write(((IDocumentPaginatorSource)doc).DocumentPaginator, dlg.PrintTicket); } protected virtual void FillDocument(FlowDocument doc) { var bi = new BitmapImage(); bi.BeginInit(); bi.CacheOption = BitmapCacheOption.OnLoad; var ms = new MemoryStream(); chart.ExportToImage(ms, new PngBitmapEncoder()); bi.StreamSource = ms; bi.EndInit(); var img = new Image { Source = bi, Stretch = Stretch.Uniform, Height = doc.PageHeight - ImageMargin, Width = doc.PageWidth - ImageMargin, VerticalAlignment = VerticalAlignment.Top }; Run headerRun = null; if (!string.IsNullOrEmpty(header)) { headerRun = new Run(header); } var fig = new Figure { VerticalAnchor = FigureVerticalAnchor.ContentTop, HorizontalAnchor = FigureHorizontalAnchor.ContentCenter }; if (headerRun != null) { fig.Blocks.Add(new Paragraph(headerRun) { TextAlignment = TextAlignment.Center }); } var block = new BlockUIContainer(img); fig.Blocks.Add(block); doc.Blocks.Add(new Paragraph(fig)); }} <telerik:RadChart TelerikExtentions:ChartPrintBehaviour.Header="Print Header" TelerikExtentions:ChartPrintBehaviour.IsEnabled="True"> <telerik:ChartArea.ContextMenu> <ContextMenu> <MenuItem Header="Print" Command="Print" /> </ContextMenu></telerik:ChartArea.ContextMenu> Hi, downloaded the latest version of the WPF components (2015.3.1104) a couple of days ago. When I upgraded a project to the latest version, I noticed that styles applied at the Gridview stopped working. The window is just blank and no visual grid at all.
I created a new project from scratch, converted it to Telerik application and created a resource dictionary with a simple style. (Se attached files)
Same problem. No visual grid in window. Am I doing something wrong?
MainWindow.xaml
<telerik:RadGridView Name="testgrid" Style="{StaticResource BaseGrid}"/>
App.xaml
<Application x:Class="WpfApplication3.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication3" StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/System.Windows.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.Input.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.GridView.xaml" />
<ResourceDictionary Source="Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Styles.xaml
<Style x:Key="BaseGrid" TargetType="telerik:RadGridView">
<Setter Property="GridLinesVisibility" Value="Both"/>
<Setter Property="RowIndicatorVisibility" Value="Collapsed"/>
<Setter Property="AutoGenerateColumns" Value="False"/>
</Style>​
Hi,
I'm using Telerik's TreeView, GridView, ListBox, DragDropManager in my project.
I decided to use the "Binaries.NoXaml" dlls because I don't really need all the themes included. I referenced the relevant control dlls + Telerik.Windows.Themes.Windows8.dll just so I can use the styling for the Telerik controls that I do use.
In my app.xaml I added in merged dictionaries the following resource dictionaries:
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
I noticed that "System.Windows.Controls.Button" also get styled with your Windows8 theme!
How can I cancel this behavior and get only the Telerik controls to have the Windows8 theme?
| <telerik:GridViewDataColumn.HeaderCellStyle> |
| <Style TargetType="{x:Type telerik:GridViewHeaderCell}"> |
| <Setter Property="Template"> |
| <Setter.Value> |
| <ControlTemplate TargetType="{x:Type telerik:GridViewHeaderCell}"> |
| <TextBlock Text="{TemplateBinding Content}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="2" /> |
| </ControlTemplate> |
| </Setter.Value> |
| </Setter> |
| </Style> |
| </telerik:GridViewDataColumn.HeaderCellStyle> |
Is there a way to control the Visibility of the individual categorical data points within a BarSeries (or any series), assuming that the series are defined by a ChartSeriesProvider?
I'm essentially looking to toggle the visibility of the various values available in the CategoryPath property of the CategoricalSeriesDescriptor below. The entire XAML for my chart is as follows:
<telerik:RadCartesianChart x:Name="chart" Grid.Column="1" Palette="Windows8">
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:CategoricalAxis/>
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis LabelFormat="P0"/>
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.SeriesProvider>
<telerik:ChartSeriesProvider Source="{Binding ExposureChartData}">
<telerik:ChartSeriesProvider.SeriesDescriptors>
<!--Current Weight Series-->
<telerik:CategoricalSeriesDescriptor ItemsSourcePath="SeriesData" ValuePath="CategoryValue" CategoryPath="CategoryName">
<telerik:CategoricalSeriesDescriptor.Style>
<Style TargetType="telerik:BarSeries">
<Setter Property="CombineMode" Value="Cluster"/>
<Setter Property="ShowLabels" Value="True"/>
<Setter Property="LegendSettings">
<Setter.Value>
<telerik:SeriesLegendSettings Title="{Binding SeriesName}"/>
</Setter.Value>
</Setter>
</Style>
</telerik:CategoricalSeriesDescriptor.Style>
</telerik:CategoricalSeriesDescriptor>
</telerik:ChartSeriesProvider.SeriesDescriptors>
</telerik:ChartSeriesProvider>
</telerik:RadCartesianChart.SeriesProvider>
</telerik:RadCartesianChart>

Hi,
I have the following code:
<telerik:RadGridView ItemsSource="{Binding PagedSource, ElementName=dataPager}" IsReadOnly="True" ShowGroupPanel="False" ShowColumnHeaders="False" RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False" AutoExpandGroups="True"> <telerik:RadGridView.GroupDescriptors>
<telerik:GroupDescriptor Member="OwnerTypeDescription"/>
</telerik:RadGridView.GroupDescriptors></telerik:RadGridView><telerik:RadDataPager x:Name="dataPager" PageSize="{Binding RecordsPerListPage}" Source="{Binding PagedCollection}" DisplayMode="FirstLastPreviousNext" IsTotalItemCountFixed="False"/>The property RecordsPerList page returns 10, however the paging doesn't take this into account and 20+ records are still shown on a single page.
I noticed that this only happens if grouping is set for the gridview. If I remove the GroupDescriptor paging works properly and only 10 records per page are shown.
Any idea why this is happening?
Thanks!
Hello,
I am trying to set up a letterpaper in the RadRichTextbox, however I am not having much success (see code).
RadDocument document = new RadDocument();
Header header = new Header() { Body = document, IsLinkedToPrevious = false };
var section = new Telerik.Windows.Documents.Model.Section();
section.HasDifferentFirstPageHeaderFooter = true;
section.PageSize = PaperTypeConverter.ToSize(PaperTypes.A4);
document.Sections.Add(section);
var paragraph = new Telerik.Windows.Documents.Model.Paragraph();
ImageInline image = new ImageInline(stream);
FloatingImageBlock imageBlock = new FloatingImageBlock();
imageBlock.ImageInline = image;
imageBlock.WrappingStyle = WrappingStyle.BehindText;
paragraph.Inlines.Add(imageBlock);
document.Sections.First().Children.Add(paragraph);
this.TextEditor.UpdateHeader(document.Sections.First(), HeaderFooterType.Default, header);
I am seeing the image in the header with this code, however not filling in the whole page. If I then click in the header and press Enter on the keyboard the full page length image is displayed. With pressing Enter a second time the image dissappears again. In addition I am unsure how I can place a differing image for the follow up pages.
My goal is to acheive the following points in order to be able to use this letterpaper:
- Image fills the page (imagesize = pagesize)
- Image ​on first page is ​differing to the other pages
- Margins of the first page are differing to the other pages
Sincerly
A.Kasar
Hi
i have a treeview control in a wpf form
the user wants to jump and select an item when he presses any letter on the keyboard
so i did just that with the treeView_TextInput event and on capturing text i found the desired item and selected it like this:
treeView.SelectedItem = found;
treeView.BringItemIntoView(found);
treeView.BringIntoView();​
My problem is that after the item is selected, the keyboard navigation will not work from the newly selected item.
as a matter of fact, the navigation will move from the previously selected item that the user selected with the mouse and not from the one the code selected
is that a bug?
thank you
​
Hello,
I'm trying to create a custom SelectionMiniToolbar but I am encountering several issues.
I've tried some examples found here but I still have problems.
First of all I'm unable to remove the Title Bar from the RadRichTextBoxWindow and also I'm unable to position correctly the Window to appear where the default SelectionMiniToolbar would appear.
I would really like to have an example that shows how to declare a custom SelectionMiniToolbar and how to position it correctly as the default toolbar does.
Right now all the code that I have is:
RichTextBoxFormatToolbar.xaml
01.<richTextBoxUI:RadRichTextBoxWindow x:Class="Views.RichTextBoxFormatToolbar"03. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"04. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"05. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"06. xmlns:richTextBoxUI="clr-namespace:Telerik.Windows.Controls.RichTextBoxUI.Dialogs;assembly=Telerik.Windows.Controls.RichTextBoxUI"07. ResizeMode="NoResize" WindowStartupLocation="CenterOwner">08. 09. <StackPanel Orientation="Horizontal">10. 11. <Button>Test</Button>12. 13. </StackPanel>14. 15.</richTextBoxUI:RadRichTextBoxWindow>RichTextBoxFormatToolbar.xaml.cs
01.[CustomSelectionMiniToolBar]02. public partial class RichTextBoxFormatToolbar : RadRichTextBoxWindow, ISelectionMiniToolBar03. {04. public RichTextBoxFormatToolbar()05. : base()06. {07. InitializeComponent();08. }09. 10. public void Hide()11. {12. Owner = null;13. Close();14. }15. 16. public void SetOpacity(double opacity)17. {18. Opacity = opacity;19. }20. 21. public void Show(Point location, RadRichTextBox radRichTextBox)22. {23. SetOwner(radRichTextBox);24. Show();25. }26. }
Thanks a lot for the help