Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Open new canvas using tool bar button (Read 1736 times)
kelum
Full Member
***
Offline


I Love MindFusion!

Posts: 100
Joined: Mar 25th, 2017
Open new canvas using tool bar button
Apr 5th, 2017 at 7:57am
Print Post  
I added following button on application toolbar XAML

Code
Select All
<StackPanel Orientation="Vertical" Margin="0,2,0,2">
                    <Button Margin="1" Padding="2" HorizontalContentAlignment="Left"
                            Style="{StaticResource ToolBarButtonBaseStyle}"
                            Command="{x:Static ApplicationCommands.Open}"
                            CommandTarget="{Binding ElementName=MyDesigner}">
                        <Button.Content>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Image Source="/Layout/Images/OpenFolder.png" Width="16"/>
                                <TextBlock Margin="3,0,3,0" Text="Open" VerticalAlignment="Center"  Grid.Column="1"/>
                            </Grid>
                        </Button.Content>
                    </Button> 



I'm trying to open a new layout(canvas) using that button

Code
Select All
public MainWindow()
{
   InitializeComponent();
   CommandBindings.Add(new CommandBinding(ApplicationCommands.New, New_Executed));
}

        private void New_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            flowchart.ClearAll();
        }
 




just want to make sure is this correct way to do this ?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3447
Joined: Oct 19th, 2005
Re: Open new canvas using tool bar button
Reply #1 - Apr 5th, 2017 at 8:36am
Print Post  
Yes, or otherwise you could create an entirely new Diagram instance and replace the old one in parent panel.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint