xyzzer / WinRTXamlToolkit

WinRT XAML Toolkit
Other
282 stars 67 forks source link

Caliburn micro compatibility #54

Closed MkazemAkhgary closed 6 years ago

MkazemAkhgary commented 6 years ago

does this work with caliburn micro?

I have a LineSeries called Chart. how do I make this connection from shell view model to shell view?

    public class ChartItem
    {
        public TimeSpan Value{ get; set; }
        public DateTime Time { get; set; }
    }

    BindableCollection<ChartItem> Chart { get; } = new BindableCollection<ChartItem>();

but adding items to Chart does not show in LineSeries.

xyzzer commented 6 years ago

I've never tested with Caliburn micro, but I vaguely remember that there were some issues using bindings with the chart data. YMMV. If you see issues - consider fixing them in the source and submitting a PR.

On Fri, Feb 23, 2018 at 3:39 PM, Mohammad kazem Akhgari < notifications@github.com> wrote:

does this work with caliburn micro?

I have a LineSeries called Chart. how do I make this connection from shell view model to shell view?

public class ChartItem
{
    public TimeSpan Value{ get; set; }
    public DateTime Time { get; set; }
}

BindableCollection<ChartItem> Chart { get; } = new BindableCollection<ChartItem>();

but adding items to Chart does not show in LineSeries.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xyzzer/WinRTXamlToolkit/issues/54, or mute the thread https://github.com/notifications/unsubscribe-auth/ABrAsFGE-SqSn8cFFpnQvoRXlFICFtQcks5tX0xLgaJpZM4SRoEa .

MkazemAkhgary commented 6 years ago

It works! I just had to write it correctly. @xyzzer

    <rt:Chart>
        <rt:Chart.Series>
            <rt:LineSeries ItemsSource="{Binding MyChart}"
                           DependentValuePath="Value.Milliseconds" IndependentValuePath="Time"/>
        </rt:Chart.Series>
    </rt:Chart>

Also BindableCollection causes a lot of GC pressure. ObservableCollection works like a charm, and List throws exception for some reason.

    private ObservableCollection<ChartItem> _myChart = new ObservableCollection<ChartItem>();
    public ObservableCollection<ChartItem> MyChart
    {
        get { return _myChart; }
        set
        {
            _myChart = value;
            NotifyOfPropertyChange(() => MyChart);
        }
    }
MkazemAkhgary commented 6 years ago

@xyzzer is there any documentation or tutorial on how to work with LineSerier?

I really liked your tool, but I have no idea what each property does. I couldn't find documentation anywhere so I'm just doing trial and error. its becoming frustrating :(

thanks in advance.