Telerik Forums
UI for WPF Forum
4 answers
296 views

Hi,

I'm trying to make a bar chart with long text of categories, so I wrapped them all by the following code

 xaml

<Grid SizeChanged="Grid_SizeChanged">
        <telerik:RadCartesianChart Grid.Row="0"
                                   x:Name="ChartSeries"
                                   >
 
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:CategoricalAxis ClipToBounds="False" HorizontalLocation="Right" SmartLabelsMode="SmartStep" IsStepRecalculationOnZoomEnabled="True">
                    <telerik:CategoricalAxis.LabelTemplate>
                        <DataTemplate>
                            <TextBlock TextWrapping="Wrap" MaxWidth="{Binding ElementName=Self, Path=MaxWidthTextBlock}" Text="{Binding}" />
                        </DataTemplate>
                    </telerik:CategoricalAxis.LabelTemplate>
                </telerik:CategoricalAxis>
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis Minimum="0" 
                                    RangeExtendDirection="Positive"
                                    SmartLabelsMode="SmartStep"
                                    >
                </telerik:LinearAxis>
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:BarSeries ShowLabels="False" ClipToPlotArea="False">
                <telerik:BarSeries.DataPoints>
                    <telerik:CategoricalDataPoint Category="TextTextTextTextTextTextText" Value="2" />
                    <telerik:CategoricalDataPoint Category="TextTextTextTextTextTextTextTextText" Value="5" />
                    <telerik:CategoricalDataPoint Category="TextTextTextTextTextTextTextTextTextText" Value="3" />
                    <telerik:CategoricalDataPoint Category="TextTextTextText" Value="10" />
                    <telerik:CategoricalDataPoint Category="TextTextTextTextTextTextTextTextTextTextTextTextText" Value="9" />
                    <telerik:CategoricalDataPoint Category="TextTextTextText" Value="7" />
                    <telerik:CategoricalDataPoint Category="TextTextTextText" Value="1" />
                </telerik:BarSeries.DataPoints>
            </telerik:BarSeries>
            <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid MajorLinesVisibility="Y" x:Name="Line">
                    <telerik:CartesianChartGrid.MajorYLineStyle>
                        <Style TargetType="Line">
                            <Setter Property="Stroke" Value="DarkGray"/>
                        </Style>
                    </telerik:CartesianChartGrid.MajorYLineStyle>
                </telerik:CartesianChartGrid>
            </telerik:RadCartesianChart.Grid>
        </telerik:RadCartesianChart>
    </Grid>

As you can see, I have a method to recalculate the maxwidth of textblock when the container's size is change(Grid) as the following code behind

private void Grid_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if(e.PreviousSize.Width != 0)
            {
                var ratio = e.NewSize.Width / e.PreviousSize.Width;
                MaxWidthTextBlock *= ratio;
            }
        }

The calculation seems to compute correctly for max width of the textblock but the position of the label is not correct. It seems to be a bit right aligned.

Do you have any idea to make it center as before windows size is changed, please advise ?

I also attached the image for before / after windows size change.

Best Regards,
Witt
<Grid SizeChanged="Grid_SizeChanged">
        <telerik:RadCartesianChart Grid.Row="0"
                                   x:Name="ChartSeries"
                                   >
 
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:CategoricalAxis ClipToBounds="False" HorizontalLocation="Right" SmartLabelsMode="SmartStep"IsStepRecalculationOnZoomEnabled="True">
                    <telerik:CategoricalAxis.LabelTemplate>
                        <DataTemplate>
                            <TextBlock TextWrapping="Wrap" MaxWidth="{Binding ElementName=Self, Path=MaxWidthTextBlock}"Text="{Binding}" />
                        </DataTemplate>
                    </telerik:CategoricalAxis.LabelTemplate>
                </telerik:CategoricalAxis>
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis Minimum="0" 
                                    RangeExtendDirection="Positive"
                                    SmartLabelsMode="SmartStep"
                                    >
                </telerik:LinearAxis>
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:BarSeries ShowLabels="False" ClipToPlotArea="False">
                <telerik:BarSeries.DataPoints>
                    <telerik:CategoricalDataPoint Category="TextTextTextTextTextTextText" Value="2" />
                    <telerik:CategoricalDataPoint Category="TextTextTextTextTextTextTextTextText" Value="5" />
                    <telerik:CategoricalDataPoint Category="TextTextTextTextTextTextTextTextTextText" Value="3" />
                    <telerik:CategoricalDataPoint Category="TextTextTextText" Value="10" />
                    <telerik:CategoricalDataPoint Category="TextTextTextTextTextTextTextTextTextTextTextTextText" Value="9"/>
                    <telerik:CategoricalDataPoint Category="TextTextTextText" Value="7" />
                    <telerik:CategoricalDataPoint Category="TextTextTextText" Value="1" />
                </telerik:BarSeries.DataPoints>
            </telerik:BarSeries>
            <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid MajorLinesVisibility="Y" x:Name="Line">
                    <telerik:CartesianChartGrid.MajorYLineStyle>
                        <Style TargetType="Line">
                            <Setter Property="Stroke" Value="DarkGray"/>
                        </Style>
                    </telerik:CartesianChartGrid.MajorYLineStyle>
                </telerik:CartesianChartGrid>
            </telerik:RadCartesianChart.Grid>
        </telerik:RadCartesianChart>
    </Grid>
Peshito
Telerik team
 answered on 05 Jan 2016
8 answers
179 views

I'm running into various issues with buggy behaviour between row and cell selection units.  To start with, when cell is in view mode and SelectionUnit="FullRow", pressing "Enter" keys moves to the cell below ... perfect!  However, if SelectionUnit="Cell" pressing "Enter" does nothing. Is this a known bug?  I wired up a custom keyboard command provider to see what commands are being generated, and sure enough, I see 3 commands queued up: Activate, MoveDown, and Select the current unit. However, they are not actually invoked, or fail at some point, if they are invoked.

This behaves as expected when cell is in edit mode.

Dilyan Traykov
Telerik team
 answered on 04 Jan 2016
1 answer
162 views

Hi There,

 We need to use more than 1,00,000 records for pivot grid in my project. Is there any possible to improve the performance of pivot grid rather than normal mode. If possible please suggest me the way or share me any ug reference link.

 

Kind Regards,

Sabari R

Nasko
Telerik team
 answered on 04 Jan 2016
3 answers
188 views
Hi 
I read This link to create and and use my own shapes in RADDIAGRAM it,s working fine , except the fact that i am not able to connect that shape to any other shape in run time ... Is that default property that custom shapes can not have connectors or i have to some extra work to achieve that ??
Martin Ivanov
Telerik team
 answered on 04 Jan 2016
1 answer
49 views

I have an implicit style for radpanegroup and have three tab items. In Blend, it looks good that all of them are on the same row. But when I run it, each tab item spans a row. 

Thanks.

Nasko
Telerik team
 answered on 04 Jan 2016
3 answers
208 views

my requirement :

I am creating chart to display digital waveform output ( 0,1) for N number of points.I need to highlight only certain points(index).(see attached).

I have done this with the help of Point template  and update done at code behind chart loaded event.This is working perfectly at loading . But after zooming the highlighting point is moved from one point another point and it is not refreshed properly.Please see below code.

Please help to fix this issue...

 

  <Grid><br>        <telerik:RadCartesianChart Height="1" Loaded="RadCartesianChart_Loaded" Palette="Arctic" ZoomChanged="RadCartesianChart_ZoomChanged"><br>            <telerik:RadCartesianChart.HorizontalAxis><br>                <telerik:CategoricalAxis VerticalLocation="Top" Visibility="Visible" LabelFitMode="None" LabelRotationAngle="-90"  /><br>            </telerik:RadCartesianChart.HorizontalAxis><br>            <telerik:RadCartesianChart.VerticalAxis><br>                <telerik:LinearAxis  Minimum="-1" Maximum="2" MajorStep="1"  MajorTickOffset="5" ElementBrush="Orange" /><br>            </telerik:RadCartesianChart.VerticalAxis><br>            <telerik:RadCartesianChart.Series><br>                <telerik:StepLineSeries><br>                    <telerik:StepLineSeries.DataPoints><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="0"/><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="0"/><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="0"/><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="1" /><br>                        <telerik:CategoricalDataPoint Value="0" /><br>                        <telerik:CategoricalDataPoint Value="0"/><br>                        <telerik:CategoricalDataPoint Value="1"/><br>                        <telerik:CategoricalDataPoint Value="0" /><br><br>                    </telerik:StepLineSeries.DataPoints><br><br>                    <telerik:StepLineSeries.PointTemplate><br>                        <DataTemplate ><br>                            <StackPanel><br>                                <!--Fill="{Binding Presenter, Converter={StaticResource SeriesToPaletteColorConverter}}"--><br>                                <Rectangle Height="126"  Width="10"     Stroke="Transparent" Fill="Transparent"  /><br>                            </StackPanel><br>                            <!--<DataTemplate.Triggers><br>                                <DataTrigger  Value="1"  Binding="{Binding Index}" ><br>                                    <Setter Property="Opacity" Value="0.01" /><br>                                </DataTrigger><br>                            </DataTemplate.Triggers>--><br>                        </DataTemplate><br>                    </telerik:StepLineSeries.PointTemplate><br>                </telerik:StepLineSeries><br>            </telerik:RadCartesianChart.Series><br><br>            <telerik:RadCartesianChart.Behaviors><br>                <telerik:ChartPanAndZoomBehavior x:Name="panZoomBehavior"    Changed="panZoomBehavior_Changed" ><br>                </telerik:ChartPanAndZoomBehavior><br>            </telerik:RadCartesianChart.Behaviors><br>            <telerik:RadCartesianChart.Resources><br>                <local:SeriesToPaletteColorConverter x:Key="SeriesToPaletteColorConverter" /><br>            </telerik:RadCartesianChart.Resources><br>            <telerik:RadCartesianChart.Grid><br>                <telerik:CartesianChartGrid MajorLinesVisibility="XY" StripLinesVisibility="XY" IsTabStop="False" IsManipulationEnabled="False" ><br>                    <telerik:CartesianChartGrid.YStripeBrushes><br>                        <SolidColorBrush Color="#FFD7D7D7" Opacity="0.3" /><br>                        <SolidColorBrush Color="Transparent" /><br>                    </telerik:CartesianChartGrid.YStripeBrushes><br><br>                    <telerik:CartesianChartGrid.XStripeBrushes><br>                        <SolidColorBrush Color="#FFD7D7D7" Opacity="0.3" /><br>                        <SolidColorBrush Color="Transparent" /><br>                    </telerik:CartesianChartGrid.XStripeBrushes><br><br>                </telerik:CartesianChartGrid><br>            </telerik:RadCartesianChart.Grid><br>            <telerik:RadCartesianChart.SelectionPalette><br>                <telerik:ChartPalette><br>                    <telerik:ChartPalette.GlobalEntries><br>                        <telerik:PaletteEntry Fill="Red" /><br>                    </telerik:ChartPalette.GlobalEntries><br>                </telerik:ChartPalette><br>            </telerik:RadCartesianChart.SelectionPalette><br>        </telerik:RadCartesianChart><br>    </Grid>

 

   

private void RadCartesianChart_Loaded(object sender, RoutedEventArgs e)<br>        {<br><br>            RadCartesianChart chart = (RadCartesianChart)sender;<br>            StepLineSeries series = chart.Series.FirstOrDefault() as StepLineSeries;<br><br>            //Get the Content Presenter of the series<br><br>            var pointPresenter1 = series.ChildrenOfType<ContentPresenter>().ToList();<br>            int count = 0;<br>            pointPresenter1.ForEach(x =><br>            {<br>                var ellipseElement1 = x.ChildrenOfType<Rectangle>().FirstOrDefault();<br><br>                //Logic from view model to decide which index need to be higlighted<br>                if (count % 2 == 0 && ellipseElement1 != null)<br>                    ellipseElement1.Fill = new SolidColorBrush(Colors.Red);<br>                count++;<br>            });<br>           <br>        }<br><br>        private void panZoomBehavior_Changed(object sender, EventArgs e)<br>        {<br>           <br>        }<br><br>        private void RadCartesianChart_ZoomChanged(object sender, ChartZoomChangedEventArgs e)<br>        {<br>            <br>        }

Sivakumar
Top achievements
Rank 1
 answered on 04 Jan 2016
1 answer
104 views

I've been evaluating a number of data grids from various vendors, and the way Telerik handles stacked column headers (GridViewColumnGroup) seems to be the most awkward and restrictive of them all. A couple of points to start with:

  1. The group column headers styling does not match the style of the column headers as per selected theme (see attached "column group default header style.jpg"). I was able to hack something by wasting my time finding the style of the column header, and creating a custom style based on CommonColumnHeaderStyle to target CommonColumnHeader, which is obviously a convoluted way of getting this done. Am I missing something?  How can I apply the same theme to the group column headers without resorting to hacking? This simply works out of the box with grids of other vendors, like ComponentOne FlexGrid, or DevExpress data grid.
  2. It appears the behavior of the group column headers differs from column headers.  For instance, the hover over visual state is not consistent between these column headers.  Also, I cannot resize columns from group column headers.  Again, this is something other grids support out of the box with no effort on the part of the developer.  What am I missing?

In short, I would like consistent behavior between group column headers and column headers.  I'd appreciate any insight on this subject.

Martin Ivanov
Telerik team
 answered on 31 Dec 2015
1 answer
340 views

Hello,

 I'm currently testing the RadGridView with Load On Demand behaviour and I'm having some issues.

 

I'm using Entity Framework and when grouping the GridView the rows within some groups appear twice. This happens sometime just after opening the groups but sometimes not until clicking on the row within the group. Then a second row appears within that group.

This only happens when using VirtualQueryableCollectionView as ItemsSource of the GridView. When using ObservableCollection everything is ok. It's also in both cases ok, when no grouping is used - also when removing the grouping after having the duplicated rows. The affected groups are mostly those displayed at the top of the gridview. When changing the sort order of the column before grouping the column, the groups with duplicated rows are at the bottom.

 

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using GalaSoft.MvvmLight.Messaging;
 
namespace PsShell.ViewModels.Articles.CtlArticleMainSelection {
    public class ArticleMainSelectionViewModel : ViewModelBase {
 
        public delegate ArticleMainSelectionViewModel Factory();
 
        public ArticleMainSelectionViewModel() {
        }
   
         private PsShell.Models.Articles.CtlArticleMainSelection.ArticleModel _selectedArticle = null;
        public PsShell.Models.Articles.CtlArticleMainSelection.ArticleModel SelectedArticle {
            get {
                return _selectedArticle;
            }
            set {
                _selectedArticle = value;
                OnPropertyChanged("SelectedArticle");
            }
        }
 
//        private ObservableCollection<Models.Articles.CtlArticleMainSelection.ArticleModel> _articles = null;
//        public ObservableCollection<Models.Articles.CtlArticleMainSelection.ArticleModel> Articles {
        private VirtualQueryableCollectionView _articles = null;
        public VirtualQueryableCollectionView Articles {
            get {
                if (_articles == null) {
                    var context = new Models.Articles.CtlArticleMainSelection.ArticleContext();
                    var query = from gp in context.BusinessPartner
                                orderby gp.geschaeftspartner_id ascending
                                select new Models.Articles.CtlArticleMainSelection.ArticleModel() {
                                    Name1 = gp.Name1,
                                    Name2 = gp.Name2
                                };
 
                    _articles = new VirtualQueryableCollectionView(query) { LoadSize = 50, VirtualItemCount = 150 };    // duplicate row in group
//                    _articles = new ObservableCollection<Models.Articles.CtlArticleMainSelection.ArticleModel>(query); // ok
                }
                return _articles;
            }
        }
    }
}
 

 

<UserControl x:Class="PsShell.Views.Articles.CtlArticleMainSelectionView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib"            
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="800" d:DesignWidth="1400">
 
      <DockPanel LastChildFill="True">
        <telerik:RadGridView x:Name="gvArticles" ItemsSource="{Binding Articles}" SelectedItem="{Binding SelectedArticle, Mode=TwoWay}"
                             IsReadOnly="True" EnableRowVirtualization="True" EnableColumnVirtualization="True"
                             AutoGenerateColumns="False" ShowGroupPanel="True" GroupRenderMode="Flat"
                             IsSynchronizedWithCurrentItem="True" SelectionMode="Single"
                             FilteringMode="FilterRow" ScrollMode="RealTime">
 
            <telerik:RadGridView.SortDescriptors>
                <telerik:ColumnSortDescriptor Column="{Binding Columns[\Name1\], ElementName=gvArticles}" SortDirection="Ascending"/>
            </telerik:RadGridView.SortDescriptors>
 
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name1}" Width="400" ShowDistinctFilters="False"/>
                <telerik:GridViewDataColumn Header="Namenszusatz / Vorname" DataMemberBinding="{Binding Name2}" Width="300" ShowDistinctFilters="False"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </DockPanel>
 </UserControl>

 

A second issue is the performance. When using ObservableCollection as ItemsSource the performance is ok. But when using VirtualQueryableCollectionView the performance is unacceptable slow. I can see the empty grid for about 2 seconds before it is populated with data - and this with a Loadsize of 50 items (in this example it's a bit faster because I reduced the columns from about 10 to 2). I noticed that when using GroupRenderMode="Nested" the performance is noticeable faster, but that isn't the recommended way because of performance issues when using nested grouping.

 

Best Regards

Raul

Martin
Telerik team
 answered on 30 Dec 2015
1 answer
139 views

I use auto generate property and find  it to an object with a string property....

(in edit mode) if i type a super long text into the textbox, the width of the textbox would keep increasing so the whole text is always visible

How can i change that behavior to have width of the textbox fixed?

 

Please see attached

Dilyan Traykov
Telerik team
 answered on 30 Dec 2015
5 answers
274 views
Hi,

I have  2014.1.331.40 version

I am using mail merge functionality of telerik RichTextBox. It working good but when I export mail merge document to pdf, it generates more than 1 mb pdf file.
I am not adding any image in the pdf file.

After PdfExportSettings below property, its generate 450 to 500 kb pdf files.

PdfFormatProvider _PdfFormatProvider = new PdfFormatProvider();
PdfExportSettings _PdfExportSettings = new PdfExportSettings();
_PdfExportSettings.ContentsCompressionMode = PdfContentsCompressionMode.Automatic;
_PdfExportSettings.ContentsDeflaterCompressionLevel = 9;
_PdfExportSettings.FloatingUIContainersExportMode = PdfInlineUIContainersExportMode.Image;
_PdfExportSettings.ImagesCompressionMode = PdfImagesCompressionMode.Automatic;
_PdfExportSettings.ImagesDeflaterCompressionLevel = 9;
_PdfExportSettings.InlineUIContainersExportMode = PdfInlineUIContainersExportMode.Image;
_PdfFormatProvider.ExportSettings = _PdfExportSettings;

Is there any option by which I can manage pdf file size upto 150 kb?

Thanks

Nisarg
Top achievements
Rank 1
 answered on 29 Dec 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?