Current filter:
                                You should refresh the page.
                                  • Hello,

                                    From my previous ticket I received suggestions to look at this ticket. That example was nice, but it was not written using MVVM which I'm using.

                                    Thus I tried to write something equivalent using mvvm but unfortunately I haven't quite managed.

                                    Two things that I struggle with.

                                    1. Trying to set diagram properties using binding:
                                    [C#]
                                    XDiagramX.ActualAxisX.ActualWholeRange.SetMinMaxValues(0, 5000); XDiagramX.ActualAxisX.ActualVisualRange.SetMinMaxValues(0, 200);
                                    2. Getting the event "Scroll" using Interaction Behavious to fire using the command binding.

                                    I've attached a code sample that tries to illustrate the issues (i.e. I don't want to use code behind as in 1) and 2) the fact that Scroll event never seem to fire)

                                    If you could give me some pointers, this would be greatly appreciated.

                                    Have a great day !

                                    King regards
                                    Magnus

                                • Sergi (DevExpress Support) 06.27.2019

                                  Hi Magnus,

                                  We are working on your issue. In the meantime, to process your second question more efficiently, I have created a separate ticket for it: T753709 - How to view all submitted tickets

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Magnus,

                                The OnChartScroll command is not attached because it is referenced incorrectly (the name should include the "Command" part and the PassEventArgsToCommand option is missing). As described in the Basics of Generating POCO View Models article, it is required to instantiate the view model using the ViewModelSource.Create method. In addition, remove the "sender" object from the command signature.

                                [XAML]
                                <dxmvvm:Interaction.Behaviors> <dxmvvm:EventToCommand EventName="Scroll" Command="{Binding OnScrollChartCommand}" PassEventArgsToCommand="True"> </dxmvvm:EventToCommand> </dxmvvm:Interaction.Behaviors>
                                [C#]
                                var vm = ViewModelSource.Create<BasicChartViewModel>();
                                [C#]
                                public void OnScrollChart(XYDiagram2DScrollEventArgs e) { double newMinValue = (double)e.NewXRange.MinValue; double newMaxValue = (double)e.NewXRange.MaxValue; }

                                You can also check the sample project from the How to synchronize the scrolling of multiple chart using binding ticket that illustrates the VisualRange binding approach.

                                • metscore 06.28.2019

                                  Hello Alex,

                                  Thank you for your prompt answer.

                                  Hmmm... I'm using the Prism framework as mvvm provider for instantiating my viewmodel. I'm a little uncertain that I should deviate from this approach since this could, I assume, pose future problems for me.

                                  [C#]
                                  public partial class BasicChartView : UserControl, IBasicChartView { public BasicChartView(IUnityContainer container) { InitializeComponent(); var vm = container.Resolve<IBasicChart>(); this.DataContext = vm; } }

                                  Thanks for the VisualRange binding link. Since Prism seem to be used as mvvm provider I'll see if that might fit my needs.

                                  King regards
                                  Magnus

                                • Alex (DevExpress Support) 06.28.2019

                                  Magnus,

                                  If you prefer not to use the POCO View Model generation approach, you will need to implement the corresponding command as shown in the Getting Started With EventToCommand section of the "EventToCommand" article (see the Common View Model reference).

                                • metscore 06.28.2019

                                  Hello Alex,

                                  I looked at the link you sent me and realized that it was a fairly trivial task to get it to work with Prism.

                                  I needed to make the following changes:

                                  1. Add a command
                                  [C#]
                                  public DelegateCommand<XYDiagram2DScrollEventArgs> OnScrollChartCommand => new DelegateCommand<XYDiagram2DScrollEventArgs>(OnScrollChart);
                                  2. Change the signature of the handler
                                  [C#]
                                  private void OnScrollChart(XYDiagram2DScrollEventArgs obj) { double newMinValue = (double)obj.NewXRange.MinValue; double newMaxValue = (double)obj.NewXRange.MaxValue; }

                                  and finally 3) update the xaml code accordingly (I removed the converter since it was not necessary)

                                  [XAML]
                                  <dxmvvm:Interaction.Behaviors> <dxmvvm:EventToCommand EventName="Scroll" Command="{Binding OnScrollChartCommand}" PassEventArgsToCommand="True"> </dxmvvm:EventToCommand> </dxmvvm:Interaction.Behaviors>

                                  The changes above does the trick !
                                  Thank you!

                                  King regards
                                  Magnus

                                • Alex (DevExpress Support) 06.28.2019

                                  Thank you for the update. I am happy to hear that my assistance was helpful.