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

Edit Shape on runtime

1 Answer 44 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, 06:36 AM
Hi,

we crearte the Shapes like this:

MyGallery secondGallery = new MyGallery { Header = "Shapes" };
secondGallery.Shapes.Add(new Switch
{
         SN = "222",
         Content = "Start",
         Height = 80,
         Width = 80,
         Backcolor = "#009494",
         Forecolor = "#ffffff",
         Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.EllipseShape),
         Manufacturer = "Manufacturer 2.2"
});

then we bin the Shapes to the toolbox

<!--  ToolboxItemTemplate  -->
<DataTemplate x:Key="ToolboxItemTemplate1">
   <Border Width="130"
                   Height="80"
                   Margin="0 1 1 0"
                   Background="Transparent">
          <Grid>
              <Grid.RowDefinitions>
                 <RowDefinition Height="*" />                           
             </Grid.RowDefinitions>
             <Viewbox Grid.Row="0" Width="{Binding Width}" Height="{Binding Height}" Margin="5 10 5 0"   HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill">
                  <telerik:RadDiagramShape Margin="15" VerticalAlignment="Top" HorizontalContentAlignment="Center"               VerticalContentAlignment="Center" FontWeight="Bold"
                                                     Geometry="{Binding Geometry}" IsHitTestVisible="False" Content="{Binding Content}" FontSize="15" Foreground="{Binding Forecolor}"
                                                     Background="{Binding Backcolor}">   
               </telerik:RadDiagramShape>
           </Viewbox>                      
       </Grid>               
    </Border>           
</DataTemplate>
 
<!--  ToolboxGroupTemplate  -->
<HierarchicalDataTemplate x:Key="ToolboxGroupTemplate1"
                            ItemsSource="{Binding Shapes}"
                            ItemTemplate="{StaticResource ToolboxItemTemplate1}">
     <TextBlock Text="{Binding Header}" FontSize="13" />
</HierarchicalDataTemplate>

For example we habe a simple RectangleShape. With a cutom Tab in EditMode we select a Employee and now we want to edit the RectangleShape. Is it possible to change the view of the RectangleShape during runtim, for example see attached files.

Thanks a lot
Best Regards
Rene

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavel R. Pavlov
Telerik team
answered on 04 Apr 2014, 07:02 AM
Hi,

Could you please be more specific on what you need to change of the RadDiagramShape at runtime? Is that green square part of the default Template of the RadDiagramShape? Is it an option for you to change the visibility of the square at runtime?

Regards,
Pavel R. Pavlov
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
Pavel R. Pavlov
Telerik team
Share this question
or