catel & the modern ui framework

Topics: Issues / bugs, Questions
Aug 24, 2013 at 4:30 PM
Hello, I'm quite new to MVVM and have spent the last week reading though articles/tutorials etc. and I'm quite excited about it all and really appreciate your effort with the catel project!
In my application I have a model where the base entity(Batch) has a number of sub-entities(navigational field) defined as IList<Production>
In my main view(catel page) is split in two, with a listview on the left and the selected output on the right. I also have the view model(catel vm) to back it up. The right side is the BatchView also backed with a BatchViewModel that takes a Batch as only constructor. Inside i Expose(..) the model properties, including the IList<Request>. My first question comes here: do I have to(and at what point exactly) transform the IList into a ObservableCollection? I mean, at the data layer my save operation just attaches the given entity to the context and saves).
Next comes the issue: the BatchView displays the collection of Requests in separate UserControls, inside an expander. Pretty much exactly like the example with the Houses. Except that it is really slow when using the modern ui framework for the window! In fact with the normal Window (or same with DataWindow) everything works instantly, where as selecting a different Batch on the left (right side is reloaded) takes like 1-2s. If using a direct item template in the BatchView for displaying the Requests (instead of the UserControls) it's ok, but naturally I want to use nested controls with their own view models. The slowdown seems to occur after the RequestViewModel constructor exits so I believe it's possible that this is not at all a catel related issue but I thought I'd have your opinion first. Thanks in advance! Here is the bit that slows things down(with mui):
        <ItemsControl Grid.ColumnSpan="3" ItemsSource="{Binding Requests}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Views:RequestView DataContext="{Binding}" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
Coordinator
Aug 24, 2013 at 4:52 PM
1) You only have to transform the list to ObservableCollection if you want the view to be notified about changes in the collection (adds, removals)

2) This is because the Modern UI does not work like a DataWindow and does not provide an InfoBarMessageControl. Check out the performance considerations.

If you want to go for speed (and remove validation in UI), disable the creation of the WarningAndErrorValidator as well.
Aug 24, 2013 at 5:01 PM
Sorry I forgot to mention that I already have that option set to false on all controls.
Coordinator
Aug 24, 2013 at 7:31 PM
Then please create a repro and upload an issue here:

https://catelproject.atlassian.net

Then we will look at this.
Aug 25, 2013 at 9:31 AM
I've created a simple repro but I can't seem to login (or find a Submit Issue button :)) in order to upload it..
Coordinator
Aug 25, 2013 at 10:38 AM
Aug 25, 2013 at 11:06 AM
Well I feel like I'm really wasting your time here :) I was struggling with the registration form last night, until I finally managed to sign in but was still not able to login to catelproject page. As I am looking at my confirmation mail it seems it isn't for the catelproject but atlassian in general. :) And anyway the signup displays a blank page after submitting, and I don't see the captcha on the form. (firefox)
Coordinator
Aug 25, 2013 at 1:15 PM
I am sorry about the inconvenience. I have removed the captcha requirement. You should be able to sign in now.
Aug 26, 2013 at 4:53 PM
Edited Aug 26, 2013 at 4:54 PM
Thank you!
And here is the solution, should anyone come across this discussion in the future:
public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            UserControlLogic.DefaultCreateWarningAndErrorValidatorForViewModelValue = false;
            UserControlLogic.DefaultSkipSearchingForInfoBarMessageControlValue = true;
            base.OnStartup(e);
        }
    }