Skip to content

Commit e16d5a8

Browse files
Merge pull request #1 from SyncfusionExamples/Adding_Musical_Chart_App
Adding musical chart demo
2 parents e0b187d + e59a904 commit e16d5a8

18 files changed

+946
-2
lines changed

MusicalChart/MusicalChart.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36202.13 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MusicalChart", "MusicalChart\MusicalChart.csproj", "{1323368D-AE6D-4844-8E2D-879B8534BC5B}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{1323368D-AE6D-4844-8E2D-879B8534BC5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{1323368D-AE6D-4844-8E2D-879B8534BC5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{1323368D-AE6D-4844-8E2D-879B8534BC5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{1323368D-AE6D-4844-8E2D-879B8534BC5B}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {3138D91D-F6B1-4BE8-9CB9-C9D651DFD410}
24+
EndGlobalSection
25+
EndGlobal

MusicalChart/MusicalChart/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="MusicalChart.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:MusicalChart"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Configuration;
2+
using System.Data;
3+
using System.Windows;
4+
5+
namespace MusicalChart
6+
{
7+
/// <summary>
8+
/// Interaction logic for App.xaml
9+
/// </summary>
10+
public partial class App : Application
11+
{
12+
}
13+
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]
784 KB
Binary file not shown.
784 KB
Binary file not shown.
784 KB
Binary file not shown.
784 KB
Binary file not shown.
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
<Window x:Class="MusicalChart.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:chart="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Syncfusion.SfChart.WPF"
7+
xmlns:local="clr-namespace:MusicalChart"
8+
mc:Ignorable="d" Title="Musical Chart">
9+
10+
<Window.Background>
11+
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
12+
<GradientStop Color="#F9EB8B" Offset="0.0" />
13+
<GradientStop Color="#F9E151" Offset="0.5" />
14+
<GradientStop Color="#FAD71B" Offset="1.0" />
15+
</LinearGradientBrush>
16+
</Window.Background>
17+
18+
<Window.DataContext>
19+
<local:MusicViewModel x:Name="viewModel"/>
20+
</Window.DataContext>
21+
22+
<Window.Resources>
23+
<BooleanToVisibilityConverter x:Key="visibilityConverter"/>
24+
25+
<Geometry x:Key="PathData">
26+
M0,25.400002L9.7000122,25.400002 9.7000122,29.4 0,29.4z M0,17.299997L13.700012,17.299997 13.700012,21.299997 0,21.299997z M0,9.4999973L17.799988,9.4999973 17.799988,13.500011 0,13.500011z M0,1.8000026L19.299988,1.8000026 19.299988,5.8000013 0,5.8000013z M21.100037,0L25.5,0 31.400024,5.9000074C31.400024,5.9000074 32,6.4999978 32,6.9999978 32,7.70001 31.400024,8.3000003 30.700012,8.3000003 30.600037,8.3000003 29.799988,7.9000064 29.700012,7.8000008L25.5,4.3000018 25.5,26.100014C25.5,29.000006 23.100037,31.4 20.200012,31.4 17.299988,31.4 14.900024,29.000006 14.900024,26.100014 14.900024,23.199989 17.299988,20.799997 20.200012,20.799997 20.5,20.799997 20.799988,20.799997 21.100037,20.900004z
27+
</Geometry>
28+
29+
<Style x:Key="MusicCheckboxStyle" TargetType="CheckBox">
30+
<Setter Property="Foreground" Value="#321B0B" />
31+
<Setter Property="VerticalAlignment" Value="Center" />
32+
<Setter Property="RenderTransform">
33+
<Setter.Value>
34+
<ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
35+
</Setter.Value>
36+
</Setter>
37+
</Style>
38+
39+
<Style x:Key="MusicButtonStyle" TargetType="Button">
40+
<Setter Property="Background" Value="#321B0B" />
41+
<Setter Property="Foreground" Value="White" />
42+
<Setter Property="FontWeight" Value="Bold" />
43+
<Setter Property="Padding" Value="15,8" />
44+
<Setter Property="Margin" Value="5,0" />
45+
<Style.Triggers>
46+
<Trigger Property="IsEnabled" Value="False">
47+
<Setter Property="Opacity" Value="0.5" />
48+
<Setter Property="Background" Value="#8C7A6B" />
49+
</Trigger>
50+
</Style.Triggers>
51+
</Style>
52+
53+
<Style x:Key="instrumentLabelStyle" TargetType="Label">
54+
<Setter Property="Foreground" Value="#321B0B"/>
55+
<Setter Property="FontSize" Value="17"/>
56+
<Setter Property="FontWeight" Value="SemiBold"/>
57+
<Setter Property="VerticalAlignment" Value="Center"/>
58+
<Setter Property="Margin" Value="15,5,0,0"/>
59+
</Style>
60+
61+
</Window.Resources>
62+
63+
<Grid Margin="10">
64+
65+
<Grid.RowDefinitions>
66+
<RowDefinition Height="1*"/>
67+
<RowDefinition Height="9*"/>
68+
</Grid.RowDefinitions>
69+
70+
<Grid.ColumnDefinitions>
71+
<ColumnDefinition Width="1*" />
72+
<ColumnDefinition Width="9*" />
73+
</Grid.ColumnDefinitions>
74+
75+
<Grid Grid.Row="0" Grid.ColumnSpan="2">
76+
<Grid.ColumnDefinitions>
77+
<ColumnDefinition Width="1.1*"/>
78+
<ColumnDefinition Width="7.4*"/>
79+
<ColumnDefinition Width="1.5*"/>
80+
</Grid.ColumnDefinitions>
81+
82+
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
83+
<Path Data="{StaticResource PathData}" Stroke="#321B0B" Fill="#321B0B" Margin="0,5,0,0"/>
84+
<Label Content="Sync Musical Chart" FontSize="23" Foreground="#321B0B" Margin="0,0,0,5"/>
85+
</StackPanel>
86+
87+
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5">
88+
<Button Content="Play All" Command="{Binding PlayAllCommand}" Style="{StaticResource MusicButtonStyle}"
89+
IsEnabled="{Binding IsPlayButtonEnabled}" Margin="0,20,0,0"/>
90+
<Button Content="Stop All" Command="{Binding StopAllCommand}" Style="{StaticResource MusicButtonStyle}"
91+
IsEnabled="{Binding IsStopButtonEnabled}" Margin="0,20,0,0"/>
92+
</StackPanel>
93+
94+
</Grid>
95+
96+
<!-- Instrument Selection Panel -->
97+
98+
<Grid Grid.Column="0" Grid.Row="1">
99+
<Grid.RowDefinitions>
100+
<RowDefinition Height="*"/>
101+
<RowDefinition Height="*"/>
102+
<RowDefinition Height="*"/>
103+
<RowDefinition Height="*"/>
104+
</Grid.RowDefinitions>
105+
<Grid.ColumnDefinitions>
106+
<ColumnDefinition Width="Auto"/>
107+
<ColumnDefinition Width="*"/>
108+
</Grid.ColumnDefinitions>
109+
110+
<!-- Drums -->
111+
<CheckBox Grid.Row="3" Grid.Column="0" IsChecked="{Binding IsDrumsEnabled}" Style="{StaticResource MusicCheckboxStyle}"/>
112+
<Label Grid.Row="3" Grid.Column="1" Content="Drums" Style="{StaticResource instrumentLabelStyle}"/>
113+
114+
<!-- Bass -->
115+
<CheckBox Grid.Row="2" Grid.Column="0" IsChecked="{Binding IsBassEnabled}" Style="{StaticResource MusicCheckboxStyle}"/>
116+
<Label Grid.Row="2" Grid.Column="1" Content="Bass" Style="{StaticResource instrumentLabelStyle}"/>
117+
118+
<!-- Others -->
119+
<CheckBox Grid.Row="1" Grid.Column="0" IsChecked="{Binding IsOthersEnabled}" Style="{StaticResource MusicCheckboxStyle}"/>
120+
<Label Grid.Row="1" Grid.Column="1" Content="Others" Style="{StaticResource instrumentLabelStyle}"/>
121+
122+
<!-- Vocals -->
123+
<CheckBox Grid.Row="0" Grid.Column="0" IsChecked="{Binding IsVocalsEnabled}" Style="{StaticResource MusicCheckboxStyle}"/>
124+
<Label Grid.Row="0" Grid.Column="1" Content="Vocals" Style="{StaticResource instrumentLabelStyle}"/>
125+
</Grid>
126+
127+
<chart:SfChart Grid.Column="1" Grid.Row="1" Background="WhiteSmoke" Palette="Custom" >
128+
<chart:SfChart.PrimaryAxis>
129+
<chart:NumericalAxis Visibility="Hidden"
130+
PlotOffsetEnd="20" ShowGridLines="False">
131+
</chart:NumericalAxis>
132+
</chart:SfChart.PrimaryAxis>
133+
134+
<chart:SfChart.SecondaryAxis>
135+
<chart:NumericalAxis Minimum="0" Maximum="120" Interval="30" Visibility="Hidden" >
136+
137+
<chart:NumericalAxis.MajorGridLineStyle>
138+
<Style TargetType="Line">
139+
<Setter Property="Stroke" Value="#CC321B0B"/>
140+
<Setter Property="StrokeDashArray" Value="2,3"/>
141+
<Setter Property="StrokeThickness" Value="1"/>
142+
</Style>
143+
</chart:NumericalAxis.MajorGridLineStyle>
144+
145+
<chart:NumericalAxis.StripLines>
146+
<chart:ChartStripLine Start="60" Width="30" Background="#003405" />
147+
</chart:NumericalAxis.StripLines>
148+
149+
</chart:NumericalAxis>
150+
</chart:SfChart.SecondaryAxis>
151+
152+
<chart:SfChart.Annotations>
153+
<chart:VerticalLineAnnotation x:Name="playbackLine" X1="{Binding PlaybackPosition}"
154+
Stroke="Green" StrokeThickness="2.5">
155+
</chart:VerticalLineAnnotation>
156+
</chart:SfChart.Annotations>
157+
158+
<chart:SfChart.Series>
159+
160+
<!-- Drums -->
161+
<chart:ScatterSeries Visibility="{Binding IsDrumsEnabled, Converter={StaticResource visibilityConverter}}" SegmentColorPath="ColorPath"
162+
ItemsSource="{Binding DrumsData}" XBindingPath="X" YBindingPath="Y" ScatterHeight="6" ScatterWidth="6"/>
163+
164+
<!-- Bass -->
165+
<chart:LineSeries Visibility="{Binding IsBassEnabled, Converter={StaticResource visibilityConverter}}" SegmentColorPath="ColorPath"
166+
ItemsSource="{Binding BassData}" XBindingPath="X" YBindingPath="Y" StrokeThickness="2" >
167+
<chart:LineSeries.AdornmentsInfo>
168+
<chart:ChartAdornmentInfo ShowMarker="True" Symbol="Diamond" SymbolHeight="6" SymbolWidth="6"/>
169+
</chart:LineSeries.AdornmentsInfo>
170+
</chart:LineSeries>
171+
172+
<!-- Others -->
173+
<chart:ScatterSeries Visibility="{Binding IsOthersEnabled, Converter={StaticResource visibilityConverter}}" SegmentColorPath="ColorPath"
174+
ItemsSource="{Binding OthersData}" XBindingPath="X" YBindingPath="Y" ScatterHeight="6" ScatterWidth="6">
175+
176+
177+
</chart:ScatterSeries>
178+
179+
<!-- Vocals -->
180+
<chart:StepLineSeries Visibility="{Binding IsVocalsEnabled, Converter={StaticResource visibilityConverter}}" SegmentColorPath="ColorPath"
181+
ItemsSource="{Binding VocalsData}" XBindingPath="X" YBindingPath="Y" StrokeThickness="2"/>
182+
183+
</chart:SfChart.Series>
184+
185+
</chart:SfChart>
186+
187+
</Grid>
188+
189+
</Window>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Windows;
2+
3+
namespace MusicalChart
4+
{
5+
public partial class MainWindow : Window
6+
{
7+
public MainWindow()
8+
{
9+
InitializeComponent();
10+
Loaded += OnLoaded;
11+
}
12+
13+
private void OnLoaded(object sender, RoutedEventArgs e)
14+
{
15+
playbackLine.X1 = 0;
16+
_ = viewModel.InitializeAsync(playbackLine);
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)