Custom Shape Events

2 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 02 Apr 2014 Link to this post

    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
  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 07 Apr 2014 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top