How to mention source for BubbleSeries2D.Points - wpf

For a WPF project with Dev Express, is there a way i can define a series in the .xaml.cs file and reference this in the xaml file instead of manually writing the points as shown -
<Window x:Class="Bubble2DChart.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" Title="Window1" Height="350" Width="620">
<Grid>
<dxc:ChartControl>
<dxc:ChartControl.CrosshairOptions>
<dxc:CrosshairOptions ShowValueLine="True" ShowValueLabels="True"/>
</dxc:ChartControl.CrosshairOptions>
<dxc:ChartControl.Diagram>
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.Series>
<dxc:BubbleSeries2D Transparency="0.2" AutoSize="False" MinSize="1" MaxSize="3" ColorEach="True"
CrosshairLabelPattern="Argument: {A}; Value: {V}; Weight: {W}">
<dxc:BubbleSeries2D.Points>
<dxc:SeriesPoint Argument="A" Value="100" dxc:BubbleSeries2D.Weight="0.9" />
<dxc:SeriesPoint Argument="B" Value="60" dxc:BubbleSeries2D.Weight="0.8" />
<dxc:SeriesPoint Argument="C" Value="30" dxc:BubbleSeries2D.Weight="0.5" />
<dxc:SeriesPoint Argument="D" Value="43" dxc:BubbleSeries2D.Weight="0.4" />
<dxc:SeriesPoint Argument="E" Value="11" dxc:BubbleSeries2D.Weight="0.4"/>
<dxc:SeriesPoint Argument="F" Value="29" dxc:BubbleSeries2D.Weight="0.2"/>
<dxc:SeriesPoint Argument="G" Value="12" dxc:BubbleSeries2D.Weight="0.2"/>
<dxc:SeriesPoint Argument="H" Value="21" dxc:BubbleSeries2D.Weight="0.2"/>
<dxc:SeriesPoint Argument="I" Value="28" dxc:BubbleSeries2D.Weight="0.2"/>
</dxc:BubbleSeries2D.Points>
</dxc:BubbleSeries2D>
</dxc:XYDiagram2D.Series>
<dxc:XYDiagram2D.AxisY>
<dxc:AxisY2D GridLinesMinorVisible="True" >
<dxc:AxisY2D.WholeRange>
<dxc:Range MinValue="0" MaxValue="130"
SideMarginsValue="0" />
</dxc:AxisY2D.WholeRange>
</dxc:AxisY2D>
</dxc:XYDiagram2D.AxisY>
</dxc:XYDiagram2D>
</dxc:ChartControl.Diagram>
</dxc:ChartControl>
</Grid>

I suggest you to go through documentation: Bind a Series to a Data Source
To do this, assign your data source to the Series.DataSource property, and define the Series.ArgumentDataMember and Series.ValueDataMember properties.
You can bind a Chart to an Observable Collection, Data from an MDB File, Static Resource etc. You can follow the example to implement your functionality.

Related

how to set up the initial page of wpf modernui application

how to set up a custom startup page in a wpf modern ui application
the startup page seems automatically linked to /pages/home.xamal
how to change to /pages/mypage.xaml
the documentation is too poor
[EDITED]
<mui:ModernWindow x:Class="SailPost.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
Title="mui" IsTitleVisible="True"
LogoData="F1 M 24.9015,43.0378L 25.0963,43.4298C 26.1685,49.5853 31.5377,54.2651 38,54.2651C 44.4623,54.2651 49.8315,49.5854 50.9037,43.4299L 51.0985,43.0379C 51.0985,40.7643 52.6921,39.2955 54.9656,39.2955C 56.9428,39.2955 58.1863,41.1792 58.5833,43.0379C 57.6384,52.7654 47.9756,61.75 38,61.75C 28.0244,61.75 18.3616,52.7654 17.4167,43.0378C 17.8137,41.1792 19.0572,39.2954 21.0344,39.2954C 23.3079,39.2954 24.9015,40.7643 24.9015,43.0378 Z M 26.7727,20.5833C 29.8731,20.5833 32.3864,23.0966 32.3864,26.197C 32.3864,29.2973 29.8731,31.8106 26.7727,31.8106C 23.6724,31.8106 21.1591,29.2973 21.1591,26.197C 21.1591,23.0966 23.6724,20.5833 26.7727,20.5833 Z M 49.2273,20.5833C 52.3276,20.5833 54.8409,23.0966 54.8409,26.197C 54.8409,29.2973 52.3276,31.8106 49.2273,31.8106C 46.127,31.8106 43.6136,29.2973 43.6136,26.197C 43.6136,23.0966 46.127,20.5833 49.2273,20.5833 Z"
ContentSource="/Pages/Home.xaml">
<mui:ModernWindow.MenuLinkGroups>
<mui:LinkGroup DisplayName="SailPost Monitor">
<mui:LinkGroup.Links>
<mui:Link DisplayName="Home" Source="/Pages/Home.xaml" />
<mui:Link DisplayName="Monitor" Source="/Pages/SailPostMonitor.xaml" />
</mui:LinkGroup.Links>
</mui:LinkGroup>
<mui:LinkGroup DisplayName="Api Test Center">
<mui:LinkGroup.Links>
<mui:Link DisplayName="Test" Source="/Pages/ApiTestCenter.xaml" />
<mui:Link DisplayName="Test2" Source="/Pages/ApiTestCenter2.xaml" />
</mui:LinkGroup.Links>
</mui:LinkGroup>
<mui:LinkGroup DisplayName="settings" GroupKey="settings">
<mui:LinkGroup.Links>
<mui:Link DisplayName="software" Source="/Pages/SettingsPage.xaml" />
</mui:LinkGroup.Links>
</mui:LinkGroup>
</mui:ModernWindow.MenuLinkGroups>
<mui:ModernWindow.TitleLinks>
<mui:Link DisplayName="settings" Source="/Pages/SettingsPage.xaml" />
<mui:Link DisplayName="help" Source="https://github.com/firstfloorsoftware/mui" />
</mui:ModernWindow.TitleLinks>
</mui:ModernWindow>
Just set the ContentSource property of the ModernWindow to /Pages/SailPostMonitor.xaml:
<mui:ModernWindow x:Class="SailPost.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
Title="mui" IsTitleVisible="True"
LogoData="F1 M 24.9015,43.0378L 25.0963,43.4298C 26.1685,49.5853 31.5377,54.2651 38,54.2651C 44.4623,54.2651 49.8315,49.5854 50.9037,43.4299L 51.0985,43.0379C 51.0985,40.7643 52.6921,39.2955 54.9656,39.2955C 56.9428,39.2955 58.1863,41.1792 58.5833,43.0379C 57.6384,52.7654 47.9756,61.75 38,61.75C 28.0244,61.75 18.3616,52.7654 17.4167,43.0378C 17.8137,41.1792 19.0572,39.2954 21.0344,39.2954C 23.3079,39.2954 24.9015,40.7643 24.9015,43.0378 Z M 26.7727,20.5833C 29.8731,20.5833 32.3864,23.0966 32.3864,26.197C 32.3864,29.2973 29.8731,31.8106 26.7727,31.8106C 23.6724,31.8106 21.1591,29.2973 21.1591,26.197C 21.1591,23.0966 23.6724,20.5833 26.7727,20.5833 Z M 49.2273,20.5833C 52.3276,20.5833 54.8409,23.0966 54.8409,26.197C 54.8409,29.2973 52.3276,31.8106 49.2273,31.8106C 46.127,31.8106 43.6136,29.2973 43.6136,26.197C 43.6136,23.0966 46.127,20.5833 49.2273,20.5833 Z"
ContentSource="/Pages/SailPostMonitor.xaml">

How use Style in PageFunction?

How use Style in PageFunction?
This construction is not work:
<PageFunction.Resources>
<Style ... />
</PageFunction.Resources>

Images are not displayed on the buttons

I use the Fluent Ribbon (fluent.codeplex.com). I want to arrange four buttons side by side.
I use the following code:
<Fluent:RibbonGroupBox Header="Some Header">
<Fluent:RibbonToolBar>
<Fluent:RibbonToolBar.LayoutDefinitions>
<Fluent:RibbonToolBarLayoutDefinition Size="Small">
<Fluent:RibbonToolBarRow>
<Fluent:RibbonToolBarControlGroupDefinition>
<Fluent:RibbonToolBarControlDefinition Target="buttonFirst" />
<Fluent:RibbonToolBarControlDefinition Target="buttonPrevious" />
<Fluent:RibbonToolBarControlDefinition Target="buttonNext" />
<Fluent:RibbonToolBarControlDefinition Target="buttonLast" />
</Fluent:RibbonToolBarControlGroupDefinition>
</Fluent:RibbonToolBarRow>
</Fluent:RibbonToolBarLayoutDefinition>
</Fluent:RibbonToolBar.LayoutDefinitions>
<Fluent:Button Size="Small" Icon="/WpfApplication1;component/Resources/First_16.png" x:Name="buttonFirst" />
<Fluent:Button Size="Small" Icon="/WpfApplication1;component/Resources/Previous_16.png" x:Name="buttonPrevious" />
<Fluent:Button Size="Small" Icon="/WpfApplication1;component/Resources/Next_16.png" x:Name="buttonNext" />
<Fluent:Button Size="Small" Icon="/WpfApplication1;component/Resources/Last_16.png" x:Name="buttonLast" />
</Fluent:RibbonToolBar>
</Fluent:RibbonGroupBox>
The buttons are aligned correctly, but the buttons don't have a image. Where is the problem?
(The image files are available)
Sometimes you need to change 'Copy to Output Directory" setting. I usually use 'Always'. Or IfNewer if you have a lot and don't want a rebuild to constantly wipe and recopy.

Silverlight: Add a resource dictionary from another project

I have a XAML resource dictionary in project A. How can I merge it into a resource dictionary in project B?
Where Granite.Xaml is the library and ConvertersList.xaml has been marked as a resource.
<ResourceDictionary Source="/Granite.Xaml;component/ConvertersList.xaml" />
Here is the contents of the resource dictionary. Note that I had to include the assembly name in the namespace declaration even though the converters are in the same project as the dictionary. If you fail to do this you will get a runtime exception.
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Granite.Xaml.Converters;assembly=Granite.Xaml"
>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters:DebugBreakConverter x:Key="DebugBreakConverter" />
<converters:DebugTraceConverter x:Key="DebugTraceConverter" />
<converters:DictionaryConverter x:Key="DictionaryConverter" />
<converters:MaxLengthToBoolTrueConverter x:Key="MaxLengthToBoolTrueConverter" />
<converters:MinLengthToBoolTrueConverter x:Key="MinLengthToBoolTrueConverter" />
<converters:NotBoolToVisibilityConverter x:Key="NotBoolToVisibilityConverter" />
<converters:NotConverter x:Key="NotConverter" />
<converters:NotNullToBooleanConverter x:Key="NotNullToBooleanConverter" />
<converters:NotNullToVisibilityConverter x:Key="NotNullToVisibilityConverter" />
<converters:NotZeroToBooleanConverter x:Key="NotZeroToBooleanConverter" />
<converters:NotZeroToVisibilityConverter x:Key="NotZeroToVisibilityConverter" />
<converters:NullToBooleanConverter x:Key="NullToBooleanConverter" />
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
<converters:StringToBooleanConverter x:Key="StringToBooleanConverter" />
<converters:StringToLowerConverter x:Key="StringToLowerConverter" />
<converters:StringToUpperConverter x:Key="StringToUpperConverter" />
<converters:ZeroToBooleanConverter x:Key="ZeroToBooleanConverter" />
<converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" />
</ResourceDictionary>
This works for me:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Namespace.From.Your.Dll;component/Style.xaml"/>
</ResourceDictionary.MergedDictionaries>

How to know when a XAML element is finished loading

I have a custom control I'm developing that has a collection of items. When adding an item to the collection you're meant to do:
myCustomControl.BeginAddItems();
myCustomControl.Items.Add("a");
myCustomControl.Items.Add("b");
myCustomControl.Items.Add("c");
myCustomControl.EndAddItems();
If defining in XAML it would be:
<MyControl>
<Items>
<Item Name="a" />
<Item Name="b" />
<Item Name="c" />
</Items>
</MyControl>
How can I have EndAddItems (and ideally BeginAddItems) called when loading from XAML? Is there any way that MyControl can be notified by XAML that it has finished loading?
You can use the Loaded event

Resources