Telerik Forums
UI for WPF Forum
2 answers
93 views

Hi Team,

I would like to know how to manage the list of items per page by page like the Mobile phone screen movements?

 

Shameel
Top achievements
Rank 1
 answered on 27 Apr 2016
1 answer
169 views

Do not display the changes within the time period in candlestick chart!
How to solve this problem?
"Line" series works well. Displays parameter changes "ClosePrice"
The data source is the same for both series of data (CandleStick and Line)!

Link to source:  https://www.dropbox.com/s/ue1n4h2rsxo2mi6/CandleStickSeriesNotWork.VS2015.zip?dl=0

 

<Window x:Class="CandleStickSeriesNotWork.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="70"/>
        </Grid.RowDefinitions>
         
            <telerik:RadCartesianChart x:Name="radCartesianChart" Grid.Column="0" >
 
                <telerik:RadCartesianChart.Grid>
                    <telerik:CartesianChartGrid MajorLinesVisibility="Y"/>
                </telerik:RadCartesianChart.Grid>
 
                <telerik:RadCartesianChart.Behaviors>
                    <telerik:ChartCrosshairBehavior/>
                    <telerik:ChartPanAndZoomBehavior DragToZoomThreshold="0" MouseWheelMode="Zoom" DragMode="Pan" ZoomMode="Both" PanMode="Both"/>
                </telerik:RadCartesianChart.Behaviors>
 
                <telerik:RadCartesianChart.HorizontalAxis>
                    <telerik:DateTimeContinuousAxis x:Name="AxisX" IsStepRecalculationOnZoomEnabled="True" LabelOffset="0" LastLabelVisibility="Visible" LineThickness="1" MaximumTicks="31" MajorTickOffset="0" MajorTickLength="5" PlotMode="BetweenTicks" SmartLabelsMode="None" TickThickness="1" ZIndex="0"/>
                </telerik:RadCartesianChart.HorizontalAxis>
 
                <telerik:RadCartesianChart.VerticalAxis>
                    <telerik:LinearAxis x:Name="AxisY" MajorStep="1" LineThickness="1" SmartLabelsMode="SmartStepAndRange" />
                </telerik:RadCartesianChart.VerticalAxis>
 
 
 
                <telerik:CandlestickSeries x:Name="CandleSeries"
                                       CategoryBinding="OpenTime" 
                                       CloseBinding="ClosePrice"
                                       HighBinding="HighPrice"
                                       LowBinding="LowPrice"
                                       OpenBinding="OpenPrice" 
                                       ItemsSource="{Binding CandlesSeries}"  />
 
                 
                <telerik:LineSeries ItemsSource="{Binding CandlesSeries}" CategoryBinding="OpenTime" ValueBinding="ClosePrice" />
            </telerik:RadCartesianChart>
         
        <TextBlock Grid.Row="1">
            <Span FontWeight="Bold" Foreground="Red">
                Do not display the changes within the time period in candlestick chart! <LineBreak/>
                How to solve this problem? <LineBreak/>
                "Line" series works well. Displays parameter changes "ClosePrice" <LineBreak/>
                The data source is the same for both series of data (CandleStick and Line)!
            </Span>
 
        </TextBlock>
    </Grid>
</Window>

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using CandleStickSeriesNotWork.Data;
using Telerik.Windows.Controls.ChartView;
using Telerik.Windows.Data;
 
namespace CandleStickSeriesNotWork
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
 
     
    public partial class MainWindow : Window
    {
        private DispatcherTimer timer;
        private Random r;
        private ViewModel dc;
        public MainWindow()
        {
            InitializeComponent();
            dc = new ViewModel();
            this.DataContext = dc;
 
            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(100);
            timer.Tick += (sender, args) =>
            {
 
                DateTime date = DateTime.Now.AddSeconds(-DateTime.Now.Second);
                Random k = new Random();
 
                decimal price = dc.CandlesSeries.Last().ClosePrice;
                price = k.Next() % 2 == 0 ? price += 5 : price -= 5;
 
                if (dc.CandlesSeries.Last().OpenTime.AddMinutes(1) < date)
                {
                    dc.CandlesSeries.Add(new Candle(date, price, price, price, price));
                }
                else
                {
                    var candle = dc.CandlesSeries.Last();
                    candle.ClosePrice = price;
                    if (price > candle.HighPrice) candle.HighPrice = price;
                    if (price < candle.LowPrice) candle.LowPrice = price;
                }
            };
 
            DateTime date1 = DateTime.Now.AddSeconds(-DateTime.Now.Second).AddMinutes(-1);
             
            r = new Random();
            decimal price1 = r.Next(200);
            dc.CandlesSeries.Add(new Candle(date1, price1, price1+100, price1-100, price1+50));
 
            timer.Start();
 
        }
 
 
    }
}

 

using System.Collections.ObjectModel;
using CandleStickSeriesNotWork.Data;
using Telerik.Windows.Data;
 
namespace CandleStickSeriesNotWork
{
    public class ViewModel
    {
        public ObservableCollection<Candle> CandlesSeries { get; set; }
 
        public ViewModel ()
        {
           CandlesSeries = new ObservableCollection<Candle>();
        }
    }
}

using System;
using System.ComponentModel;
 
namespace CandleStickSeriesNotWork.Data
{
    public class Candle  : INotifyPropertyChanged
    {
        DateTime _openTime;
        decimal _highPrice;
        decimal _lowPrice;
        decimal _openPrice;
        decimal _closePrice;
        private int? _numberCandle;
 
 
        public Candle(DateTime opentime,  decimal open, decimal high, decimal low, decimal close)
        {
            _openTime = opentime;
            _openPrice =  open;
            _highPrice =  high;
            _lowPrice =  low;
            _closePrice =  close;
        }
 
        public Candle() { }
 
 
        public DateTime OpenTime
        {
            get { return _openTime; }
            set
            {
                if (!Equals(_openTime, value))
                {
                    _openTime = value;
                    OnPropertyChanged("OpenTime");
                }
            }
        }
 
        public decimal HighPrice
        {
            get { return _highPrice; }
            set
            {
                if (!Equals(_highPrice, value))
                {
                    _highPrice = value;
                    OnPropertyChanged("HighPrice");
                }
            }
        }
 
        public decimal LowPrice
        {
            get { return _lowPrice; }
            set
            {
                if (!Equals(_lowPrice, value))
                {
                    _lowPrice = value;
                    OnPropertyChanged("LowPrice");
                }
            }
        }
 
        public decimal OpenPrice
        {
            get { return _openPrice; }
            set
            {
                if (!Equals(_openPrice, value))
                {
                    _openPrice = value;
                    OnPropertyChanged("OpenPrice");
                }
            }
        }
 
        public decimal ClosePrice
        {
            get { return _closePrice; }
            set
            {
                if (!Equals(_closePrice, value))
                {
                    _closePrice = value;
                    OnPropertyChanged("ClosePrice");
                }
            }
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
 
        
         
    }
 
     
     
}
Martin Ivanov
Telerik team
 answered on 27 Apr 2016
2 answers
343 views
I have a RadTileView, with ItemsSource set to an ObservableCollection. RadTileViewItem.Position is configured to bind to a property on each item named Position. This seems to work fine for the initial load... however, when the Position property is updated, the RadTileView does not reorder the tiles.

I think it probably has something to do with items being added one at a time to the ObservableCollection, and then their Position values are being rebuilt en-mass.

Are there any specifics I should know about here? Basically I need a list of tiles, with items being added and removed on the fly, and also changing position.

[EDIT]

Okay. I have the reordering working. The issue seems to be that if the Binding on Position is not TwoWay, it is simple ignored, and the order in the collection controls the order of the tiles. This seems odd, as I don't desire TwoWay binding... I just want to be able to change it.

I'm still suffering from two issues. One, is the animations don't work. The tiles don't slide around. I have set a ReorderingDuration as well as ElasticEase as the ReorderingEasing. However, the tiles still just jump.

Second, there seems to still be something wrong with adding tiles. Sometimes, when I add items to the underlying collection, the tiles aren't actually created. Theres just blank spaces where the tiles should be.

[EDIT]

Okay. I've figured most of this out. Position must be two way, because TileView does not simply read from Position, but adjusts the positions of other tiles in order to reorder them. So if I change the position of an object in the collection, the TileView will go and change the positions of OTHER elements in the collection. And it looks like it only really likes to change the position of one thing at a time. So, fine. Instead of rebuilding all the positions in a loop; I'm only setting the position of the first item in the collection that's at the incorrect position. The loop then comes around again after 1 second, and does the same thing to the next item. And it only shifts it by one position at a time. So, if the position is > than it should be, I Position-- it. If it's less than it should be, I Position++ it. Eventually they are all the proper value.

This is kind of obnoxious. It'd be easier of I could just reset the positions of all items of the collection to the proper position and have the TileView move them around properly.

Second, my animations are still broken. But I figured out why. I'm overriding the Template of RadTileViewItem in order to remove the Header. For some reason, this destroys the animations. I still need help figuring out how to fix the animations.

[EDIT]

Success! I had to put TWO unnamed, unused Grid elements as the root of the RadTileViewItem.Template. That is totally undocumented. Somebody should document this somehow. =)
Vladimir Skvortsov
Top achievements
Rank 1
 answered on 27 Apr 2016
1 answer
106 views

Hi Team!

I'm having the following exception throwed sometimes (I can't reproduce it consistently).

Is this a bug? 

System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Telerik.Windows.Controls.Charting.ResourceHelper.GetThemeLocationAttribute(Theme theme)
   at Telerik.Windows.Controls.Charting.ResourceHelper.RetrieveAnimationStoryboard(IAnimatable animatableItem)
   at Telerik.Windows.Controls.Charting.SelfDrawingSeries.ManageAnimationSettings()
   at Telerik.Windows.Controls.Charting.SelfDrawingSeries.OnApplyTemplate()
   at System.Windows.FrameworkElement.ApplyTemplate()
   at Telerik.Windows.Controls.ItemsControlExtensions.GetItemsPanelRecursive[TPanel](DependencyObject control)
   at Telerik.Windows.Controls.Charting.ItemsControlExtensions.InvalidateItemsPanelMeasureRecursive(ItemsControl control)
   at Telerik.Windows.Controls.Charting.ChartArea.InvalidateSeriesMeasure()
   at Telerik.Windows.Controls.Charting.Axis.UpdateRangeAndStep()
   at Telerik.Windows.Controls.Charting.Axis.BuildAxisData()
   at Telerik.Windows.Controls.Charting.AxisX.BuildAxisData()
   at Telerik.Windows.Controls.Charting.Axis.UpdateAxis()
   at Telerik.Windows.Controls.Charting.Axis.ChartAreaDataChanged(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Telerik.Windows.Controls.Charting.ChartArea.OnDataChanged()
   at Telerik.Windows.Controls.Charting.ChartArea.UpdateChart()
   at Telerik.Windows.Controls.Charting.ChartArea.OnDataSeriesCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.RadObservableCollection`1.RaiseCollectionChangedOnResume()
   at Telerik.Windows.Data.RadObservableCollection`1.ResumeNotifications()
   at Telerik.Windows.Data.RadObservableCollection`1.AddRange(IEnumerable`1 items)
   at Telerik.Windows.Controls.Charting.RadHierarchicalObservableCollection`1.AddRange(IEnumerable`1 items)
   at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ChartArea chartArea)
   at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData)
   at Telerik.Windows.Controls.RadChart.Rebind(Object originalData)
   at Telerik.Windows.Controls.RadChart.NotifyCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at MTB.View.OptionWatchContent.InsertRow(MTuple row)
   at MTB.View.OptionWatchContent.<ResetPlot>b__16()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

 

Thanks a lot!

Best regards,

Petar Marchev
Telerik team
 answered on 27 Apr 2016
1 answer
126 views
I have a RadGridView which used for displaying data. Since the i have many columns to display, so i fixed part of the columns and there will be a scroll bar for user to see all the columns. the issue is it cannot show all the columns when i choose 1027*768 screen resolution even max the screen. Any way to fix it? my verson is 2015.2.728.45. runtime version is v4.0.30319
Stefan Nenchev
Telerik team
 answered on 27 Apr 2016
1 answer
170 views

Hi Team!

I'm having the following Exception throwed sometimes (I can't reproduce consistently).

Is there anything I can do to avoid it? Is this a known bug?

System.InvalidOperationException: Unable to return a TimeSpan property value for a Duration value of 'Automatic'. Check the HasTimeSpan property before requesting the TimeSpan property value from a Duration.
   at System.Windows.Duration.get_TimeSpan()
   at Telerik.Windows.Controls.Charting.BaseChartItem2D.ConfigureLinearLabelAnimation(Storyboard storyboard)
   at Telerik.Windows.Controls.Charting.BaseChartItem2D.ConfigureLabelAnimation(Boolean shouldApplyAnimation)
   at Telerik.Windows.Controls.Charting.BaseChartItem2D.ShowLabel(Boolean shouldApplyAnimation)
   at Telerik.Windows.Controls.Charting.BaseChartItem2D.OnApplyTemplate()
   at Telerik.Windows.Controls.Charting.BasePointMarkChartItem.OnApplyTemplate()
   at System.Windows.FrameworkElement.ApplyTemplate()
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at Telerik.Windows.Controls.Charting.LinearSeriesPanel.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at Telerik.Windows.Controls.Charting.ChartPanel.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

Thanks a lot!

Best regards,

Petar Marchev
Telerik team
 answered on 27 Apr 2016
15 answers
462 views
Good day all 

This is my first post for 2013. i am working on a Kinect for Microsoft Project , i want to use Telerik Carousel , so as you know in Kinect there is no mouse and keyboards, i want to programmatically move the Carousel items left or right. so i need to know is there a way to move or scroll it Programmatically ? 

Thanks 

Yoan
Telerik team
 answered on 27 Apr 2016
3 answers
245 views

hi,

I tried to trigger the event ResizeCompleted on a Custom ganttask. 

I found in the telerik manual (http://docs.telerik.com/devtools/wpf/controls/radganttview/features/drag-and-drop/dragdrop-custom-behaviors.html) the following event : ResizeCompleted(SchedulingResizeState state) – occurs when the resize operation has finished

 

When I try to use it in code, I got it like in the picture! It can't find the override event like explained in the manual. 

 

 

Note: Using version '2015.2.728.40'

Yana
Telerik team
 answered on 27 Apr 2016
6 answers
1.8K+ views
How do you use the Quick Start Control ?

Just start with WPF and Telerik so might be going down the wrong road
I have download the Demo's on to my PC and been running them and see example that have usage of telerikQuickStart
I'm guessing that the control is the one that is normaly on the right of most demo's

Have seen that I make a control and ref Quick start
<UserControl ......
             xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls">

And seen that you set in your control what you want in the quick start
<telerikQuickStart:QuickStart.ConfigurationPanel>
     <StackPanel Margin="3">
         <Button Content="Button1" Click="OnButton1Handler" Margin="0,2" />
     </StackPanel>
</telerikQuickStart:QuickStart.ConfigurationPanel>

But how do you get one in your application to start ?

 
Honghai
Top achievements
Rank 1
 answered on 27 Apr 2016
5 answers
208 views
I'm currently evaluating whether we want to purchase Telerik controls for use in our products. Prototyping is quite cumbersome with the popup's with the message about the trial version.

A semitransparent watermark, or some "trial version" text somewhere in a corner would make it a lot easier for us to do our evaluation. Our business analysts and customers are allergic to popup's (with good reason), so if I would build a demo to show to management then they will not be impressed...
Abdul
Top achievements
Rank 1
 answered on 26 Apr 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?