SettingsPaneView - Conditional

2 posts, 0 answers
  1. Joel Palmer
    Joel Palmer avatar
    164 posts
    Member since:
    May 2009

    Posted 02 Jun 2014 Link to this post

    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>

  2. Milena
    Admin
    Milena avatar
    201 posts

    Posted 03 Jun 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top