Esempio n. 1
0
 public AutoExpandBehaviour(TreeView treeView)
 {
     this.TreeView = treeView;
     BindingHelper.AddHandler(
         this.TreeView,
         ItemsControl.ItemsSourceProperty,
         typeof(ListView),
         this.OnItemsSourceChanged
         );
 }
Esempio n. 2
0
 public GroupStyleBehaviour(ListView listView)
 {
     this.ListView         = listView;
     this.ScriptingContext = ScriptingRuntime.CreateContext();
     BindingHelper.AddHandler(
         this.ListView,
         ItemsControl.ItemsSourceProperty,
         typeof(ListView),
         this.OnItemsSourceChanged
         );
 }
        protected virtual void UpdateLayoutSource()
        {
            if (this.Parent == null)
            {
                return;
            }
            var grid = this.Parent.FindAncestor <Grid>();

            if (grid == null)
            {
                return;
            }
            var index = default(int);

            switch (this.SizeMode)
            {
            case SquareUIComponentSizeMode.ToWidth:
                var column = default(ColumnDefinition);
                index = Grid.GetColumn(this);
                if (index < grid.ColumnDefinitions.Count)
                {
                    column = grid.ColumnDefinitions[index];
                    BindingHelper.AddHandler(column, ColumnDefinition.WidthProperty, typeof(ColumnDefinition), (sender, e) =>
                    {
                        this.UpdateLayoutSource(column);
                    });
                }
                this.UpdateLayoutSource(column);
                break;

            case SquareUIComponentSizeMode.ToHeight:
                var row = default(RowDefinition);
                index = Grid.GetRow(this);
                if (index < grid.RowDefinitions.Count)
                {
                    row = grid.RowDefinitions[index];
                    BindingHelper.AddHandler(row, RowDefinition.HeightProperty, typeof(RowDefinition), (sender, e) =>
                    {
                        this.UpdateLayoutSource(row);
                    });
                }
                this.UpdateLayoutSource(row);
                break;
            }
        }
Esempio n. 4
0
 protected override void OnVisualParentChanged(DependencyObject oldParent)
 {
     if (this.Parent != null)
     {
         var row  = default(RowDefinition);
         var grid = this.Parent.FindAncestor <Grid>();
         if (grid != null)
         {
             var index = Grid.GetRow(this);
             if (index < grid.RowDefinitions.Count)
             {
                 row = grid.RowDefinitions[index];
                 BindingHelper.AddHandler(row, RowDefinition.HeightProperty, typeof(RowDefinition), (sender, e) =>
                 {
                     this.UpdateLayoutSource(row);
                 });
             }
         }
         this.UpdateLayoutSource(row);
     }
     base.OnVisualParentChanged(oldParent);
 }
Esempio n. 5
0
 public OffsetBehaviour(ScrollViewer scrollViewer)
 {
     this.ScrollViewer = scrollViewer;
     BindingHelper.AddHandler(this.ScrollViewer, VerticalValueProperty, typeof(ScrollViewer), this.OnVerticalValueChanged);
 }