I am asking question after these solutions.
I've met the same problem like Aaron did. I've did try the solutions you guys suggested but still getting the "System.Windows.Markup.XamlParseException occurred" error. The project is built successfully; the images show properly in the design mode; but failed at run time. The code:
The resource dictionary locates in "niuDesktopShare" project:
/niuDesktopShare/niuResourceDictionary.xaml
The Button Style:
<Style x:Key="TransparentButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Focusable" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" Margin="2,1,2,1" Padding="2,1,2,1" BorderThickness="1" Background="Transparent" CornerRadius="2,2,2,2">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource SolidBorderBrush}" />
<Setter TargetName="Border" Property="Background" Value="{StaticResource NormalBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Opacity" Value="0.2"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Inherited button style as Backward Button Style:
<Style x:Key="BackwardButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TransparentButtonStyle}">
<Setter Property="Content">
<Setter.Value>
<Image x:Name="imgBackward" Source="/niuDesktopShare;component/Images/Backhot32.ico" Height="32"/>
</Setter.Value>
</Setter>
</Style>
The xaml code uses the resource dictionary in the other project "niuDesktopContent"
/niuDesktopContent/MyToolBarTray.xaml:
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/niuDesktopShare;component/niuResourceDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<DockPanel Name="toolBarTray1" Background="Transparent" SnapsToDevicePixels="True">
<StackPanel Name="toolBarBrowser" Orientation="Horizontal" DockPanel.Dock="Left" SnapsToDevicePixels="True">
<Button Name="buttonPrevious" Command="niu:BrowserCommands.Back" Style="{StaticResource BackwardButtonStyle}"/>
</StackPanel>
</DockPanel>
The image locates in /niuDesktopShare/Images/Backhot32.ico, the "copy to output directory" is changed to "copy always"
Thanks!