Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Bugfix Assembly Version Problem
Browse files Browse the repository at this point in the history
After this fix you can use the XamlDesigner also to Develop the XamlDesigner!!!
Before that we've had Bug's because of multiple loaded Assemblies with the same Name!
  • Loading branch information
jogibear9988 committed Dec 14, 2014
1 parent 5b0f28b commit b3ea4a0
Show file tree
Hide file tree
Showing 37 changed files with 650 additions and 207 deletions.
Expand Up @@ -30,14 +30,29 @@
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;
using ICSharpCode.WpfDesign.Designer.themes;

namespace ICSharpCode.WpfDesign.Designer.Controls
{
public partial class EnumBar
{
public EnumBar()
{
InitializeComponent();
SpecialInitializeComponent();
}

/// <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();
}

Type currentEnumType;
Expand Down
Expand Up @@ -25,83 +25,98 @@
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;
}
}

}
Expand Up @@ -18,6 +18,8 @@

using System;
using System.Linq;
using System.Windows;
using ICSharpCode.WpfDesign.Designer.themes;

namespace ICSharpCode.WpfDesign.Designer.Extensions
{
Expand All @@ -29,7 +31,21 @@ public ArrangeItemsContextMenu(DesignItem designItem)
{
this.designItem = designItem;

InitializeComponent();
SpecialInitializeComponent();
}

/// <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 Click_ArrangeLeft(object sender, System.Windows.RoutedEventArgs e)
Expand Down
Expand Up @@ -17,15 +17,9 @@
// DEALINGS IN THE SOFTWARE.

using System;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Xml;
using ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FormatedTextEditor;
using ICSharpCode.WpfDesign.Designer.Xaml;
using ICSharpCode.WpfDesign.XamlDom;
using ICSharpCode.WpfDesign.Designer.themes;

namespace ICSharpCode.WpfDesign.Designer.Extensions
{
Expand All @@ -37,7 +31,21 @@ public DefaultCommandsContextMenu(DesignItem designItem)
{
this.designItem = designItem;

InitializeComponent();
SpecialInitializeComponent();
}

/// <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();
}
}
}
Expand Up @@ -26,6 +26,7 @@
using ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FormatedTextEditor;
using ICSharpCode.WpfDesign.Designer.Xaml;
using ICSharpCode.WpfDesign.XamlDom;
using ICSharpCode.WpfDesign.Designer.themes;

namespace ICSharpCode.WpfDesign.Designer.Extensions
{
Expand All @@ -37,7 +38,21 @@ public EditStyleContextMenu(DesignItem designItem)
{
this.designItem = designItem;

InitializeComponent();
SpecialInitializeComponent();
}

/// <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 Click_EditStyle(object sender, RoutedEventArgs e)
Expand Down
Expand Up @@ -20,6 +20,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using ICSharpCode.WpfDesign.Designer.themes;

namespace ICSharpCode.WpfDesign.Designer.Extensions
{
Expand All @@ -31,7 +32,21 @@ public RightClickContextMenu(DesignItem designItem)
{
this.designItem = designItem;

InitializeComponent();
SpecialInitializeComponent();
}

/// <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 Click_BringToFront(object sender, RoutedEventArgs e)
Expand Down
Expand Up @@ -21,6 +21,7 @@
using System.Windows;
using ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FormatedTextEditor;
using ICSharpCode.WpfDesign.Designer.UIExtensions;
using ICSharpCode.WpfDesign.Designer.themes;

namespace ICSharpCode.WpfDesign.Designer.Extensions
{
Expand All @@ -32,7 +33,21 @@ public TextBlockRightClickContextMenu(DesignItem designItem)
{
this.designItem = designItem;

InitializeComponent();
SpecialInitializeComponent();
}

/// <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 Click_EditFormatedText(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit b3ea4a0

Please sign in to comment.