MVVM ColumnDefinitions

2 posts, 0 answers
  1. robert
    robert avatar
    27 posts
    Member since:
    Aug 2011

    Posted 29 Aug 2014 Link to this post

    Hello, is there a possibility to bind a list of columndefinition in viewmodel on GanttGrid without direct access to the gantcontrol (gantt.Columns.add)?
    Best Regards Robert ...
    public void InitGanttColumns()
            {
                //Title ----
                ColumnDefinition GanttColumn = new TreeColumnDefinition();
                GanttColumn.Header = "Title";
                GanttColumn.Width = 200;
                GanttColumn.MemberBinding = new Binding("Title");
                GanttColumns.Add(GanttColumn);
         
                // Start ----
                GanttColumn = new ColumnDefinition();
                GanttColumn.Header = "Start";
                GanttColumn.Width = 100;
     
                var itemsBinding = new Binding("Start")
                {
                    Converter = new GanttModuleTypeConverter(),
                    ConverterParameter = "date"
                };
     
                GanttColumn.MemberBinding = itemsBinding;
                GanttColumns.Add(GanttColumn);
                 
                // End ----
                GanttColumn = new ColumnDefinition();
                GanttColumn.Header = "End";
                GanttColumn.Width = 100;
     
                itemsBinding = new Binding("End")
                {
                    Converter = new GanttModuleTypeConverter(),
                    ConverterParameter = "date"
                };
     
                GanttColumn.MemberBinding = itemsBinding;
                GanttColumns.Add(GanttColumn);
            }
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 01 Sep 2014 Link to this post

    Hello Robert,

    I am afraid that Columns property of the GanttView is not bindable, You could try to implement the needed approach with attached property as demonstrates in the following blog post;
    http://blogs.telerik.com/xamlteam/posts/13-01-14/extending-the-functionality-of-radcontrols-with-attached-properties

    However, please note that we haven't tested this and we cannot guarantee that it will work without any problems.

    Regards,
    Yana
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top