Пример #1
0
        private double ProvideCompactWidth(SetsViewItem set, object item, double availableWidth)
        {
            // If we're selected and have a value for that, then just return that.
            if (set.IsSelected && !double.IsNaN(SelectedSetWidth))
            {
                return(SelectedSetWidth);
            }

            // Otherwise use min size.
            return(set.MinWidth);
        }
Пример #2
0
        private double ProvideEqualWidth(SetsViewItem set, object item, double availableWidth)
        {
            if (double.IsNaN(SelectedSetWidth))
            {
                if (Items.Count <= 1)
                {
                    return(availableWidth);
                }

                return(Math.Max(set.MinWidth, availableWidth / Items.Count));
            }
            else if (Items.Count() <= 1)
            {
                // Default case of a single set, make it full size.
                return(Math.Min(SelectedSetWidth, availableWidth));
            }
            else
            {
                var width = (availableWidth - SelectedSetWidth) / (Items.Count - 1);

                // Constrain between Min and Selected (Max)
                if (width < set.MinWidth)
                {
                    width = set.MinWidth;
                }
                else if (width > SelectedSetWidth)
                {
                    width = SelectedSetWidth;
                }

                // If it's selected make it full size, otherwise whatever the size should be.
                return(set.IsSelected
                    ? Math.Min(SelectedSetWidth, availableWidth)
                    : width);
            }
        }
Пример #3
0
 private static void SetOriginalWidth(SetsViewItem obj, double value)
 {
     obj.SetValue(OriginalWidthProperty, value);
 }
Пример #4
0
 // Attached property for storing widths of sets if set by other means during layout.
 private static double GetOriginalWidth(SetsViewItem obj)
 {
     return((double)obj.GetValue(OriginalWidthProperty));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SetDraggedOutsideEventArgs"/> class.
 /// </summary>
 /// <param name="item">data context of element dragged</param>
 /// <param name="set"><see cref="SetsViewItem"/> container being dragged.</param>
 public SetDraggedOutsideEventArgs(object item, SetsViewItem set)
 {
     Item = item;
     Set  = set;
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetClosingEventArgs"/> class.
 /// </summary>
 /// <param name="item">Item being closed.</param>
 /// <param name="set"><see cref="SetsViewItem"/> container being closed.</param>
 public SetClosingEventArgs(object item, SetsViewItem set)
 {
     Item = item;
     Set  = set;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetSelectedEventArgs"/> class.
 /// </summary>
 /// <param name="item">Selected item.</param>
 /// <param name="set"><see cref="SetsViewItem"/> Selected set.</param>
 public SetSelectedEventArgs(object item, SetsViewItem set)
 {
     Item = item;
     Set  = set;
 }