How to access a type with the same full name in two different DLLs

I need to reference both PresentationFramework.Classic and PresentationFramework.Luna assemblies, and I have a situation where I need to use the type Microsoft.Windows.Themes.DataGridHeaderBorder . But this gives an error, since both assemblies are of this type. I mean, I can refer to any of them (Classic or Luna) for this type, this is just a simple Datagrid, where I need to check if the DataGridHeaderBorder clicked.

Thanks in advance.

+1
source share
2 answers

This is the situation that external assembly aliases are accessing. You can also specify an alias for the link using the Aliases property in the link properties sheet in Visual Studio if compiling the command line is not your thing. See http://blogs.msdn.com/b/ansonh/archive/2006/09/27/774692.aspx for a complete example.

+2
source

Try the following:

 using Clasic = PresentationFramework.Classic; using Luna = PresentationFramework.Luna; namespace Test1 { class Program { static void Main(string[] args) { Clasic.Microsoft.Windows.Themes.DataGridHeaderBorder bClassic; Luna.Microsoft.Windows.Themes.DataGridHeaderBorder bLuna; } } } 
+3
source

Source: https://habr.com/ru/post/950556/


All Articles