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

Keep SettingsPane visible where Zoom Changed

2 Answers 43 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Valentin
Top achievements
Rank 1
Iron
Iron
Valentin asked on 04 Sep 2018, 12:15 PM

Hi Telerik,

 

I'm using a RadDiagram and I want to change the behavior of the SettingsPane visibility.

Indeed, when the Zoom in the RadDiagram changed, the SettingsPane button visibility is changed to be hidden.

 

I try to implement this code :

<view:MirBuilderDiagram x:Name="myMirBuilderDiagram" Grid.Row="2" primitives:BackgroundGrid.IsGridVisible="False" primitives:BackgroundPageGrid.IsGridVisible="False" ActiveTool="{Binding ActiveTool, Mode=TwoWay}"
                        DataContext="{Binding Tag}" ItemsChanged="MirBuilderDiagram_ItemsChanged" ScrollViewer.HorizontalScrollBarVisibility="auto" ScrollViewer.VerticalScrollBarVisibility="auto"
                        SelectedItem="{Binding SelectedShape, Mode=OneWayToSource}" FontSize="9" Telerik:DiagramSurface.IsVirtualizing="False" SnapX="4" SnapY="4" ConnectionBridge="Bow" ConnectionStyle="{StaticResource RadDiagramConnectionStyle_RotateText}" CommandExecuted="myMirBuilderDiagram_CommandExecuted">
    <primitives:ItemInformationAdorner.AdditionalContent>
        <extensions:SettingsPane x:Name="mySettingPane" Diagram="{Binding ElementName=myMirBuilderDiagram}" Loaded="mySettingPane_Loaded" />
    </primitives:ItemInformationAdorner.AdditionalContent>
</view:MirBuilderDiagram>

 

Private Sub mySettingPane_Loaded(sender As Object, e As RoutedEventArgs)
    Dim settingPane As SettingsPane = TryCast(sender, SettingsPane)
 
    If settingPane IsNot Nothing Then
        Dim informationAdorner As ItemInformationAdorner = settingPane.ParentOfType(Of ItemInformationAdorner)()
        If informationAdorner IsNot Nothing Then
            AddHandler informationAdorner.IsAdditionalContentVisibleChanged, AddressOf InformationAdorner_IsAdditionalContentVisibleChanged
        End If
    End If
End Sub
 
Private Sub InformationAdorner_IsAdditionalContentVisibleChanged(ByVal sender As Object, ByVal e As EventArgs)
    Dim informationAdorner As ItemInformationAdorner = TryCast(sender, ItemInformationAdorner)
 
    If informationAdorner IsNot Nothing Then
        If Me.myMirBuilderDiagram.SelectedItem IsNot Nothing Then
            If Not informationAdorner.IsAdditionalContentVisible Then
                informationAdorner.IsAdditionalContentVisible = True
            End If
        End If
    End If
End Sub

 

The problem is at the bold line, because the "Setter is not accessible". I try to create an inherit class but the Setter is never accessible.

 

Do you know how I can keep the SettingsPane button visibility to Visible when the zoom changing (but keep the default behavior when SelectedItem changed, etc..) ?

Thank you.

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 07 Sep 2018, 10:07 AM
Hello Valentin,

Currently, there is no API for manually activating the additional content. To show the 'gear' icon (the settings pane) when you zoom, you can reset the selection of the diagram. For example you can use the ZoomChanged event of the diagram.
Private Sub Diagram_ZoomChanged(ByVal sender As Object, ByVal e As Telerik.Windows.RadRoutedPropertyChangedEventArgs(Of Double))
    Dim selectionService = Me.diagram.ServiceLocator.GetService(Of ISelectionService(Of IDiagramItem))()
 
    If Me.diagram.SelectedItem IsNot Nothing Then
        Dim selectedItems = selectionService.SelectedItems.ToList()
        selectionService.ClearSelection()
        selectionService.SelectItems(selectedItems)
    End If
End Sub
I hope this helps.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 10 Sep 2018, 02:29 PM

Hi Martin,

Thank you for this code, it's a good by-passing and it's working find !

Valentin.

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