Telerik Forums
UI for WPF Forum
4 answers
637 views

When RadGridView loses focus, it jumps to the top of it's items. This is really bad behaviour when inserting a row. If I'm halfway through entering details for a new row and I happen to click on anything else outside the grid, the grid jumps to the top and the row I'm inserting disappears out of view...

I want the grid to stay exactly where it is, unless the user manually scrolls it themselves.

Is there any way to prevent the grid from automatically scrolling or moving during/after inserting and/or editing?

Stefan Nenchev
Telerik team
 answered on 23 Nov 2016
10 answers
836 views

Hello. I need a real-time RadCartesianChart with Spline Series which could contain a large number of points and could be scrolled (or panned) in time. Suppose the program works and generates a chart for an hour. The chart moves from right to left. Every second the program polls the external device (flowmeter) and receives data to form a new point on the chart. In the chart window only last 30 points are seen. The others are hidden behind the left border of the chart window. To see the hidden part of the chart the user has to do one of the two floowing options:

- Scroll the chart. I.e., the user moves the mouse cursor to the scroll bar thumb and sets the mouse cursor over it, presses the right mouse button and while holding it, tows scroll bar thumb from right to left until the chart will be scrolled until the required distance.

Or

-Pan the chart. I.e., the user sets the mouse cursor over the chart, presses the right mouse button and while holding it, drags the chart from right to left until the chart will be moved until the required distance.

Below, I present to you View and ViewModel of how the chart is now done. Please see the View:

<telerik:RadCartesianChart Grid.Row="0">
    <!--Turn off scrollbars on the chart-->
    <telerik:RadCartesianChart.Resources>
        <Style TargetType="telerik:PanZoomBar">
            <Setter Property="Visibility" Value="Collapsed"/>
        </Style>
    </telerik:RadCartesianChart.Resources>
    <telerik:SplineSeries CategoryBinding="Category" ValueBinding="Value" ItemsSource="{Binding Data}"/>
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:DateTimeContinuousAxis MajorStepUnit="Second" LabelInterval="5" LabelFormat="hh:mm:ss" FontFamily="Segoe UI" PlotMode="OnTicks" TickOrigin="{Binding AlignmentDate}"/>
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis FontFamily="Segoe UI" Title="Meters per second [m/s]"/>
    </telerik:RadCartesianChart.VerticalAxis>
    <!--Coordinate grid-->
    <telerik:RadCartesianChart.Grid>
        <telerik:CartesianChartGrid MajorLinesVisibility="XY" MajorXLineDashArray="3,4" MajorYLineDashArray="3,4"/>
    </telerik:RadCartesianChart.Grid>
    <!--Changing of scale and panning of the chart---->
    <telerik:RadCartesianChart.Behaviors>
        <telerik:ChartPanAndZoomBehavior DragMode="Pan" ZoomMode="Both"  PanMode="Both"/>
    </telerik:RadCartesianChart.Behaviors>
</telerik:RadCartesianChart>

Please see the ViewModel

public class t_SoundVelocityViewModel : BindableBase
{
    #region Fields
 
    #region Constant Fields
    /// <summary>
    /// Outer device polling timer period.
    /// </summary>
    private const int TIMER_INTERVAL = 1000;
    . . . . . . . . . . . . . . . . . . . . . . . . .
    #endregion
 
    #region Common Fields  
    . . . . . . . . . . . . . . . . . . . . . . . . .
    /// <summary>
    /// Chart points collection.
    /// </summary>
    private RadObservableCollection<ChartPoint> _data;
    /// <summary>
    /// Outer device polling timer.
    /// </summary>
    private DispatcherTimer _timer;
    /// <summary>
    ///
    /// </summary>
    private DateTime _lastDate;
    /// <summary>
    ///
    /// </summary>
    private DateTime? _alignmentDate;
    /// <summary>
    ///
    /// </summary>
    private bool _useAlignmentDate;
    /// <summary>
    /// Текущее значение скорости звука.
    /// </summary>
    private double _soundVelocityValue = 0;
    #endregion
 
    #endregion
 
    #region Constructors
 
    /// <summary>
    /// Конструктор.
    /// </summary>
    public t_SoundVelocityViewModel(IEventAggregator eventAggregator)
    {
        . . . . . . . . . . . . . . . . . . . . . . . .
 
        this.FillData();
 
        this._useAlignmentDate = true;
 
        // Create timer.
        this._timer = new DispatcherTimer();
        this._timer.Interval = TimeSpan.FromMilliseconds(TIMER_INTERVAL);
        this._timer.Tick += this.onTimer;
        // Запустить таймер опроса.
        this._timer.Start();
    }
 
    #endregion
 
    #region Properties
 
    /// <summary>
    /// Gets or sets chart points collection.
    /// </summary>
    public RadObservableCollection<ChartPoint> Data
    {
        get { return this._data; }
        set { this.SetProperty(ref this._data, value); }
    }
    public DateTime? AlignmentDate
    {
        get { return this._alignmentDate; }
        set { this.SetProperty(ref this._alignmentDate, value); }
    }
    public bool UseAlignmentDate
    {
        get { return this._useAlignmentDate; }
        set
        {
            if (this.SetProperty(ref this._useAlignmentDate, value))
                this.updateAlignmentDate();
        }
    }
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
    #endregion
 
    #region Methods
 
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    /// <summary>
    /// Polling timer tick's handler.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void onTimer(object sender, EventArgs e)
    {
        try
        {
            this._lastDate = this._lastDate.AddMilliseconds(TIMER_INTERVAL);
            // Turn off collection changed notifications when very old chart point is removed
            // from chart points collection and a new chart point add there.
            this.Data.SuspendNotifications();
            this.Data.RemoveAt(0);
            this.Data.Add(this.CreateBusinessObject());
            // Turn on collection changed notifications after new chart point was added there.
            this.Data.ResumeNotifications();
 
            . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
        }
        catch (Exception ex)
        {
            if (ex.InnerException != null)
                raiseNotification(ex.InnerException.Message, "Ошибка");
            else
                raiseNotification(ex.Message, "Ошибка");
        }
    }
 
    /// <summary>
    /// Creates chart point.
    /// </summary>
    /// <returns></returns>
    private ChartPoint CreateBusinessObject()
    {
        this._soundVelocityValue = GlobalStaticMembers.SoundVelocityBuffer;
        ChartPoint point = new ChartPoint();
        point.Value = this._soundVelocityValue;
        point.Category = this._lastDate;
 
        return point;
    }
 
    /// <summary>
    ///
    /// </summary>
    private void FillData()
    {
        RadObservableCollection<ChartPoint> collection = new RadObservableCollection<ChartPoint>();
        this._lastDate = DateTime.Now;
        this._alignmentDate = this._lastDate;
        for (int i = 0; i < 31; i++)
        {
            this._lastDate = DateTime.Now;
            collection.Add(this.CreateBusinessObject());
        }
        this.Data = collection;
    }
 
    /// <summary>
    /// Starts polling timer.
    /// </summary>
    public void startTimer(bool param)
    {
        if (!this._timer.IsEnabled)
            this._timer.Start();
    }
 
    /// <summary>
    /// Stops polling timer.
    /// </summary>
    public void stopTimer(bool param)
    {
        this._timer.Stop();
    }
 
    /// <summary>
    /// Updates polling timer interval.
    /// </summary>
    /// <param name="interval"></param>
    public void UpdateTimer(double interval)
    {
        this._timer.Interval = TimeSpan.FromMilliseconds(interval);
    }
 
    /// <summary>
    ///
    /// </summary>
    private void updateAlignmentDate()
    {
        this.AlignmentDate = this._useAlignmentDate ? (DateTime?)this._lastDate : null;
    }
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
    #endregion
}
As you can see only 30 last point are shown in the chart now. But I'm in need of scrolled or panned chart as I write above. I've seen documentation for ChartView and posts in forum of ChartView WPF but I found nothing significant about scrolling (or panning) real-time chart with very large number of points in time. If you give me an example of such RadCartesianChart with Spline Series (as I describe above) I will be very grateful to you. Please help me if this is possible ofcource.
Dmitry
Top achievements
Rank 1
 answered on 23 Nov 2016
6 answers
126 views

Hello, I am attempting to build licensed copies of 2015_1_0401 WPF to use with a WPF 4.5.1 application.

 I built the assemblies from Source Code using the instructions for creating Licensed builds and can see in the JustDecompile that the licensed strings were present and working properly. I used the aforementioned bat file to build on a clean VM of Windows 8.1 x64 with VS 2013.4 which is only used for building purposes. I don't have anything installed on it other than VS.

 Unfortunately, when I create a basic WPF Scenario project and add references to my custom built Xamlless DLLs, I find that no windows are visible at all. I have followed the help instruction on applying Implicit themes.

To validate where the problem existed, in my built DLLs or elsewhere, I created a simple project with one main window and one Telerik Window and a button on the main to open the telerik window. Same issue existed. So I removed the references to my custom built DLLs and replaced the references with the "installed" Xamlless DLLs from my Program Files directory and everything worked perfectly.

So a few questions on this as I have now spent hours trying various approaches and building/rebuilding/new test projects etc:

1. the BAT build results in 5336 Warning(s) and 0 Errors. That seems very high to me--I am for 0 personally... is this high number expected?

2. the resulting Binaries folder contains two directories: WPF and WPF.NoXaml. The WPF.NoXaml directory contains a child called "Dev."

Which of these is the right binaries directory to use?

3. Does Telerik WPF installation need to be performed on my VM in order to build these BAT files properly?

4. What could be wrong with the build process--it is very straight forward, extract the Source Code, alter the Licensing files, and run the given Bat script.

 Thanks in advance!

Martin Ivanov
Telerik team
 answered on 22 Nov 2016
1 answer
111 views

Hi,
Is there a way to resize or drag images in a RichTextBox with the touch?
Now it seems the touch allows only the scroll of the document and the selection of text and images.
Thanks

Tanya
Telerik team
 answered on 22 Nov 2016
2 answers
2.0K+ views

Hi,

I am using RadRichTextBox and filling it with XAML Data Provider.  For text construction I am using "Segoe UI" font of size 12. When I am two lines separated by Enviornement.NewLine it looks like the line spacing is more than 1. I tried to decrease the line spacing by LineSpacingType as Exact and LineSpacing to 0.75. Due to this text appearance changed and not readable. Following is the example.

                Paragraph title = new Paragraph();
                title.LineSpacingType = LineSpacingType.Exact;
                title.LineSpacing = 0.75;

 

I used SetupDocument method of XamlDataProvider to decrease the spacing. But no luck.

  e.Document.LineSpacing =1;

Note: I am using latest version of WPF Controls of Telerik.

Please Help.

 

Martin Ivanov
Telerik team
 answered on 22 Nov 2016
4 answers
104 views

Hi,
I need some help on an issue with the RadGridView.

In my grid I have a status column and some text columns.

The status column has a binding to an enum with 4 values and a cellstyle to get displayed a status image.

When I have the FilteringMode set to FilterRow and the filter field of the text column contains some text I get a System.FormatException while dragging the status column over this text column saying that the value from the filter field is not a valid value for the status column.
But why will try the grid to set filter values from one column to another?
Any suggestions how to get this fixed?
Many thanks for all tips.

Cheers,

  Thomas

Stefan Nenchev
Telerik team
 answered on 22 Nov 2016
1 answer
173 views
Following the example here: http://docs.telerik.com/devtools/wpf/controls/raddatapager/how-to/change-page-size-dynamically

but on an unbound DataPager.

The two way binding of the combo box to the PageSize seems to work, as the number of pages is changed to reflect the selected value.  However, there is no event that allows me to set the items on the grid view, which is normally done in the PageIndexChanged event handler.

Currently, I am adding a SelectionChanged event handler to the combo box from which I call the same implementation as in the DataPager's PageIndexChanged handler, but this seems like it should be unnecessary.

Am I missing something?

Dilyan Traykov
Telerik team
 answered on 22 Nov 2016
3 answers
352 views
Hello,
how i can cancel edit cell (reset value) when validation is failed?

Masha
Stefan
Telerik team
 answered on 22 Nov 2016
1 answer
236 views

First part of this question: is this control still supported?  I ask because according to http://docs.telerik.com/devtools/wpf/controls/radentityframeworkdatasource/entityframework-changes there hasn't been an update since 2013, yet Entity Framework itself has been updated multiple times since then.

 

The real question is: how to use this with Entity Framework 6.1?

When trying to use this control, I get this at runtime:

Exception thrown: 'System.MissingMethodException' in Telerik.Windows.Controls.EntityFramework.dll
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>Log Manager.vshost.exe</AppDomain><Exception><ExceptionType>System.MissingMethodException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Method not found: 'System.Data.Objects.ObjectContext System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()'.</Message><StackTrace>   at Telerik.Windows.Controls.RadEntityFrameworkDataSource.get_EffectiveObjectContext()

I'm setting the DbContext like this: this.logsSource.DbContext = this.context;

According to http://www.telerik.com/forums/objectcontext-vs-dbcontext the DbContext property just calls ((System.Data.Entity.Infrastructure.IObjectContextAdapter)this.DbContext).ObjectContext;

But I don't think that's correct, as I've tried doing the same thing myself and setting the ObjectContext property, but that property insists that ObjectContext come from System.Data.Objects, so the above line would never work.

 So I'm confused, and looking for suggestions, please. 

Dilyan Traykov
Telerik team
 answered on 22 Nov 2016
1 answer
212 views
We have an application with certain behaviors that require modifying the document model directly. Doing this clears the undo stack. Is there any way that we can hook into the document undo stack so that we can support undoing our custom actions to the document?
Mihail
Telerik team
 answered on 22 Nov 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?