Edit Shape on runtime

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

    Posted 02 Apr 2014 Link to this post

    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
  2. Answer
    Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 04 Apr 2014 Link to this post

    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.

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