I have added the following to my diagram in order to display the settings pane on my shapes:
<
primitives:ItemInformationAdorner.AdditionalContent
>
<
telerik:SettingsPane
Diagram
=
"{Binding ElementName=radDiagram}"
/>
</
primitives:ItemInformationAdorner.AdditionalContent
>
Now I am trying to figure out a way to enable / disable the settings pane on a per shape basis. For example, I want to be able to edit settings of square shapes but not circles. Is this something I can do with the item information adorner?
Rgds,
R
8 Answers, 1 is accepted
One option is to handle the ItemInformationAdorner's IsAdditionalContentVisibleChanged event and collapse/show the visibility of the adorner itself based on the selected items.
Another option is to inherit the SettingsPane control and override the OnIsActivePropertyChanged method and provide custom logic for showing the settings pane (the IsActive property).
Please let us know if you have further questions on this.
Alex Fidanov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks for the pointers, regarding solution 1 how can I get an instance of the ItemInformationAdorner so I can subscribe to the IsAdditionalContentVisibleChanged event?
Rgds
R
Visibility="{Binding Path=Diagram.SelectedItem, RelativeSource={RelativeSource Self},Converter={StaticResource isSettingspaneVisibleConverter}}"
One thig to note is that if diagram's selection mode is set to Single you have to bind to Diagram.SelectedItem and if diagram's selection mode is set to Multiple you have to bind to Diagran.SelectedItems.
I would have expected Diagram.SelectedItem to be a subset of Diagram.SelectedItems but it turns out that they're independent.
R
You can find the adorner through the visual tree (using the visual tree helper or one of our extension helper methods like ChildrenOfType). However, binding to the SelectedItem even seem like a more elegant solution. However, I was not able to reproduce the selection mode issue. No matter of the selection mode, the SelectedItems contains the selected item(s) correctly. Am I missing something?
Greetings,Alex Fidanov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
The thing is that SelectedItem is a dependency property whereas SelectedItems is an IEnumerable therefore is not well suited to bind to because no change notification is raised to the subscribers.
Rgds,
R
Although it is a valid point that we make the SelectedItems at least support INotifyPropertyChanged, so that you can bind to the Count property, I think it is best to always use the SelectedItemsChanged event. It will be the same for every selection mode.
Regards,Alex Fidanov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Hi,
how could you blend out the button?
when using this in my MainWindows.xaml the button of Settingspane still occure when i click on a shape.
<primitives:ItemInformationAdorner.AdditionalContent><telerik:SettingsPane Diagram="{Binding ElementName=diagram}" Visibility="Collapsed"/></primitives:ItemInformationAdorner.AdditionalContent>
The Visibility property of the SettingsPane is internally set when a shape is selected. So, you can't use it to hide the button. There are couple of approaches which I could suggest you to achieve your requirement.
- If you don't want to show the settings pane you can remove it from the AdditionalContent and re-add it again when necessary.
- The other approach is to handle the PreviewAdditionalContentActivated event of the diagram. This way you can prevent the button from showing.
private
void
diagram_PreviewAdditionalContentActivated(
object
sender, Telerik.Windows.Controls.Diagrams.AdditionalContentActivatedEventArgs e)
{
e.Handled =
true
;
}
Regards,
Martin Ivanov
Progress Telerik