|
|
|
@ -25,83 +25,98 @@ using System.Windows.Data;
@@ -25,83 +25,98 @@ using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents; |
|
|
|
|
using System.Windows.Input; |
|
|
|
|
using System.Windows.Media; |
|
|
|
|
using ICSharpCode.WpfDesign.Designer.themes; |
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.WpfDesign.Designer.Controls |
|
|
|
|
{ |
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for GridUnitSelector.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class GridUnitSelector : UserControl |
|
|
|
|
{ |
|
|
|
|
GridRailAdorner rail; |
|
|
|
|
public partial class GridUnitSelector : UserControl |
|
|
|
|
{ |
|
|
|
|
GridRailAdorner rail; |
|
|
|
|
|
|
|
|
|
public GridUnitSelector(GridRailAdorner rail) |
|
|
|
|
{ |
|
|
|
|
InitializeComponent(); |
|
|
|
|
public GridUnitSelector(GridRailAdorner rail) |
|
|
|
|
{ |
|
|
|
|
SpecialInitializeComponent(); |
|
|
|
|
|
|
|
|
|
this.rail = rail; |
|
|
|
|
} |
|
|
|
|
this.rail = rail; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Fixes InitializeComponent with multiple Versions of same Assembly loaded
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void SpecialInitializeComponent() |
|
|
|
|
{ |
|
|
|
|
if (!this._contentLoaded) { |
|
|
|
|
this._contentLoaded = true; |
|
|
|
|
Uri resourceLocator = new Uri(VersionedAssemblyResourceDictionary.GetXamlNameForType(this.GetType()), UriKind.Relative); |
|
|
|
|
Application.LoadComponent(this, resourceLocator); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.InitializeComponent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void FixedChecked(object sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
this.rail.SetGridLengthUnit(Unit); |
|
|
|
|
} |
|
|
|
|
void FixedChecked(object sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
this.rail.SetGridLengthUnit(Unit); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void StarChecked(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); |
|
|
|
|
} |
|
|
|
|
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 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 Orientation Orientation |
|
|
|
|
{ |
|
|
|
|
get { return (Orientation)GetValue(OrientationProperty); } |
|
|
|
|
set { SetValue(OrientationProperty, value); } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public DesignItem SelectedItem { get; set; } |
|
|
|
|
public DesignItem SelectedItem { get; set; } |
|
|
|
|
|
|
|
|
|
public GridUnitType Unit |
|
|
|
|
{ |
|
|
|
|
get |
|
|
|
|
{ |
|
|
|
|
if (auto.IsChecked == true) |
|
|
|
|
return GridUnitType.Auto; |
|
|
|
|
if (star.IsChecked == true) |
|
|
|
|
return GridUnitType.Star; |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
protected override void OnMouseLeave(MouseEventArgs e) |
|
|
|
|
{ |
|
|
|
|
base.OnMouseLeave(e); |
|
|
|
|
this.Visibility = Visibility.Hidden; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
protected override void OnMouseLeave(MouseEventArgs e) |
|
|
|
|
{ |
|
|
|
|
base.OnMouseLeave(e); |
|
|
|
|
this.Visibility = Visibility.Hidden; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|