Browse Source

improved GridRailAdorner with GridUnitSelector (only for rows currently)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5549 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Siegfried Pammer 16 years ago
parent
commit
66ce124332
  1. 10
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml
  2. 265
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridAdorner.cs
  3. 29
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridUnitSelector.xaml
  4. 84
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridUnitSelector.xaml.cs
  5. 4
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridAdornerProvider.cs
  6. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/SelectionService.cs
  7. 5
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj
  8. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/WpfDesign.csproj

10
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml

@ -308,16 +308,6 @@ @@ -308,16 +308,6 @@
</Setter>
</Style>
<Style TargetType="{x:Type Controls:GridRailAdorner}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:GridRailAdorner}">
<Rectangle Fill="#302020ff" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:GridRowSplitterAdorner}">
<Setter Property="Template">
<Setter.Value>

265
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridAdorner.cs

@ -7,6 +7,8 @@ @@ -7,6 +7,8 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@ -19,11 +21,15 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -19,11 +21,15 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
/// <summary>
/// Adorner that displays the blue bar next to grids that can be used to create new rows/column.
/// </summary>
public class GridRailAdorner : Control
public class GridRailAdorner : FrameworkElement
{
static GridRailAdorner()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(GridRailAdorner), new FrameworkPropertyMetadata(typeof(GridRailAdorner)));
bgBrush = new SolidColorBrush(Color.FromArgb(0x30, 0x20, 0x20, 0xff));
bgBrush.Freeze();
selBrush = new SolidColorBrush(Color.FromArgb(0xC0, 0xff, 0xb7, 0x4f));
selBrush.Freeze();
}
readonly DesignItem gridItem;
@ -31,6 +37,10 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -31,6 +37,10 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
readonly AdornerPanel adornerPanel;
readonly GridSplitterAdorner previewAdorner;
readonly Orientation orientation;
readonly GridUnitSelector unitSelector;
static readonly SolidColorBrush bgBrush;
static readonly SolidColorBrush selBrush;
public const double RailSize = 10;
public const double RailDistance = 6;
@ -46,21 +56,106 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -46,21 +56,106 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
this.adornerPanel = adornerPanel;
this.orientation = orientation;
this.unitSelector = new GridUnitSelector(this);
adornerPanel.Children.Add(unitSelector);
gridItem.Services.Selection.SelectionChanged += delegate {
if (orientation == Orientation.Vertical) {
if (gridItem.Properties["RowDefinitions"].CollectionElements.Any(e => gridItem.Services.Selection.IsComponentSelected(e)))
unitSelector.Visibility = Visibility.Visible;
else
unitSelector.Visibility = Visibility.Hidden;
} else {
if (gridItem.Properties["ColumnDefinitions"].CollectionElements.Any(e => gridItem.Services.Selection.IsComponentSelected(e)))
unitSelector.Visibility = Visibility.Visible;
else
unitSelector.Visibility = Visibility.Hidden;
}
InvalidateVisual();
};
if (orientation == Orientation.Horizontal) {
this.Height = RailSize;
previewAdorner = new GridColumnSplitterAdorner(gridItem, null, null);
previewAdorner = new GridColumnSplitterAdorner(this, gridItem, null, null);
} else { // vertical
this.Width = RailSize;
previewAdorner = new GridRowSplitterAdorner(gridItem, null, null);
previewAdorner = new GridRowSplitterAdorner(this, gridItem, null, null);
}
unitSelector.Orientation = orientation;
previewAdorner.IsPreview = true;
previewAdorner.IsHitTestVisible = false;
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
if (orientation == Orientation.Horizontal) {
Rect bgRect = new Rect(0, 0, grid.ActualWidth, RailSize);
drawingContext.DrawRectangle(bgBrush, null, bgRect);
DesignItemProperty colCollection = gridItem.Properties["ColumnDefinitions"];
foreach (var colItem in colCollection.CollectionElements) {
ColumnDefinition column = colItem.Component as ColumnDefinition;
Rect selRect = new Rect(column.Offset, 0, column.ActualWidth, RailSize);
GridLength len = (GridLength)column.GetValue(ColumnDefinition.WidthProperty);
FormattedText text = new FormattedText(GridLengthToText(len), CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Sergio UI"), 10, Brushes.Black);
text.TextAlignment = TextAlignment.Center;
if (gridItem.Services.Selection.IsComponentSelected(colItem)) {
drawingContext.DrawRectangle(selBrush, null, selRect);
}
drawingContext.DrawText(text, new Point(column.Offset + column.ActualWidth / 2, 0));
}
} else {
Rect bgRect = new Rect(0, 0, RailSize, grid.ActualHeight);
drawingContext.DrawRectangle(bgBrush, null, bgRect);
DesignItemProperty rowCollection = gridItem.Properties["RowDefinitions"];
foreach (var rowItem in rowCollection.CollectionElements) {
RowDefinition row = rowItem.Component as RowDefinition;
Rect selRect = new Rect(0, row.Offset, RailSize, row.ActualHeight);
GridLength len = (GridLength)row.GetValue(RowDefinition.HeightProperty);
FormattedText text = new FormattedText(GridLengthToText(len), CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Sergio UI"), 10, Brushes.Black);
text.TextAlignment = TextAlignment.Center;
if (gridItem.Services.Selection.IsComponentSelected(rowItem)) {
drawingContext.DrawRectangle(selBrush, null, selRect);
}
drawingContext.PushTransform(new RotateTransform(-270));
drawingContext.PushTransform(new TranslateTransform(0, -10));
drawingContext.DrawText(text, new Point(row.Offset + row.ActualHeight / 2, 0));
drawingContext.Pop();
drawingContext.Pop();
}
}
}
#region Handle mouse events to add a new row/column
protected override void OnMouseEnter(MouseEventArgs e)
{
base.OnMouseEnter(e);
if (orientation == Orientation.Vertical) {
double insertionPosition = e.GetPosition(this).Y;
RowDefinition current = grid.RowDefinitions
.FirstOrDefault(r => insertionPosition >= r.Offset &&
insertionPosition <= (r.Offset + r.ActualHeight));
if (current == null || !gridItem.Services.Selection.IsComponentSelected(gridItem.Services.Component.GetDesignItem(current)))
return;
} else {
double insertionPosition = e.GetPosition(this).X;
ColumnDefinition current = grid.ColumnDefinitions
.FirstOrDefault(r => insertionPosition >= r.Offset &&
insertionPosition <= (r.Offset + r.ActualWidth));
if (current == null || !gridItem.Services.Selection.IsComponentSelected(gridItem.Services.Component.GetDesignItem(current)))
return;
}
adornerPanel.Children.Add(previewAdorner);
}
@ -68,20 +163,48 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -68,20 +163,48 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
{
base.OnMouseMove(e);
RelativePlacement rp = new RelativePlacement();
RelativePlacement rpUnitSelector = new RelativePlacement();
if (orientation == Orientation.Vertical) {
double insertionPosition = e.GetPosition(this).Y;
RowDefinition current = grid.RowDefinitions
.FirstOrDefault(r => insertionPosition >= r.Offset &&
insertionPosition <= (r.Offset + r.ActualHeight));
DesignItem component;
if (current == null || !gridItem.Services.Selection.IsComponentSelected(component = gridItem.Services.Component.GetDesignItem(current)))
return;
rp.XOffset = -(RailSize + RailDistance);
rp.WidthOffset = RailSize + RailDistance;
rp.WidthRelativeToContentWidth = 1;
rp.HeightOffset = SplitterWidth;
rp.YOffset = e.GetPosition(this).Y - SplitterWidth / 2;
rpUnitSelector.XOffset = -(RailSize + RailDistance) * 2.75;
rpUnitSelector.WidthOffset = RailSize + RailDistance;
rpUnitSelector.WidthRelativeToContentWidth = 1;
rpUnitSelector.HeightOffset = 55;
rpUnitSelector.YOffset = current.Offset + current.ActualHeight / 2 - 25;
unitSelector.SelectedItem = component;
} else {
double insertionPosition = e.GetPosition(this).X;
ColumnDefinition current = grid.ColumnDefinitions
.FirstOrDefault(r => insertionPosition >= r.Offset &&
insertionPosition <= (r.Offset + r.ActualWidth));
if (current == null || !gridItem.Services.Selection.IsComponentSelected(gridItem.Services.Component.GetDesignItem(current)))
return;
rp.YOffset = -(RailSize + RailDistance);
rp.HeightOffset = RailSize + RailDistance;
rp.HeightRelativeToContentHeight = 1;
rp.WidthOffset = SplitterWidth;
rp.XOffset = e.GetPosition(this).X - SplitterWidth / 2;
}
AdornerPanel.SetPlacement(previewAdorner, rp);
AdornerPanel.SetPlacement(unitSelector, rpUnitSelector);
}
protected override void OnMouseLeave(MouseEventArgs e)
@ -97,14 +220,42 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -97,14 +220,42 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
Focus();
adornerPanel.Children.Remove(previewAdorner);
if (orientation == Orientation.Vertical) {
using (ChangeGroup changeGroup = gridItem.OpenGroup("Split grid row")) {
DesignItemProperty rowCollection = gridItem.Properties["RowDefinitions"];
double insertionPosition = e.GetPosition(this).Y;
DesignItemProperty rowCollection = gridItem.Properties["RowDefinitions"];
DesignItem currentRow = null;
using (ChangeGroup changeGroup = gridItem.OpenGroup("Change selection")) {
if (rowCollection.CollectionElements.Count == 0) {
DesignItem firstRow = gridItem.Services.Component.RegisterComponentForDesigner(new RowDefinition());
rowCollection.CollectionElements.Add(firstRow);
grid.UpdateLayout(); // let WPF assign firstRow.ActualHeight
currentRow = firstRow;
} else {
RowDefinition current = grid.RowDefinitions
.FirstOrDefault(r => insertionPosition >= r.Offset &&
insertionPosition <= (r.Offset + r.ActualHeight));
if (current != null)
currentRow = gridItem.Services.Component.GetDesignItem(current);
}
if (currentRow == null)
currentRow = gridItem.Services.Component.GetDesignItem(grid.RowDefinitions.Last());
unitSelector.SelectedItem = currentRow;
if (!gridItem.Services.Selection.IsComponentSelected(currentRow)) {
gridItem.Services.Selection.SetSelectedComponents(new DesignItem[] { currentRow }, SelectionTypes.Auto);
if (!adornerPanel.Children.Contains(previewAdorner))
adornerPanel.Children.Add(previewAdorner);
OnMouseMove(e);
return;
}
double insertionPosition = e.GetPosition(this).Y;
}
using (ChangeGroup changeGroup = gridItem.OpenGroup("Split grid row")) {
for (int i = 0; i < grid.RowDefinitions.Count; i++) {
RowDefinition row = grid.RowDefinitions[i];
if (row.Offset > insertionPosition) continue;
@ -126,14 +277,42 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -126,14 +277,42 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
}
}
} else {
using (ChangeGroup changeGroup = gridItem.OpenGroup("Split grid column")) {
DesignItemProperty columnCollection = gridItem.Properties["ColumnDefinitions"];
double insertionPosition = e.GetPosition(this).X;
DesignItemProperty columnCollection = gridItem.Properties["ColumnDefinitions"];
DesignItem currentColumn = null;
using (ChangeGroup changeGroup = gridItem.OpenGroup("Change selection")) {
if (columnCollection.CollectionElements.Count == 0) {
DesignItem firstColumn = gridItem.Services.Component.RegisterComponentForDesigner(new ColumnDefinition());
columnCollection.CollectionElements.Add(firstColumn);
grid.UpdateLayout(); // let WPF assign firstColumn.ActualWidth
currentColumn = firstColumn;
} else {
ColumnDefinition current = grid.ColumnDefinitions
.FirstOrDefault(r => insertionPosition >= r.Offset &&
insertionPosition <= (r.Offset + r.ActualWidth));
if (current != null)
currentColumn = gridItem.Services.Component.GetDesignItem(current);
}
double insertionPosition = e.GetPosition(this).X;
if (currentColumn == null)
currentColumn = gridItem.Services.Component.GetDesignItem(grid.ColumnDefinitions.Last());
unitSelector.SelectedItem = currentColumn;
if (!gridItem.Services.Selection.IsComponentSelected(currentColumn)) {
gridItem.Services.Selection.SetSelectedComponents(new DesignItem[] { currentColumn }, SelectionTypes.Auto);
if (!adornerPanel.Children.Contains(previewAdorner))
adornerPanel.Children.Add(previewAdorner);
OnMouseMove(e);
InvalidateVisual();
return;
}
}
using (ChangeGroup changeGroup = gridItem.OpenGroup("Split grid column")) {
for (int i = 0; i < grid.ColumnDefinitions.Count; i++) {
ColumnDefinition column = grid.ColumnDefinitions[i];
if (column.Offset > insertionPosition) continue;
@ -171,16 +350,61 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -171,16 +350,61 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
}
static void SplitLength(GridLength oldLength, double insertionPosition, double oldActualValue,
out GridLength newLength1, out GridLength newLength2)
out GridLength newLength1, out GridLength newLength2)
{
if (oldLength.IsAuto) {
oldLength = new GridLength(oldActualValue);
}
double percentage = insertionPosition / oldActualValue;
newLength1 = new GridLength(oldLength.Value * percentage, oldLength.GridUnitType);
newLength2 = new GridLength(oldLength.Value - newLength1.Value, oldLength.GridUnitType);
newLength1 = new GridLength((int)(oldLength.Value * percentage), oldLength.GridUnitType);
newLength2 = new GridLength((int)(oldLength.Value - newLength1.Value), oldLength.GridUnitType);
}
#endregion
string GridLengthToText(GridLength len)
{
switch (len.GridUnitType) {
case GridUnitType.Auto:
return "Auto";
case GridUnitType.Star:
return len.Value == 1 ? "*" : Math.Round(len.Value, 2) + "*";
case GridUnitType.Pixel:
return Math.Round(len.Value, 2) + "px";
}
return string.Empty;
}
public void SetGridLengthUnit(GridUnitType unit)
{
DesignItem item = unitSelector.SelectedItem;
GridLength value;
grid.UpdateLayout();
Debug.Assert(item != null);
if (orientation == Orientation.Vertical) {
value = (GridLength)item.Properties[RowDefinition.HeightProperty].ValueOnInstance;
if (unit == GridUnitType.Auto)
value = GridLength.Auto;
else
value = new GridLength(value.Value, unit);
item.Properties[RowDefinition.HeightProperty].SetValue(value);
} else {
switch (unit) {
case GridUnitType.Auto:
(item.Component as ColumnDefinition).SetValue(ColumnDefinition.WidthProperty, GridLength.Auto);
break;
default:
break;
}
}
grid.UpdateLayout();
InvalidateVisual();
}
}
public abstract class GridSplitterAdorner : Control
@ -191,14 +415,16 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -191,14 +415,16 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
protected readonly Grid grid;
protected readonly DesignItem gridItem;
protected readonly DesignItem firstRow, secondRow; // can also be columns
protected readonly GridRailAdorner rail;
internal GridSplitterAdorner(DesignItem gridItem, DesignItem firstRow, DesignItem secondRow)
internal GridSplitterAdorner(GridRailAdorner rail, DesignItem gridItem, DesignItem firstRow, DesignItem secondRow)
{
Debug.Assert(gridItem != null);
this.grid = (Grid)gridItem.Component;
this.gridItem = gridItem;
this.firstRow = firstRow;
this.secondRow = secondRow;
this.rail = rail;
}
public bool IsPreview {
@ -268,7 +494,9 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -268,7 +494,9 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
new2 = new GridLength(originalPixelSize2 - delta);
firstRow.Properties[RowColumnSizeProperty].SetValue(new1);
secondRow.Properties[RowColumnSizeProperty].SetValue(new2);
((UIElement)VisualTreeHelper.GetParent(this)).InvalidateArrange();
UIElement e = ((UIElement)VisualTreeHelper.GetParent(this));
e.InvalidateArrange();
rail.InvalidateVisual();
}
protected override void OnMouseUp(MouseButtonEventArgs e)
@ -312,8 +540,8 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -312,8 +540,8 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
CursorProperty.OverrideMetadata(typeof(GridRowSplitterAdorner), new FrameworkPropertyMetadata(Cursors.SizeNS));
}
internal GridRowSplitterAdorner(DesignItem gridItem, DesignItem firstRow, DesignItem secondRow) : base(gridItem, firstRow, secondRow)
internal GridRowSplitterAdorner(GridRailAdorner rail, DesignItem gridItem, DesignItem firstRow, DesignItem secondRow)
: base(rail, gridItem, firstRow, secondRow)
{
}
@ -345,7 +573,8 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -345,7 +573,8 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
CursorProperty.OverrideMetadata(typeof(GridColumnSplitterAdorner), new FrameworkPropertyMetadata(Cursors.SizeWE));
}
internal GridColumnSplitterAdorner(DesignItem gridItem, DesignItem firstRow, DesignItem secondRow) : base(gridItem, firstRow, secondRow)
internal GridColumnSplitterAdorner(GridRailAdorner rail, DesignItem gridItem, DesignItem firstRow, DesignItem secondRow)
: base(rail, gridItem, firstRow, secondRow)
{
}

29
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridUnitSelector.xaml

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
<UserControl x:Class="ICSharpCode.WpfDesign.Designer.Controls.GridUnitSelector"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="control" HorizontalContentAlignment="Left" VerticalContentAlignment="Top">
<UserControl.Resources>
<Style TargetType="RadioButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<ToggleButton
IsChecked="{Binding Path=IsChecked, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
Content="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"
Padding="{Binding Path=Padding, RelativeSource={RelativeSource TemplatedParent}}"
Name="toggleButton"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Border CornerRadius="3" BorderBrush="CornflowerBlue" Background="LightBlue" BorderThickness="1">
<StackPanel Orientation="{Binding Orientation, ElementName=control}">
<RadioButton x:Name="fixed" Content="Fixed" Margin="1" FontSize="8" GroupName="group" Checked="FixedChecked" />
<RadioButton x:Name="star" Margin="1" FontSize="16" GroupName="group" Checked="StarChecked">
<TextBlock Text="*" Margin="3,-4,3,-8"/>
</RadioButton>
<RadioButton x:Name="auto" Content="Auto" Margin="1" FontSize="8" GroupName="group" Checked="AutoChecked" />
</StackPanel>
</Border>
</UserControl>

84
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridUnitSelector.xaml.cs

@ -0,0 +1,84 @@ @@ -0,0 +1,84 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="siegfriedpammer@gmail.com" />
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
/// <summary>
/// Interaction logic for GridUnitSelector.xaml
/// </summary>
public partial class GridUnitSelector : UserControl
{
GridRailAdorner rail;
public GridUnitSelector(GridRailAdorner rail)
{
InitializeComponent();
this.rail = rail;
}
void FixedChecked(object sender, RoutedEventArgs e)
{
this.rail.SetGridLengthUnit(Unit);
}
void StarChecked(object sender, RoutedEventArgs e)
{
this.rail.SetGridLengthUnit(Unit);
}
void AutoChecked(object sender, RoutedEventArgs e)
{
this.rail.SetGridLengthUnit(Unit);
}
public static readonly DependencyProperty OrientationProperty =
DependencyProperty.Register("Orientation", typeof(Orientation), typeof(GridUnitSelector),
new FrameworkPropertyMetadata());
public Orientation Orientation {
get { return (Orientation)GetValue(OrientationProperty); }
set { SetValue(OrientationProperty, value); }
}
public DesignItem SelectedItem { get; set; }
public GridUnitType Unit {
get {
if (auto.IsChecked == true)
return GridUnitType.Auto;
if (star.IsChecked == true)
return GridUnitType.Star;
return GridUnitType.Pixel;
}
set {
switch (value) {
case GridUnitType.Auto:
auto.IsChecked = true;
break;
case GridUnitType.Star:
star.IsChecked = true;
break;
default:
@fixed.IsChecked = true;
break;
}
}
}
}
}

4
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridAdornerProvider.cs

@ -117,7 +117,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -117,7 +117,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
IList<DesignItem> col = this.ExtendedItem.Properties["RowDefinitions"].CollectionElements;
for (int i = 1; i < grid.RowDefinitions.Count; i++) {
RowDefinition row = grid.RowDefinitions[i];
GridRowSplitterAdorner splitter = new GridRowSplitterAdorner(this.ExtendedItem, col[i-1], col[i]);
GridRowSplitterAdorner splitter = new GridRowSplitterAdorner(leftBar, this.ExtendedItem, col[i-1], col[i]);
AdornerPanel.SetPlacement(splitter, new RowSplitterPlacement(row));
adornerPanel.Children.Add(splitter);
splitterList.Add(splitter);
@ -125,7 +125,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -125,7 +125,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
col = this.ExtendedItem.Properties["ColumnDefinitions"].CollectionElements;
for (int i = 1; i < grid.ColumnDefinitions.Count; i++) {
ColumnDefinition column = grid.ColumnDefinitions[i];
GridColumnSplitterAdorner splitter = new GridColumnSplitterAdorner(this.ExtendedItem, col[i-1], col[i]);
GridColumnSplitterAdorner splitter = new GridColumnSplitterAdorner(topBar, this.ExtendedItem, col[i-1], col[i]);
AdornerPanel.SetPlacement(splitter, new ColumnSplitterPlacement(column));
adornerPanel.Children.Add(splitter);
splitterList.Add(splitter);

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/SelectionService.cs

@ -53,6 +53,9 @@ namespace ICSharpCode.WpfDesign.Designer.Services @@ -53,6 +53,9 @@ namespace ICSharpCode.WpfDesign.Designer.Services
{
if (components == null)
components = SharedInstances.EmptyDesignItemArray;
if (components.Contains(null))
throw new ArgumentException("Cannot select 'null'.");
var prevSelectedItems = _selectedComponents.ToArray();

5
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj

@ -88,6 +88,10 @@ @@ -88,6 +88,10 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Controls\GridAdorner.cs" />
<Compile Include="Controls\GridUnitSelector.xaml.cs">
<DependentUpon>GridUnitSelector.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Controls\NumericUpDown.cs">
<DependentUpon>NumericUpDown.xaml</DependentUpon>
</Compile>
@ -228,6 +232,7 @@ @@ -228,6 +232,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Controls\GridUnitSelector.xaml" />
<Page Include="Controls\NumericUpDown.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/WpfDesign.csproj

@ -130,4 +130,7 @@ @@ -130,4 +130,7 @@
<ItemGroup>
<CodeAnalysisDictionary Include="Configuration\CodeAnalysisDictionary.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="ProfilingSessions\Session20100219_112744.sdps" />
</ItemGroup>
</Project>
Loading…
Cancel
Save