Beispiel #1
0
 public AutoExpandBehaviour(TreeView treeView)
 {
     this.TreeView = treeView;
     BindingHelper.AddHandler(
         this.TreeView,
         ItemsControl.ItemsSourceProperty,
         typeof(ListView),
         this.OnItemsSourceChanged
         );
 }
Beispiel #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;
            }
        }
Beispiel #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);
 }
 public OffsetBehaviour(ScrollViewer scrollViewer)
 {
     this.ScrollViewer = scrollViewer;
     BindingHelper.AddHandler(this.ScrollViewer, VerticalValueProperty, typeof(ScrollViewer), this.OnVerticalValueChanged);
 }