Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
620
Sample and documentation frustration
posted

Is there any way you can provide a SIMPLE wpf sample of the motionframework without me needing to build up this rocket. I tried to look at your sample but the references to ressources scattered all over a huge feature project that includes everything makes it impossible to export without putting in hours and hours of effort. Im using both Infragistics, Telerik and DevExpress and you have by far the most complicated samplebox. I use your framework in order to be productive.... Im not succeding

  • 30945
    Offline posted

    Hello Genvej,

     

    I am just checking if you require any further assistance on the matter.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

  • 30692
    Suggested Answer
    Offline posted

    Here's a pretty simple example of using the motion framework. It assigns a different set of 50k values every time you click the refresh button and animates the change.
    Note, there are various things you could do to make this sample more efficient, but I've tried to keep it as simple as possible. Let me know if you have any questions.
    The xaml:

    <Window.Resources>
            <local:TestData x:Key="data" />
        </Window.Resources>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            
            <igChart:XamDataChart x:Name="theChart">
                <igChart:XamDataChart.Axes>
                    <igChart:NumericYAxis x:Name="yAxis" 
                                          MinimumValue="0"
                                          MaximumValue="300"/>
                    <igChart:CategoryXAxis 
                        x:Name="xAxis"
                        ItemsSource="{StaticResource data}"
                        Label="{}{Label}"/>
                </igChart:XamDataChart.Axes>
                <igChart:XamDataChart.Series>
                    <igChart:LineSeries
                        x:Name="series"
                        ItemsSource="{StaticResource data}"
                        XAxis="{Binding ElementName=xAxis}"
                        YAxis="{Binding ElementName=yAxis}"
                        MarkerType="None"
                        ValueMemberPath="Value"
                        TransitionDuration="0:00:01"/>
                </igChart:XamDataChart.Series>
            </igChart:XamDataChart>
            
            <Button x:Name="refresh" Content="Refresh" Click="refresh_Click" Grid.Row="1"></Button>
        </Grid>
    

    And the code behind:

    public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
            }
    
            private void refresh_Click(object sender, RoutedEventArgs e)
            {
                ((TestData)this.Resources["data"]).RefreshValues();
            }
        }
    
        public class TestData
            : ObservableCollection<TestDataItem>
        {
            private Random _rand = new Random();
    
            public TestData()
            {
                for (var i = 0; i < 50000; i++)
                {
                    this.Add(new TestDataItem() { Label = i.ToString(), Value = 0 });
                }
    
                RefreshValues();
            }
    
            public void RefreshValues()
            {
                double curr = 150.0;
    
                for (var i = 0; i < Count; i++)
                {
                    if (_rand.NextDouble() > .5)
                    {
                        curr += _rand.NextDouble();
                    }
                    else
                    {
                        curr -= _rand.NextDouble();
                    }
    
                    if (curr < 0)
                    {
                        curr = 0;
                        curr += _rand.NextDouble();
                    }
    
                    if (curr > 300)
                    {
                        curr = 300;
                        curr -= _rand.NextDouble();
                    }
    
                    this[i] = new TestDataItem() { Label = i.ToString(), Value = curr };
                }
            }
        }
    
        public class TestDataItem
        {
            public string Label { get; set; }
            public double Value { get; set; }
        }	
    


    Hope this helps!

    Also note, if you can provide me some information about how you are trying to use the motion framework I could put together a more purpose built sample that demonstrates a way of approaching your requirement.


    -Graham