I'm trying to add new application command like 'Save as PDF'
So I created following `DesignerCanvas.Commands.cs` class and added following
public partial class DesignerCanvas
{
public static RoutedCommand SaveAsPDF = new RoutedCommand();
public DesignerCanvas()
{
this.CommandBindings.Add(new CommandBinding(DesignerCanvas.SaveAsPDF, SaveAsPDF_Executed));
}
private void SaveAsPDF_Executed(object sender, ExecutedRoutedEventArgs e)
{
throw new NotImplementedException();
}
}
then I created 'DesignerCanvas.cs'
public partial class DesignerCanvas : Canvas
{
}
then Added new Icon to tool bar like this in 'ApplicationToolbar.xaml'
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:SampleProject">
<Button Margin="0,3,0,3" Padding="5" HorizontalContentAlignment="Left"
Style="{StaticResource ToolBarButtonBaseStyle}"
Command="{x:Static s:DesignerCanvas.SaveAsPDF}"
CommandTarget="{Binding ElementName=MyDesigner}">
<Button.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Source="Images/Ungroup.png" Width="16"/>
<TextBlock Margin="3" Text="Ungroup" VerticalAlignment="Center" Grid.Column="1"/>
</Grid>
</Button.Content>
</ResourceDictionary>
but here I'm getting this error
The name "DesignerCanvas" does not exist in the namespace "clr-namespace:SampleProject".