Is there a way to specify the assembly along with the namespace in C #?
For example, if you reference both PresentationFramework.Aero and PresentationFramework.Luna in a project, you may notice that both of them use the same controls in the same namespace, but with a different implementation.
Take ButtonChrome , for example. It exists in both assemblies under the Microsoft.Windows.Themes namespace.
In XAML, you enable assembly along with the namespace, so this is not a problem
xmlns:aeroTheme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:lunaTheme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna" <aeroTheme:ButtonChrome ../> <lunaTheme:ButtonChrome ../>
But in the C # code behind, I still can't create an instance of ButtonChrome in PresentationFramework.Aero .
The following code gives me error CS0433 when compiling
using Microsoft.Windows.Themes;
error CS0433 . The type 'Microsoft.Windows.Themes.ButtonChrome' exists as in 'c: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.0 \ Profile \ Client \ PresentationFramework.Aero.dll'
and
'c: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.0 \ Profile \ Client \ PresentationFramework.Luna.dll'
Which is very clear, the compiler does not know which ButtonChrome to choose, because I did not say that. Can I do it somehow?
Fredrik hedblad
source share