Modern UI ClusteredBarChart Does Not Exist In XML Namespace - wpf

I am using Metro charts for creating charts, but when I add chart and debug it says:
Error: The tag 'ClusteredBarChart' does not exist in XML namespace
'clr-namespace:De.TorstenMandelkow.MetroChart;assembly=De.TorstenMandelkow.MetroChart'.
Line 325 Position 22.
I have already added dll for WPF in reference and added name space as
xmlns:chart="clr-namespace:De.TorstenMandelkow.MetroChart;assembly=De.TorstenMandelkow.MetroChart"
I have no clue why it is giving this error?
EDIT:
this is code for adding chart control
<chart:ClusteredBarChart x:Name="barchart1" ChartSubTitle="Population in millions" ChartTitle="Countries by population">
<chart:ClusteredBarChart.Series>
<chart:ChartSeries DisplayMember="Name" ItemsSource="{Binding Path=Populations}" SeriesTitle="World largest populations" ValueMember="Count" />
</chart:ClusteredBarChart.Series>
</chart:ClusteredBarChart>

If you use the DLL under the Binaries/WPF folder, despite the error message, it will still work. If you download and compile the source code and use the resulting DLL from your compilation, the error message goes away.
<Window x:Class="WpfApplication249.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:chart="clr-namespace:De.TorstenMandelkow.MetroChart;assembly=De.TorstenMandelkow.MetroChart"
xmlns:local="clr-namespace:WpfApplication249"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Window.DataContext>
<local:MyViewModel/>
</Window.DataContext>
<Grid>
<chart:ClusteredBarChart x:Name="barchart1"
ChartSubTitle="Population in millions"
ChartTitle="Countries by population">
<chart:ClusteredBarChart.Series>
<chart:ChartSeries DisplayMember="Name"
ItemsSource="{Binding Path=Populations}"
SeriesTitle="World largest populations"
ValueMember="Count" />
</chart:ClusteredBarChart.Series>
</chart:ClusteredBarChart>
</Grid>

Related

Why am I getting an error loading resources/resources.xaml in the designer when I instantiate my WPF user control on a page?

I only get this error in the designer; my game runs just fine.
The error is "Cannot locate resource resources/resources.xaml". It only occurs on views where I reference my user control, and only in the designer - not when I design the user control itself, and not at runtime; I'm able to compile my game just fine even though I have this error.
Here is where I declare my user control instance:
<local:StatsView Grid.ColumnSpan="2" x:Name="stats"/>
And here are the relevant parts of my user control:
<UserControl x:Class="Wormholes.Views.StatsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wormholes.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary Source="/Resources/Resources.xaml" />
</UserControl.Resources>
<Grid>
...
</Grid>
</UserControl>
I'm also referencing this same Resources.xaml in each of my pages, in addition to from the user control; could this be causing the error? If so, how do I work around it?
You have used a Relative URI, so it will looks for your resource file in a somewhere that you used your UserControl. It can't find you resource file because your resource file is not in the AbsolutePath.
AbsolutePath = CurrentPath (r.g Where you used your UserControl) + RelativePath
so Use an AbsolutePath:
<ResourceDictionary Source="pack://application:,,,/{YourAssemblyName};component/Resources/Resources.xaml" />

"Live" data in XAML editor window in Visual Studio and running application

I am trying implementing an addin for SparxEA with the MVVM Light. One thing that I found interesting is seeing “live” data in a window as is mentioned in the course of MVVM Light. So, I would like to do the same. As I have Class Library project I can’t use App.XAML.
In XAML I have this code:
<Window x:Class="GoatJira.View.About"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GoatJira.View"
xmlns:viewmodel="clr-namespace:GoatJira.ViewModel"
mc:Ignorable="d"
Title="{Binding Path=AboutTitle}" Height="322.613" Width="573.608" ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterScreen" Initialized="Window_Initialized"
DataContext="{Binding Source={StaticResource ResourceKey=AboutData}}"
>
<Window.Resources>
<ResourceDictionary>
<viewmodel:AboutViewModel x:Key="AboutData"/>
</ResourceDictionary>
</Window.Resources>
…
This perfectly works within Visual Studio IDE. When I run the app and want to instantiate the window, I obtain this exception (translated from Czech): Source marked as AboutData was not found. Names of sources are case sensitive.
When I remove the 10th line with DataContext, I can’t see the bind data within the VS, on the other hand, application works fine when I assign the DataContext in code. My understanding is, that there is a way when it works in VS and in running app without changing anything.
Do you have any idea what I am doing wrong?
If needed, the whole code is at https://github.com/SlavekRydval/GoatJira.
What happens if you move the DataContext to after the resource section i.e.
<Window blah=for>
<Window.Resources>
<ResourceDictionary>
<viewmodel:AboutViewModel x:Key="AboutData"/>
</ResourceDictionary>
</Window.Resources>
<Window.DataContext>
<StaticResourceExtension ResourceKey="AboutData"/>
</Window.DataContext>

xaml desing issue with ZeroProximity.Accordian for window store app

I have the following MainPage.xaml:
<Page
x:Class="ComponentGuidTestUW8.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ComponentGuidTestUW8"
xmlns:controls="using:ZeroProximity.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<controls:Accordion>
<controls:AccordionItem Header="Heading 1">
<controls:AccordionItem.Content>
<TextBlock Text="Texting"/>
</controls:AccordionItem.Content>
</controls:AccordionItem>
</controls:Accordion>
</Grid>
The page does display the Accordion control properly when I run the app but I am getting the following error when I try to design xaml file in VS 2015:
"COMException: Error HRESULT E_FAIL has been returned from a call to a
COM component."
Desing Tab
How do I fix that?
Looks like this is an issue with the control: have you try to contact the author ?

Create Design Time Data in WPF

My MainWindow.xaml loads very slowly, so I'm trying to create a design-time data for that. I have checked some websites on the net and tried to create design-time data but it gives error.
Here is my part of xaml, the rest is wpf elements :
<Window x:Class="CodeFirstMVVM.App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cm="clr-namespace:System.ComponentModel;assembly=System"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:CodeFirstMVVM.App.ViewModels"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:CodeFirstMVVM.App.ViewModels"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=model:Ogrenci, IsDesignTimeCreatable=True}"
DataContext="{Binding Source={StaticResource Locator}, Path=OgrenciView}"
Title="MainWindow" Height="500" Width="900">
I get the error in this line :
d:DataContext="{d:DesignInstance Type=model:Ogrenci, IsDesignTimeCreatable=True}"
And the errors are :
Error 1 The namespace prefix "model" is not defined.
Error 2 Ogrenci is not supported in a Windows Presentation Foundation (WPF)
The DesignTimeViewModel is under CodeFirstMVVM.App, and it is simply an empty class with an empty constructor. Can you tell me how to create a design time data in a healthy way? I'm really stuck with this.

Inconsistency between XAML intellisense and compiler for a control

I am converting some Silverlight XAML into WPF. I currently have a user control (MyControl) that is trying to include a couple of other controls that are custom buttons (MyButton1) that are within the same assembly. I have the following XAML that compiles and works in SL:
MyButton1
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="MyCompany.MyNamespace.MySubnamespace.MyButton1"
d:DesignWidth="640" d:DesignHeight="480">
...
</UserControl>
MyControl
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:somename="clr-namespace:MyCompany.MyNamespace.MySubnamespace;assembly=MyCompany.MyAssemblyName"
mc:Ignorable="d"
x:Class="MyCompany.MyNamespace.MySubnamespace.MyControl"
d:DesignWidth="640" d:DesignHeight="480">
<somename:MyButton1 />
</UserControl>
When I try to compile this code in WPF, I get the following error:
The tag 'MyButton1' does not exist in XML namespace 'clr-namespace:MyCompany.MyNamespace.MySubnamespace;assembly=MyCompany.MyAssemblyName.'
The weird thing is, if I comment out the <somename:MyButton1 /> line of code and compile and then type in <somename: IntelliSense gives me the option to autocomplete MyButton1. Which suggests that the control itself is in the assembly but for some reason it is not being seen when the MyControl XAML is being compiled.
For some context, I took the SL csproj file and made some modifications to it manually to make it a WPF csproj file. If there is a possibility that this caused this funkiness to happen, I'd be glad to share relevant portions of the project file.
Found the answer on an MSDN forum. Turns out that the assembly=MyCompany.MyAssemblyName line in my xmlns was screwing things up. Once I removed that line, I was able to reference the controls.
Related Link: http://social.msdn.microsoft.com/Forums/en/wpf/thread/807c9b80-81c7-4f75-aa2f-8427e17b1a90
To reference the current assembly you must not type its name but leave it blank, i.e. assembly=, the other option is of course to drop it completely. (MSDN -> Mapping to Current Assemblies)

Resources