Skip to content

Commit 6ea37e9

Browse files
committed
´refactor after merge, add net6 support
1 parent b87b18b commit 6ea37e9

File tree

8 files changed

+44
-35
lines changed

8 files changed

+44
-35
lines changed

WpfDesign.Design.ExpressionBlendInteractionAddon/WpfDesign.Designer.ExpressionBlendInteractionAddon.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4-
<TargetFrameworks>net45;net5.0-windows</TargetFrameworks>
4+
<TargetFrameworks>net45;net5.0-windows;net6.0-windows</TargetFrameworks>
55
<UseWPF>true</UseWPF>
66
<AssemblyName>ICSharpCode.WpfDesign.Designer.ExpressionBlendInteractionAddon</AssemblyName>
77
<RootNamespace>ICSharpCode.WpfDesign.Designer.ExpressionBlendInteractionAddon</RootNamespace>
@@ -12,7 +12,7 @@
1212
<Copyright>2000-2021 AlphaSierraPapa for the SharpDevelop Team</Copyright>
1313
</PropertyGroup>
1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
15+
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
1616
</ItemGroup>
1717
<ItemGroup>
1818
<ProjectReference Include="..\WpfDesign.Designer\Project\WpfDesign.Designer.csproj" />

WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
Width="4*" />
2323
</Grid.ColumnDefinitions>
2424
<Border
25+
Name="ListBoxBorder"
2526
BorderBrush="Black"
2627
BorderThickness="0.75"
27-
Margin="10"
28+
Margin="10,40,10,10"
2829
SnapsToDevicePixels="True">
2930
<Border.Resources>
3031
<ResourceDictionary>
@@ -39,21 +40,18 @@
3940
SelectionChanged="ListBox_SelectionChanged" ItemTemplateSelector="{StaticResource CollectionTemplateSelector}">
4041
</ListBox>
4142
</Border>
42-
<ComboBox Name="ItemDataType"
43-
Grid.Column="1"
43+
<ComboBox Name="ItemDataType"
4444
Height="23"
45-
HorizontalAlignment="Left"
45+
HorizontalAlignment="Center"
4646
VerticalAlignment="Top"
47-
Width="75" Margin="0,10,0,0">
48-
49-
</ComboBox>
47+
Width="259" Margin="0,10,0,0"/>
5048
<Button
5149
Content="Add"
5250
Click="OnAddItemClicked"
5351
Grid.Column="1"
5452
Height="23"
5553
HorizontalAlignment="Left"
56-
Margin="0,40,0,0"
54+
Margin="0,10,0,0"
5755
Name="AddItem"
5856
VerticalAlignment="Top"
5957
Width="75" />
@@ -63,7 +61,7 @@
6361
Grid.Column="1"
6462
Height="23"
6563
HorizontalAlignment="Left"
66-
Margin="0,68,0,0"
64+
Margin="0,40,0,0"
6765
Name="RemoveItem"
6866
VerticalAlignment="Top"
6967
Width="75" />

WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml.cs

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public void SpecialInitializeComponent()
6565

6666
public Type GetItemsSourceType(Type t)
6767
{
68+
if (t == typeof(UIElementCollection))
69+
return typeof(UIElement);
70+
6871
Type tp = t.GetInterfaces().FirstOrDefault(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(ICollection<>));
6972

7073
return (tp != null ) ? tp.GetGenericArguments()[0] : null;
@@ -79,32 +82,40 @@ public void LoadItemsCollection(DesignItemProperty itemProperty)
7982
_type = _type ?? GetItemsSourceType(_itemProperty.ReturnType);
8083

8184
if (_type == null) {
82-
AddItem.IsEnabled=false;
85+
AddItem.IsEnabled = false;
8386
}
8487

8588
ListBox.ItemsSource = _itemProperty.CollectionElements;
8689
}
8790

88-
/// <summary>
89-
/// A method which fill a combobox with _type and the inherited classes.
90-
/// </summary>
9191
public void LoadItemsCombobox()
9292
{
93-
ItemDataType.Items.Add(_type);
94-
ItemDataType.SelectedItem = ItemDataType.Items[0];
95-
foreach (var items in GetInheritedClasses(_type))
96-
ItemDataType.Items.Add(items);
97-
93+
if (this._type != null)
94+
{
95+
var types = new List<Type>();
96+
types.Add(_type);
97+
98+
foreach (var items in GetInheritedClasses(_type))
99+
types.Add(items);
100+
ItemDataType.ItemsSource = types;
101+
ItemDataType.SelectedItem = types[0];
102+
103+
if (types.Count < 2)
104+
{
105+
ItemDataType.Visibility = Visibility.Collapsed;
106+
ListBoxBorder.Margin = new Thickness(10);
107+
}
108+
}
109+
else
110+
{
111+
ItemDataType.Visibility = Visibility.Collapsed;
112+
ListBoxBorder.Margin = new Thickness(10);
113+
}
98114
}
99115

100-
/// <summary>
101-
/// A Method to find all inherited classes.
102-
/// </summary>
103-
/// <param name="MyType">The type where we want the inherited classes.</param>
104-
/// <returns>All inherited classes.</returns>
105-
private IEnumerable<Type> GetInheritedClasses(Type MyType)
116+
private IEnumerable<Type> GetInheritedClasses(Type type)
106117
{
107-
return Assembly.GetAssembly(MyType).GetTypes().Where(TheType => TheType.IsClass && !TheType.IsAbstract && TheType.IsSubclassOf(MyType));
118+
return AppDomain.CurrentDomain.GetAssemblies().Where(x => !x.IsDynamic).SelectMany(x => x.GetTypes().Where(y => y.IsClass && !y.IsAbstract && y.IsSubclassOf(type)));
108119
}
109120

110121
private void OnAddItemClicked(object sender, RoutedEventArgs e)

WpfDesign.Designer/Project/WpfDesign.Designer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4-
<TargetFrameworks>net45;net5.0-windows</TargetFrameworks>
4+
<TargetFrameworks>net45;net5.0-windows;net6.0-windows</TargetFrameworks>
55
<UseWPF>true</UseWPF>
66
<AssemblyName>ICSharpCode.WpfDesign.Designer</AssemblyName>
77
<DocumentationFile>..\..\bin\net5.0-windows\ICSharpCode.WpfDesign.Designer.xml</DocumentationFile>

WpfDesign.Designer/Tests/WpfDesign.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<AssemblyName>ICSharpCode.WpfDesign.Tests</AssemblyName>
88
</PropertyGroup>
99
<ItemGroup>
10-
<PackageReference Include="NUnit" Version="3.13.1" />
11-
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
10+
<PackageReference Include="NUnit" Version="3.13.2" />
11+
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
1212
<PackageReference Include="RhinoMocks" Version="3.6.1" />
1313
</ItemGroup>
1414
<ItemGroup>

WpfDesign.XamlDom/Project/WpfDesign.XamlDom.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4-
<TargetFrameworks>net45;net5.0-windows</TargetFrameworks>
4+
<TargetFrameworks>net45;net5.0-windows;net6.0-windows</TargetFrameworks>
55
<DocumentationFile>..\..\bin\net5.0-windows\ICSharpCode.WpfDesign.XamlDom.xml</DocumentationFile>
66
<OutputPath>..\..\bin\</OutputPath>
77
<UseWPF>true</UseWPF>

WpfDesign/Project/WpfDesign.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4-
<TargetFrameworks>net45;net5.0-windows</TargetFrameworks>
4+
<TargetFrameworks>net45;net5.0-windows;net6.0-windows</TargetFrameworks>
55
<DocumentationFile>..\..\bin\net5.0-windows\ICSharpCode.WpfDesign.xml</DocumentationFile>
66
<OutputPath>..\..\bin\</OutputPath>
77
<UseWPF>true</UseWPF>

XamlDesigner/Demo.XamlDesigner.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>WinExe</OutputType>
4-
<TargetFramework>net5.0-windows</TargetFramework>
4+
<TargetFramework>net6.0-windows</TargetFramework>
55
<UseWPF>true</UseWPF>
66
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
77
<ApplicationIcon />
@@ -14,8 +14,8 @@
1414
</None>
1515
</ItemGroup>
1616
<ItemGroup>
17-
<PackageReference Include="AvalonEdit" Version="6.1.1" />
18-
<PackageReference Include="Dirkster.AvalonDock" Version="4.50.3" />
17+
<PackageReference Include="AvalonEdit" Version="6.1.3.50" />
18+
<PackageReference Include="Dirkster.AvalonDock" Version="4.60.1" />
1919
</ItemGroup>
2020
<ItemGroup>
2121
<ProjectReference Include="..\WpfDesign.Design.ExpressionBlendInteractionAddon\WpfDesign.Designer.ExpressionBlendInteractionAddon.csproj" />

0 commit comments

Comments
 (0)