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

SettingsPaneView - Conditional

1 Answer 66 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Joel Palmer
Top achievements
Rank 2
Joel Palmer asked on 02 Jun 2014, 05:58 PM
I'm using the StyleSelectors_WPF example.  I'm able to conditionally set both the shape and the connector.  However, I'd also like SettingsPaneView to be set based on the ShapeType I've selected.  Do you have an example of how to do this?

I'm currently using this style for everything.  However, it should only apply to my GroupNode where I have ID and Description.  Now, when I have a PersonNode, I need it to display ID, FirstName and LastName fields.  Thanks in advance for your help:

<Style TargetType="extensions:SettingsPaneView">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="extensions:SettingsPaneView">
                    <Border Background="{TemplateBinding Background}"
                            BorderThickness="1"
                            BorderBrush="{StaticResource SettingsPaneBorderBrush}">
 
                        <GroupBox
                            Header="Group Properties">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="26"/>
                                    <RowDefinition Height="26"/>
                                </Grid.RowDefinitions>
 
                                <Grid
                                    Grid.Row="0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="125"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
 
                                    <Label
                                        Grid.Column="0"
                                        Content="ID:"
                                        HorizontalAlignment="Right"
                                        FontSize="12"
                                        Foreground="Black"/>
 
                                    <TextBox
                                        Grid.Column="1"
                                        Margin="10,0,10,0"
                                        extensions:SettingsPaneView.EditorPropertyName="DataContext.ID"
                                        extensions:SettingsPaneView.EditorItemType="Shapes, Custom"
                                        extensions:SettingsPaneView.EditorValue="{Binding Path=Text, Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>
                                </Grid>
 
                                <Grid
                                    Grid.Row="1">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="125"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
 
                                    <Label
                                        Grid.Column="0"
                                        Content="Name:"
                                        HorizontalAlignment="Right"
                                        FontSize="12"
                                        Foreground="Black"/>
 
                                    <TextBox
                                        Grid.Column="1"
                                        Margin="10,0,10,0"
                                        extensions:SettingsPaneView.EditorPropertyName="DataContext.Description"
                                        extensions:SettingsPaneView.EditorItemType="Shapes, Custom"
                                        extensions:SettingsPaneView.EditorValue="{Binding Path=Text, Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>
                                </Grid>
                            </Grid>
                        </GroupBox>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

1 Answer, 1 is accepted

Sort by
0
Milena
Telerik team
answered on 03 Jun 2014, 01:02 PM
Hi Joel,

You can achieve such behavior by subscribing to AdditionalContentActivated event, which is raised by the RadDiagram to inform layouts that the additional content (like SettingsPane) is going to be activated. So, inside the event handler you can check the type of the selected shape and set a style for the SettingsPaneView according to the shape type. 

For your convenience  I'm attaching an edited StyleSelectors_WPF example project that demonstrates this approach. Please take a look at it and let us know if it works for you.

Regards,
Milena
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Diagram
Asked by
Joel Palmer
Top achievements
Rank 2
Answers by
Milena
Telerik team
Share this question
or