System.Windows.Markup.XamlParseException on a Multi Project Solution (Mixed platforms)
up vote
0
down vote
favorite
I've integrated my WPF project into a mixed solution. This solution has 3 projects written in WinForms (.cs), 1 writtenin WinForms (.vb) and the mine one written in WPF (using MahApps).
The Owner of my project/windows must be the one of the three written in WinForm.
I've made a call like this:
using WPFSolution;
using System.Windows.Forms.Integration;
private void buttonOpenWPFUi_Click(object sender, EventArgs e)
{
var pm = new ProductsMenu();
ElementHost.EnableModelessKeyboardInterop(pm);
pm.Show();
}
ProductsMenu
is my starting point on in the App.xaml
But when I reach the InitializeComponents()
of the ProductsMenu.xaml.cs
the System.Windows.Markup.XamlParseException were thrown
The error is: IOException: Cannot locate resource 'resources/icons.xaml'.
My App.xaml file:
<Application x:Class="WPFSolution.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="ProductsMenu.xaml" ShutdownMode="OnMainWindowClose">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<!-- BaseDark.xaml | BaseLight.xaml -->
<!-- Icons -->
<ResourceDictionary Source="pack://application:,,,/WPFSolution;component/Resources/Icons.xaml"></ResourceDictionary>
<!-- Languages -->
<!--<ResourceDictionary Source="Resources/StringResources.en.xaml"></ResourceDictionary>-->
<ResourceDictionary Source="Resources/StringResources.it.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type ToolTip}">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="Red"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Padding" Value="7,4,7,4"/>
</Style>
<!--IMMAGINI -->
<!--nodi-->
<!--<BitmapImage x:Key="Nodo1" UriSource="Resources/img/TileImages/nodi/nodo1.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo2" UriSource="Resources/img/TileImages/nodi/nodo2.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo3" UriSource="Resources/img/TileImages/nodi/nodo3.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo4" UriSource="Resources/img/TileImages/nodi/nodo4.jpg"></BitmapImage>-->
</ResourceDictionary>
</Application.Resources>
I've tried to set the Icons.xaml/Build Action as Resource and also as Page.
I'm missing something?
c# wpf winforms mahapps.metro
add a comment |
up vote
0
down vote
favorite
I've integrated my WPF project into a mixed solution. This solution has 3 projects written in WinForms (.cs), 1 writtenin WinForms (.vb) and the mine one written in WPF (using MahApps).
The Owner of my project/windows must be the one of the three written in WinForm.
I've made a call like this:
using WPFSolution;
using System.Windows.Forms.Integration;
private void buttonOpenWPFUi_Click(object sender, EventArgs e)
{
var pm = new ProductsMenu();
ElementHost.EnableModelessKeyboardInterop(pm);
pm.Show();
}
ProductsMenu
is my starting point on in the App.xaml
But when I reach the InitializeComponents()
of the ProductsMenu.xaml.cs
the System.Windows.Markup.XamlParseException were thrown
The error is: IOException: Cannot locate resource 'resources/icons.xaml'.
My App.xaml file:
<Application x:Class="WPFSolution.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="ProductsMenu.xaml" ShutdownMode="OnMainWindowClose">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<!-- BaseDark.xaml | BaseLight.xaml -->
<!-- Icons -->
<ResourceDictionary Source="pack://application:,,,/WPFSolution;component/Resources/Icons.xaml"></ResourceDictionary>
<!-- Languages -->
<!--<ResourceDictionary Source="Resources/StringResources.en.xaml"></ResourceDictionary>-->
<ResourceDictionary Source="Resources/StringResources.it.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type ToolTip}">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="Red"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Padding" Value="7,4,7,4"/>
</Style>
<!--IMMAGINI -->
<!--nodi-->
<!--<BitmapImage x:Key="Nodo1" UriSource="Resources/img/TileImages/nodi/nodo1.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo2" UriSource="Resources/img/TileImages/nodi/nodo2.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo3" UriSource="Resources/img/TileImages/nodi/nodo3.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo4" UriSource="Resources/img/TileImages/nodi/nodo4.jpg"></BitmapImage>-->
</ResourceDictionary>
</Application.Resources>
I've tried to set the Icons.xaml/Build Action as Resource and also as Page.
I'm missing something?
c# wpf winforms mahapps.metro
IsWPFSolution
the name of the assembly that contains Icons.xaml?
– Clemens
yesterday
Yes, it's the assembly that contains the file. If i run the WPF solution as a standalone module, everything works fine.
– andrepogg
yesterday
And does the application project reference that assembly?
– Clemens
yesterday
Yes, I've added the references under: Solution Explorer > MainProject > References > Right Click > Add Reference... > Projects > WPFSolution... Then I checked that the whole solution has the same .NET Framework version (4.6.1)
– andrepogg
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I've integrated my WPF project into a mixed solution. This solution has 3 projects written in WinForms (.cs), 1 writtenin WinForms (.vb) and the mine one written in WPF (using MahApps).
The Owner of my project/windows must be the one of the three written in WinForm.
I've made a call like this:
using WPFSolution;
using System.Windows.Forms.Integration;
private void buttonOpenWPFUi_Click(object sender, EventArgs e)
{
var pm = new ProductsMenu();
ElementHost.EnableModelessKeyboardInterop(pm);
pm.Show();
}
ProductsMenu
is my starting point on in the App.xaml
But when I reach the InitializeComponents()
of the ProductsMenu.xaml.cs
the System.Windows.Markup.XamlParseException were thrown
The error is: IOException: Cannot locate resource 'resources/icons.xaml'.
My App.xaml file:
<Application x:Class="WPFSolution.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="ProductsMenu.xaml" ShutdownMode="OnMainWindowClose">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<!-- BaseDark.xaml | BaseLight.xaml -->
<!-- Icons -->
<ResourceDictionary Source="pack://application:,,,/WPFSolution;component/Resources/Icons.xaml"></ResourceDictionary>
<!-- Languages -->
<!--<ResourceDictionary Source="Resources/StringResources.en.xaml"></ResourceDictionary>-->
<ResourceDictionary Source="Resources/StringResources.it.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type ToolTip}">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="Red"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Padding" Value="7,4,7,4"/>
</Style>
<!--IMMAGINI -->
<!--nodi-->
<!--<BitmapImage x:Key="Nodo1" UriSource="Resources/img/TileImages/nodi/nodo1.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo2" UriSource="Resources/img/TileImages/nodi/nodo2.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo3" UriSource="Resources/img/TileImages/nodi/nodo3.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo4" UriSource="Resources/img/TileImages/nodi/nodo4.jpg"></BitmapImage>-->
</ResourceDictionary>
</Application.Resources>
I've tried to set the Icons.xaml/Build Action as Resource and also as Page.
I'm missing something?
c# wpf winforms mahapps.metro
I've integrated my WPF project into a mixed solution. This solution has 3 projects written in WinForms (.cs), 1 writtenin WinForms (.vb) and the mine one written in WPF (using MahApps).
The Owner of my project/windows must be the one of the three written in WinForm.
I've made a call like this:
using WPFSolution;
using System.Windows.Forms.Integration;
private void buttonOpenWPFUi_Click(object sender, EventArgs e)
{
var pm = new ProductsMenu();
ElementHost.EnableModelessKeyboardInterop(pm);
pm.Show();
}
ProductsMenu
is my starting point on in the App.xaml
But when I reach the InitializeComponents()
of the ProductsMenu.xaml.cs
the System.Windows.Markup.XamlParseException were thrown
The error is: IOException: Cannot locate resource 'resources/icons.xaml'.
My App.xaml file:
<Application x:Class="WPFSolution.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="ProductsMenu.xaml" ShutdownMode="OnMainWindowClose">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<!-- BaseDark.xaml | BaseLight.xaml -->
<!-- Icons -->
<ResourceDictionary Source="pack://application:,,,/WPFSolution;component/Resources/Icons.xaml"></ResourceDictionary>
<!-- Languages -->
<!--<ResourceDictionary Source="Resources/StringResources.en.xaml"></ResourceDictionary>-->
<ResourceDictionary Source="Resources/StringResources.it.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type ToolTip}">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="Red"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Padding" Value="7,4,7,4"/>
</Style>
<!--IMMAGINI -->
<!--nodi-->
<!--<BitmapImage x:Key="Nodo1" UriSource="Resources/img/TileImages/nodi/nodo1.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo2" UriSource="Resources/img/TileImages/nodi/nodo2.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo3" UriSource="Resources/img/TileImages/nodi/nodo3.jpg"></BitmapImage>
<BitmapImage x:Key="Nodo4" UriSource="Resources/img/TileImages/nodi/nodo4.jpg"></BitmapImage>-->
</ResourceDictionary>
</Application.Resources>
I've tried to set the Icons.xaml/Build Action as Resource and also as Page.
I'm missing something?
c# wpf winforms mahapps.metro
c# wpf winforms mahapps.metro
asked yesterday
andrepogg
9710
9710
IsWPFSolution
the name of the assembly that contains Icons.xaml?
– Clemens
yesterday
Yes, it's the assembly that contains the file. If i run the WPF solution as a standalone module, everything works fine.
– andrepogg
yesterday
And does the application project reference that assembly?
– Clemens
yesterday
Yes, I've added the references under: Solution Explorer > MainProject > References > Right Click > Add Reference... > Projects > WPFSolution... Then I checked that the whole solution has the same .NET Framework version (4.6.1)
– andrepogg
yesterday
add a comment |
IsWPFSolution
the name of the assembly that contains Icons.xaml?
– Clemens
yesterday
Yes, it's the assembly that contains the file. If i run the WPF solution as a standalone module, everything works fine.
– andrepogg
yesterday
And does the application project reference that assembly?
– Clemens
yesterday
Yes, I've added the references under: Solution Explorer > MainProject > References > Right Click > Add Reference... > Projects > WPFSolution... Then I checked that the whole solution has the same .NET Framework version (4.6.1)
– andrepogg
yesterday
Is
WPFSolution
the name of the assembly that contains Icons.xaml?– Clemens
yesterday
Is
WPFSolution
the name of the assembly that contains Icons.xaml?– Clemens
yesterday
Yes, it's the assembly that contains the file. If i run the WPF solution as a standalone module, everything works fine.
– andrepogg
yesterday
Yes, it's the assembly that contains the file. If i run the WPF solution as a standalone module, everything works fine.
– andrepogg
yesterday
And does the application project reference that assembly?
– Clemens
yesterday
And does the application project reference that assembly?
– Clemens
yesterday
Yes, I've added the references under: Solution Explorer > MainProject > References > Right Click > Add Reference... > Projects > WPFSolution... Then I checked that the whole solution has the same .NET Framework version (4.6.1)
– andrepogg
yesterday
Yes, I've added the references under: Solution Explorer > MainProject > References > Right Click > Add Reference... > Projects > WPFSolution... Then I checked that the whole solution has the same .NET Framework version (4.6.1)
– andrepogg
yesterday
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Got it (or a workaround at least).
- I've dereferenced the WPFSolution Project.
- Compiled the WPF solution
as .dll (I've copied all the merged dictionaries to every
window.xaml, removed the app.xaml file and change the application
type to class library) - Copied the WPFSolution.dll in the bin/release
- bin/debug of the main project - Referenced the .dll
Everything worked like a charm
add a comment |
up vote
0
down vote
try this syntax :
<ResourceDictionary Source="/WPFSolution;component/Resources/Icons.xaml" />
and also, "Page" is the right build option in this case
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Got it (or a workaround at least).
- I've dereferenced the WPFSolution Project.
- Compiled the WPF solution
as .dll (I've copied all the merged dictionaries to every
window.xaml, removed the app.xaml file and change the application
type to class library) - Copied the WPFSolution.dll in the bin/release
- bin/debug of the main project - Referenced the .dll
Everything worked like a charm
add a comment |
up vote
0
down vote
Got it (or a workaround at least).
- I've dereferenced the WPFSolution Project.
- Compiled the WPF solution
as .dll (I've copied all the merged dictionaries to every
window.xaml, removed the app.xaml file and change the application
type to class library) - Copied the WPFSolution.dll in the bin/release
- bin/debug of the main project - Referenced the .dll
Everything worked like a charm
add a comment |
up vote
0
down vote
up vote
0
down vote
Got it (or a workaround at least).
- I've dereferenced the WPFSolution Project.
- Compiled the WPF solution
as .dll (I've copied all the merged dictionaries to every
window.xaml, removed the app.xaml file and change the application
type to class library) - Copied the WPFSolution.dll in the bin/release
- bin/debug of the main project - Referenced the .dll
Everything worked like a charm
Got it (or a workaround at least).
- I've dereferenced the WPFSolution Project.
- Compiled the WPF solution
as .dll (I've copied all the merged dictionaries to every
window.xaml, removed the app.xaml file and change the application
type to class library) - Copied the WPFSolution.dll in the bin/release
- bin/debug of the main project - Referenced the .dll
Everything worked like a charm
answered yesterday
andrepogg
9710
9710
add a comment |
add a comment |
up vote
0
down vote
try this syntax :
<ResourceDictionary Source="/WPFSolution;component/Resources/Icons.xaml" />
and also, "Page" is the right build option in this case
add a comment |
up vote
0
down vote
try this syntax :
<ResourceDictionary Source="/WPFSolution;component/Resources/Icons.xaml" />
and also, "Page" is the right build option in this case
add a comment |
up vote
0
down vote
up vote
0
down vote
try this syntax :
<ResourceDictionary Source="/WPFSolution;component/Resources/Icons.xaml" />
and also, "Page" is the right build option in this case
try this syntax :
<ResourceDictionary Source="/WPFSolution;component/Resources/Icons.xaml" />
and also, "Page" is the right build option in this case
answered yesterday
David
4,50123247
4,50123247
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53409112%2fsystem-windows-markup-xamlparseexception-on-a-multi-project-solution-mixed-plat%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is
WPFSolution
the name of the assembly that contains Icons.xaml?– Clemens
yesterday
Yes, it's the assembly that contains the file. If i run the WPF solution as a standalone module, everything works fine.
– andrepogg
yesterday
And does the application project reference that assembly?
– Clemens
yesterday
Yes, I've added the references under: Solution Explorer > MainProject > References > Right Click > Add Reference... > Projects > WPFSolution... Then I checked that the whole solution has the same .NET Framework version (4.6.1)
– andrepogg
yesterday