示例#1
0
        void ArrangeChildren(bool force)
        {
            if (widgets == null || rects == null)
            {
                return;
            }

            // Use the 'widgets' field so we can easily map a control position by looking at 'rects'.
            for (int i = 0; i < widgets.Length; i++)
            {
                var element = WidgetBackend.GetFrameworkElement(widgets [i]);
                if (!element.IsArrangeValid || !element.IsMeasureValid || force)
                {
                    // Measure the widget again using the allocation constraints. This is necessary
                    // because WPF widgets my cache some measurement information based on the
                    // constraints provided in the last Measure call (which when calculating the
                    // preferred size is normally set to infinite.
                    var r = rects[i].WithPositiveSize();
                    if (force)
                    {
                        // Don't recalculate the size unless a relayout is being forced
                        element.InvalidateMeasure();
                        element.Measure(new SW.Size(r.Width, r.Height));
                    }

                    element.Arrange(r.ToWpfRect());
                    //	element.UpdateLayout ();
                }
            }
        }
示例#2
0
        private void OnContentLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            WidgetBackend backend = (WidgetBackend)((FrameworkElement)sender).Tag;

            var surface = backend.Frontend as IWidgetSurface;

            if (surface == null)
            {
                return;
            }

            surface.Reallocate();
        }
示例#3
0
文件: BoxBackend.cs 项目: joncham/xwt
        void ArrangeChildren(bool force)
        {
            if (widgets == null || rects == null)
            {
                return;
            }

            // Use the 'widgets' field so we can easily map a control position by looking at 'rects'.
            for (int i = 0; i < widgets.Length; i++)
            {
                var element = WidgetBackend.GetFrameworkElement(widgets [i]);
                if (!element.IsArrangeValid || force)
                {
                    element.Arrange(DataConverter.ToWpfRect(rects [i]));
                }
            }
        }
示例#4
0
 public virtual void UpdateChildPlacement(IWidgetBackend childBackend)
 {
     WidgetBackend.SetChildPlacement(childBackend);
 }