Telerik Forums
UI for WPF Forum
3 answers
62 views
Hello,

I'm using a RadGridView, and in it's footer, a textbox element inside a GroupFooterTemplate. Can I, from codebehind, in a TextBox event (e.g. TextChanged) somehow access the GridView that contains my TextBox? When I check the sender's properties, the parent is null.

Also, can I somehow access the group information and the other groups' TextBoxes?

Any help would be appreciated.
Stefan
Telerik team
 answered on 10 Mar 2016
1 answer
46 views

Dear Telerik Support

I just started using your controls for WPF, to see if it suits the needs of our company

Starting by doing basic examples, I stumbled upon the RadGridView pagination

I am trying to use this example

http://demos.telerik.com/silverlight/#DomainDataSource/MVVM and

and this documentation

http://docs.telerik.com/devtools/wpf/controls/raddatapager/getting-started#adding-raddatapager

But it seems my grid wont page if I dont use this

   this.view = new QueryableDomainServiceCollectionView<Customer>(context, getCustomersQuery);
   
   this.view.PageSize = 10;

thus attributing the PageSize to it.

right now I use a ObservableCollection<Entity> List.

 

So my question is: Where how can I use the above mentioned class (QueryableDomainServiceCollectionView) to support my need of pagination?

I don't want to paginate it manually, by using the Unbound mode. and I would prefer to avoid that all data goes into memory

 

I will attach the code of my sample project here. Not you must install the PropertyChanged.Fody in order to run it.

Stefan
Telerik team
 answered on 10 Mar 2016
2 answers
142 views
<t:RadGridView x:Name="Logs">
   <t:RadGridView.Columns>
       <t:GridViewDataColumn CellTemplateSelector="{StaticResource IconTemplateSelector}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding LogLevel,Mode=OneWay}" Header="Level"
                        CellStyle="{StaticResource PaddedCell}"/>                
       <t:GridViewDataColumn DataMemberBinding="{Binding LogID,Mode=OneWay}" 
                        Header="LogID"/>
       <t:GridViewDataColumn DataMemberBinding="{Binding MachineDateTime,Mode=OneWay}"
                        Header="Machine Time"
                        CellStyle="{StaticResource PaddedCell}"/>
       <t:GridViewDataColumn DataMemberBinding="{Binding Occured, Mode=OneWay}"
                        Header="Occured" 
                        CellStyleSelector="{StaticResource ColorSelector}"/>
       <t:GridViewDataColumn DataMemberBinding="{Binding System,Mode=OneWay}"
                        Header="System"
                        CellStyle="{StaticResource PaddedCell}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding Mode,Mode=OneWay}"
                        Header="Mode"
                        CellStyle="{StaticResource PaddedCell}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding CallingClass,Mode=OneWay}"
                        Header="Calling Class"
                        CellStyle="{StaticResource PaddedCell}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding Message,Mode=OneWay}"
                        Header="Message"
                        CellStyle="{StaticResource PaddedCell}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding Exception,Mode=OneWay}"
                        Header="Exception" 
                        CellStyle="{StaticResource PaddedCell}" /> 
   </t:RadGridView.Columns>                     
</telerik:RadGridView>

 

I have above data-bound RadGridView (named Logs) and I am trying to export its contents, but it always results into an empty exported file.

And I try to export the contents of RadGridView with below code:

private void ExportLogs()
{
    using (var stream = File.Create(filepath))
    {
          Logs.Export(stream,
                 new GridViewExportOptions()
                 {
                     Format = ExportFormat.ExcelML,
                     ShowColumnHeaders = true,
                     ShowColumnFooters = false,
                     ShowGroupFooters = false,
                 });   
     }
 }

No exceptions or warning received.
Any help would be appreciated. Thank you.
Niraj
Top achievements
Rank 1
 answered on 10 Mar 2016
1 answer
200 views

Hello

Why this doesn't work?

 

It causes the following exception: 

An unhandled exception of type 'System.NullReferenceException' occurred in Telerik.Windows.Controls.FixedDocumentViewers.dll

em Telerik.Windows.Controls.FixedDocumentViewerBase.AttachToDocumentEvents(RadFixedDocument document)
em Telerik.Windows.Controls.FixedDocumentViewerBase.OnDocumentChanged(RadFixedDocument oldValue, RadFixedDocument newValue)
em Telerik.Windows.Controls.FixedDocumentViewerBase.<.cctor>b__1(DependencyObject s, DependencyPropertyChangedEventArgs e)
em System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
em System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
em System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)

 

Tanya
Telerik team
 answered on 10 Mar 2016
3 answers
106 views
 
I Would like to bind title/header beginning of each line of chart from data source.I already binded with required display with legend and it is working fine but i need help to display at beginging of each line series.Please help it..please refer image...
 
<telerik:RadCartesianChart.SeriesProvider>               
             <telerik:ChartSeriesProvider Source="{Binding Data}">                   
                 <telerik:ChartSeriesProvider.SeriesDescriptors>
                     <telerik:CategoricalSeriesDescriptor  ItemsSourcePath="LineData" ValuePath="Value" CategoryPath="Vector" >
                         <telerik:CategoricalSeriesDescriptor.Style>
                             <Style TargetType="telerik:StepLineSeries">
                                 <Setter Property="StrokeThickness" Value="2"/>
                                 <Setter Property="ShowLabels" Value="False"/>
                                 <Setter Property="PointTemplate" Value="{StaticResource LinePointTemplate}"/>
                                 <Setter Property="LegendSettings">
                                     <Setter.Value>
                                         <telerik:SeriesLegendSettings  x:Name="l" Title="{Binding Name}"/>
                                     </Setter.Value>
                                 </Setter>
                                 <Setter Property="VerticalAxis">
                                     <Setter.Value>
                                         <telerik:LinearAxis Title="{Binding Name}" LabelTemplate="{StaticResource YLabelTemplate}"   
                                   />
                                     </Setter.Value>
                                 </Setter>
                             </Style>
                          
                         </telerik:CategoricalSeriesDescriptor.Style>
                     </telerik:CategoricalSeriesDescriptor>
                 </telerik:ChartSeriesProvider.SeriesDescriptors>                   
             </telerik:ChartSeriesProvider>
         </telerik:RadCartesianChart.SeriesProvider>

 

VM .. { ..
public ObservableCollection<Item> Data { get; set; }
 
 Data.Add(new WaveFormItem()
            {
                Name = "105.1",
                LineData = new ObservableCollection<LineDataModel>()
            {
                new WaveFormLineData() { Vector = 0, Value = 1.0 },
                new WaveFormLineData() { Vector = 1, Value = 1.1 }
             }
             });
 
}
 
 public class LineDataModel
    {
        public int Vector { get; set; }
        public double Value { get; set; }
    }
 
    public class Item
    {
        public string Name { get; set; }
        public ObservableCollection<LineDataModel> LineData { get; set; }
    }
Petar Marchev
Telerik team
 answered on 10 Mar 2016
6 answers
541 views

I'm working on a chart that had a bunch of series as bars.    I'm wanting to change one from a bar to a bubble series and when the chart goes to display I get an error in Telerik code with the exception: "Width and Height must be non-negative".

 The stack trace is in the attached PNG file ("Tracker" is my app).

 

Martin Ivanov
Telerik team
 answered on 10 Mar 2016
2 answers
92 views

Hello,

if i bind a DataTable to a RadGridView.ItemsSource and try to search with SearchPanel, i'm getting a System.ArgumentException error.

Column 'xy' does not belong to table xy.

Can you help me please? Thanks.

 

<telerik:RadGridView ItemsSource="{Binding Table}" ShowSearchPanel="True"/>

 

private DataTable _table;
 
public DataTable Table
{
    get { return _table; }
    set
    {
        if (Equals(value, _table)) return;
        _table = value;
        OnPropertyChanged(nameof(Table));
    }
}
 
 
public ViewModel()
{
    Table = new DataTable("Test");
    Table.Columns.Add("Spalte 1");
    Table.Columns.Add("Spalte 2");
    Table.Columns.Add("Spalte 3");
 
    for (var i = 0; i < 50; i++)
    {
        var row = Table.NewRow();
        row.ItemArray = new object[] { "Cell 1 " + i, "Cell 2 " + i, "Cell 3 " + i };
        Table.Rows.Add(row);
    }
}
Philipp
Top achievements
Rank 1
 answered on 10 Mar 2016
3 answers
137 views
I've got a RadCollectionNavigator with Source bound to an ObservableCollection<int> in the VM and CurrentItem two-way bound to an int in the VM. When I call ObservableCollection<int>.Remove I'm expecting the RadCollectionNavigator to update and change CurrentItem, but this isn't happening. Is this something it can do or do I have to implement an update to the CurrentItem binding myself in the VM?
Yoan
Telerik team
 answered on 10 Mar 2016
2 answers
268 views

Hi Telerik,

 

I'm having this strange phenomenon where my RadCartesianChart shows my annotations when I create the control directly on the grid of the usercontrol, but not when I try to access it in a datatemplate. The annotations are added to the chart in code behind. In both cases, the code is executed, but I don't see them when using the datatemplate. The lineseries themselves are shown in both cases.

This is the XAML for the chart in the datatemplate:

<DataTemplate DataType="{x:Type entities:ChartMeasurement}">
            <Grid>
                <telerik:RadCartesianChart Grid.Row="0" HorizontalAlignment="Stretch" Margin="240,15,0,39" Name="radCartesianChart">
                    <telerik:RadCartesianChart.Resources>
                        <DataTemplate x:Key="PointTemplate">
                            <Ellipse Height="8" Width="8" Stroke="White" StrokeThickness="1" Fill="#1B9DDE" />
                        </DataTemplate>
                        <Style x:Key="BorderStyle" TargetType="Border">
                            <Setter Property="Background" Value="#1B9DDE" />
                        </Style>
                    </telerik:RadCartesianChart.Resources>
                    <telerik:RadCartesianChart.HorizontalAxis>
                        <telerik:DateTimeContinuousAxis MajorStep="{Binding MyViewModel.MajorStep}"
                                                    MajorStepUnit="{Binding MyViewModel.MajorStepUnit}"
                                                    PlotMode="OnTicksPadded"
                                                    LabelTemplate="{StaticResource HorizontalAxisLabelTemplate}"
                                                    LabelRotationAngle="-90"
                                                    LabelFitMode="Rotate"
                                                    LineThickness="2"
                                                    LineStroke="Gray"/>
                    </telerik:RadCartesianChart.HorizontalAxis>
                    <telerik:RadCartesianChart.VerticalAxis>
                        <telerik:LinearAxis Visibility="Hidden"/>
                    </telerik:RadCartesianChart.VerticalAxis>
                    <telerik:RadCartesianChart.SeriesProvider>
                        <telerik:ChartSeriesProvider x:Name="myChartSeriesProvider" Source="{Binding MyViewModel.ChartData.MeasurementList}">
                            <telerik:ChartSeriesProvider.SeriesDescriptors>
                                <telerik:CategoricalSeriesDescriptor ItemsSourcePath="RawDataList" ValuePath="Value" CategoryPath="Time_Local">
                                    <telerik:CategoricalSeriesDescriptor.Style>
                                        <Style TargetType="telerik:LineSeries">
                                            <Setter Property="StrokeThickness" Value="2"/>
                                            <Setter Property="Stroke" Value="{Binding GraphColorBrush}"/>
                                            <Setter Property="VerticalAxis" Value="{Binding VerticalAxis}"/>
                                            <Setter Property="LegendSettings" Value="{Binding Measurement.Name, Converter={StaticResource LegendSettings}}"/>
                                        </Style>
                                    </telerik:CategoricalSeriesDescriptor.Style>
                                </telerik:CategoricalSeriesDescriptor>
                            </telerik:ChartSeriesProvider.SeriesDescriptors>
                        </telerik:ChartSeriesProvider>
                    </telerik:RadCartesianChart.SeriesProvider>
                    <telerik:RadCartesianChart.Grid>
                        <telerik:CartesianChartGrid MajorXLinesRenderMode="All" MajorLinesVisibility="XY"/>
                    </telerik:RadCartesianChart.Grid>
                </telerik:RadCartesianChart>
                <telerik:RadLegend Items="{Binding LegendItems, ElementName=radCartesianChart}"
                                               FontFamily="Segoe UI"
                                               Grid.Row="0"
                                               Margin="2 52 30 20"/>
            </Grid>
</DataTemplate>

As you can see, it is a quite complex graph with a dynamic number of series and 2 vertical axises, where I wan't to combine a number of series on the left vertical axis, and a number of series on the right vertical axis

This is the ChartMeasurement class used in the datatemplate:

public class ChartMeasurement : Measurement
    {
        private ReportingViewModel _reportingViewModel;

        public ChartMeasurement(ReportingViewModel reportingViewModel)
        {
            _reportingViewModel = reportingViewModel;
            MeasurementSignal = new Signal { Name = "Graph" };
        }

        public ReportingViewModel MyViewModel
        {
            get { return _reportingViewModel; }
        }
    }

In code behind, I to the following:

private void RadComboBoxMeasurementPoints_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var reportingView = DataContext as ReportingViewModel;
            var measurementPoint = e.AddedItems[0] as MeasurementPoint;

            var dataTemplateKey = new DataTemplateKey(typeof(ChartMeasurement));
            var dataTemplate = FindResource(dataTemplateKey) as DataTemplate;
            if (dataTemplate == null)
            {
                return;
            }
            var radCartesianChart = ((Grid)dataTemplate.LoadContent()).Children[0] as RadCartesianChart;
            if (reportingView != null &&
                measurementPoint != null &&
                radCartesianChart != null)
            {
                radCartesianChart.Annotations.Clear();

                var axisLeft = new LinearAxis
                {
                    Title = "",
                    Minimum = 0,
                    Maximum = measurementPoint.ScaleLeft,
                    HorizontalLocation = AxisHorizontalLocation.Left,
                    TickThickness = 1,
                    MajorTickLength = 2,
                    LineThickness = 2,
                    MajorStep = measurementPoint.ScaleLeft / 10
                };

                var axisRight = new LinearAxis
                {
                    Title = "",
                    Minimum = 0,
                    Maximum = measurementPoint.ScaleRight,
                    HorizontalLocation = AxisHorizontalLocation.Right,
                    TickThickness = 1,
                    MajorTickLength = 2,
                    LineThickness = 2,
                    MajorStep = measurementPoint.ScaleRight / 10
                };

                if (reportingView.ReportData == null)
                {
                    return;
                }
                var stringLeft = new List<String>();
                var stringRight = new List<String>();
                foreach (var measurement in reportingView.ReportData.Measurements.Where(m => m.Measurement.MeasurementPoint.Equals(e.AddedItems[0])))
                {
                    if (!measurement.Measurement.HasAxisLeft)
                    {
                        measurement.VerticalAxis = axisRight;
                        stringRight.Add(measurement.Measurement.Name);
                        if (measurement.Measurement.HasBoundaryValue)
                        {
                            radCartesianChart.Annotations.Add(new CartesianGridLineAnnotation
                            {
                                Value = measurement.Measurement.BoundaryValue,
                                Stroke = measurement.GraphColorBrush,
                                Axis = axisRight,
                                Label = measurement.Measurement.Name
                            });
                        }
                    }
                    else
                    {
                        measurement.VerticalAxis = axisLeft;
                        stringLeft.Add(measurement.Measurement.Name);
                        if (measurement.Measurement.HasBoundaryValue)
                        {
                            radCartesianChart.Annotations.Add(new CartesianGridLineAnnotation
                            {
                                Value = measurement.Measurement.BoundaryValue,
                                Stroke = measurement.GraphColorBrush,
                                Axis = axisLeft,
                                Label = measurement.Measurement.Name
                            });
                        }
                    }
                }
                axisRight.Title = String.Join(", ", stringRight);
                axisLeft.Title = String.Join(", ", stringLeft);
            }
        }

This code is executed each time another measurementpoint is selected, but I never see the annotations. The lineseries are shown as expected.

When I omit the datatemplate, and show the chart directly in the grid, it works just fine.

This is the XAML:

<telerik:RadCartesianChart Grid.Row="1" HorizontalAlignment="Stretch" Margin="240,15,0,39" Name="radCartesianChart">
                <telerik:RadCartesianChart.Resources>
                    <DataTemplate x:Key="PointTemplate">
                        <Ellipse Height="8" Width="8" Stroke="White" StrokeThickness="1" Fill="#1B9DDE" />
                    </DataTemplate>
                    <Style x:Key="BorderStyle" TargetType="Border">
                        <Setter Property="Background" Value="#1B9DDE" />
                    </Style>
                </telerik:RadCartesianChart.Resources>
                <telerik:RadCartesianChart.HorizontalAxis>
                    <telerik:DateTimeContinuousAxis MajorStep="{Binding MajorStep}"
                                                    MajorStepUnit="{Binding MajorStepUnit}"
                                                    PlotMode="OnTicksPadded"
                                                    LabelTemplate="{StaticResource HorizontalAxisLabelTemplate}"
                                                    LabelRotationAngle="-90"
                                                    LabelFitMode="Rotate"
                                                    LineThickness="2"
                                                    LineStroke="Gray"/>
                </telerik:RadCartesianChart.HorizontalAxis>
                <telerik:RadCartesianChart.VerticalAxis>
                    <telerik:LinearAxis Visibility="Hidden"/>
                </telerik:RadCartesianChart.VerticalAxis>
                <telerik:RadCartesianChart.SeriesProvider>
                    <telerik:ChartSeriesProvider Source="{Binding ChartData.MeasurementList, Mode=TwoWay}">
                        <telerik:ChartSeriesProvider.SeriesDescriptors>
                            <telerik:CategoricalSeriesDescriptor ItemsSourcePath="RawDataList" ValuePath="Value" CategoryPath="Time_Local">
                                <telerik:CategoricalSeriesDescriptor.Style>
                                    <Style TargetType="telerik:LineSeries">
                                        <Setter Property="StrokeThickness" Value="2"/>
                                        <Setter Property="Stroke" Value="{Binding GraphColorBrush}"/>
                                        <Setter Property="VerticalAxis" Value="{Binding VerticalAxis}"/>
                                        <Setter Property="LegendSettings" Value="{Binding Measurement.Name, Converter={StaticResource LegendSettings}}"/>
                                    </Style>
                                </telerik:CategoricalSeriesDescriptor.Style>
                            </telerik:CategoricalSeriesDescriptor>
                        </telerik:ChartSeriesProvider.SeriesDescriptors>
                    </telerik:ChartSeriesProvider>
                </telerik:RadCartesianChart.SeriesProvider>
                <telerik:RadCartesianChart.Grid>
                    <telerik:CartesianChartGrid MajorXLinesRenderMode="All" MajorLinesVisibility="XY"/>
                </telerik:RadCartesianChart.Grid>
            </telerik:RadCartesianChart>
            <telerik:RadLegend Items="{Binding LegendItems, ElementName=radCartesianChart}"
                               Name="radLegend"
                               FontFamily="Segoe UI"
                               Grid.Row="1"
                               Margin="2 52 30 20"/>

 

And the code behind:

private void RadComboBoxMeasurementPoints_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var reportingView = DataContext as ReportingViewModel;
            var measurementPoint = e.AddedItems[0] as MeasurementPoint;

            if (reportingView != null &&
                measurementPoint != null &&
                radCartesianChart != null)
            {
                radCartesianChart.Annotations.Clear();

                var axisLeft = new LinearAxis
                {
                    Title = "",
                    Minimum = 0,
                    Maximum = measurementPoint.ScaleLeft,
                    HorizontalLocation = AxisHorizontalLocation.Left,
                    TickThickness = 1,
                    MajorTickLength = 2,
                    LineThickness = 2,
                    MajorStep = measurementPoint.ScaleLeft / 10
                };

                var axisRight = new LinearAxis
                {
                    Title = "",
                    Minimum = 0,
                    Maximum = measurementPoint.ScaleRight,
                    HorizontalLocation = AxisHorizontalLocation.Right,
                    TickThickness = 1,
                    MajorTickLength = 2,
                    LineThickness = 2,
                    MajorStep = measurementPoint.ScaleRight / 10
                };

                if (reportingView.ReportData == null)
                {
                    return;
                }
                var stringLeft = new List<String>();
                var stringRight = new List<String>();
                foreach (var measurement in reportingView.ReportData.Measurements.Where(m => m.Measurement.MeasurementPoint.Equals(e.AddedItems[0])))
                {
                    if (!measurement.Measurement.HasAxisLeft)
                    {
                        measurement.VerticalAxis = axisRight;
                        stringRight.Add(measurement.Measurement.Name);
                        if (measurement.Measurement.HasBoundaryValue)
                        {
                            radCartesianChart.Annotations.Add(new CartesianGridLineAnnotation
                            {
                                Value = measurement.Measurement.BoundaryValue,
                                Stroke = measurement.GraphColorBrush,
                                Axis = axisRight,
                                Label = measurement.Measurement.Name
                            });
                        }
                    }
                    else
                    {
                        measurement.VerticalAxis = axisLeft;
                        stringLeft.Add(measurement.Measurement.Name);
                        if (measurement.Measurement.HasBoundaryValue)
                        {
                            radCartesianChart.Annotations.Add(new CartesianGridLineAnnotation
                            {
                                Value = measurement.Measurement.BoundaryValue,
                                Stroke = measurement.GraphColorBrush,
                                Axis = axisLeft,
                                Label = measurement.Measurement.Name
                            });
                        }
                    }
                }
                axisRight.Title = String.Join(", ", stringRight);
                axisLeft.Title = String.Join(", ", stringLeft);
                dataTemplate.LoadContent();
            }
        }

 

As you can see, both code snippets are very alike.

What am I missing here or doing wrong?

The reason for using a datatemplate is that I want the chart to show up in a tab page of a dynamic tab control (dynamic number of tab pages).

 

Thanks in advance.

 

Hans.

Hans
Top achievements
Rank 1
 answered on 10 Mar 2016
5 answers
180 views

Hi,

I'm trying to create a TableShape project that will visualize tables from our DB, and will enable the users to open tables and create joins between row in a different tables.

I used your demo's code for the TableShape, but instead of --> SamplesFactory (class) --> LoadSample (method) --> diagram.Load(xml) (line 146), I created a TableShape and added it by using : diagram.AddShape(tableShape).

Now I'm trying to add rows to the table, but I can't use the RowShape you have in the demo, I get an exception that the rowShape not suitable for the tableShape.

How can I solve it? How can I add rows to my table?

Best Regards.

Dinko | Tech Support Engineer
Telerik team
 answered on 09 Mar 2016
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?