Performance with many controls and propertychanged

9 posts, 0 answers
  1. Markus
    Markus avatar
    42 posts
    Member since:
    Nov 2012

    Posted 10 Oct 2013 Link to this post

    Hi,
    I'm using MvvM and the caliburn Micro toolset with the built in PropertyChangedBase.
    On my view I have approximately 15 PropertyGrids with each about 12 properties.

    In the background the user loads a xml file which is shown then in the view on the propertygrids.
    When I fire the NotifyOfPropertyChange the ui blocks and it takes long till the ui reacts again.
    The cpu usage goes up to ~25%. Is there a way to give this process more cpu usage or make the
    NotifyOfPropertyChange threaded? 

    Regards Markus
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 11 Oct 2013 Link to this post

    Hello Markus,

    Will it be possible to try setting IsVirtualizing property of the grid to 'True"and RenderMode to "Flat" ? Do you still get the same performance ?   

    Regards,
    Maya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Markus
    Markus avatar
    42 posts
    Member since:
    Nov 2012

    Posted 11 Oct 2013 Link to this post

    Hi,
    thank you for your approach. On my developer machine it works a little bit faster.
    On the client machines (Intel Atom Z2760 4x1,8Ghz, 2 GbRam, Win8) ther is a slight recognizable difference.
    I tested it with JustTrace. CPU Loading Time increased from 148 to 146 seconds.

    Regards Markus
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 11 Oct 2013 Link to this post

    Hello Markus,

    Will it be possible to clarify what exactly you do ? How do you define your property grids ? How do you raise PropertyChanged ? Generally, any relevant information and code snippets will be helpful. 

    Regards,
    Maya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Markus
    Markus avatar
    42 posts
    Member since:
    Nov 2012

    Posted 11 Oct 2013 Link to this post

    Hi,
    the general Layout in my view is:

    <Grid>
     <StackPanel>
      <HeaderedContentControl Header="1">
       <telerik:RadPropertyGrid Item="{Binding Path=Model.SelectedTask}">
        <telerik:RadPropertyGrid.PropertyDefinitions>
         <telerik:PropertyDefinition Binding="{Binding Name}"/>
         <telerik:PropertyDefinition Binding="{Binding Id}"/>
         <telerik:PropertyDefinition Binding="{Binding Adress}"/>
         ...
        </telerik:RadPropertyGrid.PropertyDefinitions>
       </telerik:RadPropertyGrid>
      </HeaderedContentControl>
      <HeaderedContentControl Header="2">
       <telerik:RadPropertyGrid Item="{Binding Path=Model.SelectedTask}">
        <telerik:RadPropertyGrid.PropertyDefinitions>
         <telerik:PropertyDefinition Binding="{Binding Name}"/>
         <telerik:PropertyDefinition Binding="{Binding Id}"/>
         <telerik:PropertyDefinition Binding="{Binding Adress}"/>
         ...
        </telerik:RadPropertyGrid.PropertyDefinitions>
       </telerik:RadPropertyGrid>
      </HeaderedContentControl>
      ...
     </StackPanel>
     ...
    </Grid>

    On my ViewModel I'm Injecting the Model which is singelton:

    public GModel Model{get;set;}
     
    public ViewModel()
    {
      Model = ServiceLocator.Current.GetInstance<Model>();
    }

    On my Model I'm using:

    public class GModel : PropertyChangedBase
    {
      private Task selectedTask;
     
      public Task SelectedTask
      {
        get
        {
          return selectedTask;
        }
        set
        {
          selectedTask= value;
          NotifyOfPropertyChange(() => SelectedTask);         
        }
      }
     
      public void SelectionChanged(Task task)
      {
          SelectedTask = task
      }
    }

    On the Task Class I have the properties.
    I fear this is bad practice! Is it better to have the properties in the ViewModel?

    Regards Markus
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Oct 2013 Link to this post

    Hi Markus,

    Please take a look at the sample attached and let me know whether the setup there is similar to yours. Is there something more specific that I need to do in order to reproduce the behavior you described with slower performance ?  

    Regards,
    Maya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. Markus
    Markus avatar
    42 posts
    Member since:
    Nov 2012

    Posted 15 Oct 2013 Link to this post

    Hi,
    thank you for your help!
    I will change the example to my conditions and test it.
    May I upload it, if the behaviour still exists?

    Regards Markus
  9. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Oct 2013 Link to this post

    Hello Markus,

    That would be great. Please open a support ticket and attach it there. Thanks in advance. 

    Regards,
    Maya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  10. Markus
    Markus avatar
    42 posts
    Member since:
    Nov 2012

    Posted 15 Oct 2013 Link to this post

    Thank you!
Back to Top
UI for WPF is Visual Studio 2017 Ready