This is a migrated thread and some comments may be shown as answers.

Custom Shape Events

1 Answer 96 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 02 Apr 2014, 01:32 PM
Hi,

i created a custom shape with a special datatemplate.

RadDiagramShape StateBox = new RadDiagramShape()
{                                               
    Content = model,
     Height = 80,
     Width = 150,
     ContentTemplate = (DataTemplate)this.FindResource("SubItemTemplate"),
     Position = e.GetPosition((RadDiagram)sender),
     Geometry = droppedSwitch.Geometry,    
      IsResizingEnabled = false                           
};

DataTemplate xaml:
<DataTemplate x:Key="SubItemTemplate">
      <Grid Background="Transparent" Width="{Binding Width, Mode=TwoWay}" Height="{Binding Height, Mode=TwoWay}">    
           <TextBlock Text="{Binding SN}" x:Name="PartID" />
       </Grid>
</DataTemplate>

This works fine. But how do i add a "BeginEdit" Method to the CustomShape? Thanks so far

Best Regards
Rene

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 07 Apr 2014, 08:59 AM
Hi Rene,

You can add a handler for the BeginEdit event of your shape with the following code:

StateBox.BeginEdit += StateBox_BeginEdit;
 
..........................
 
void StateBox_BeginEdit(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
    //do something
}
You can also take a look at the Items Editing help article which explains how you can edit the Content of the items in your diagram.

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Diagram
Asked by
ITA
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or