Change programmaticaly style for container

4 posts, 0 answers
  1. nicolas
    nicolas avatar
    27 posts
    Member since:
    Mar 2017

    Posted 22 Nov Link to this post

    Hi,

    I have an application with Diagram using GraphSource.
    Actually i add Container with default styledefine by StyleSelector and i would like to allow my user to choose a different style.
    How can i do this ? If i use SelectedItem, i have a model not a shape or container so i can't define style.

    Thanks for your help.

    Nicolas

  2. Dinko
    Admin
    Dinko avatar
    462 posts

    Posted 27 Nov Link to this post

    Hello nicolas,

    To get the container shape from your model you can use the ContainerGenerator property and more specifically the ContainerFromItem() method.
    var containerShape = this.diagram.ContainerGenerator.ContainerFromItem(this.diagram.SelectedItem);

    Regards,
    Dinko
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. nicolas
    nicolas avatar
    27 posts
    Member since:
    Mar 2017

    Posted 27 Nov Link to this post

    thanks for the explanation, i'll try this code tonight.
  4. nicolas
    nicolas avatar
    27 posts
    Member since:
    Mar 2017

    Posted 03 Dec Link to this post

    thanks, that's working !
Back to Top