This question is locked. New answers and comments are not allowed.
Hi,
I have a few of questions but they all stem around the question of how to intercept and handle certain events from the diagram.
Below is the xaml I have used for the text box shape style. Its pretty basic and I took it pretty much straight from your Dashboard Designer example.
I have a few of questions but they all stem around the question of how to intercept and handle certain events from the diagram.
- I have a case where I need to intercept when the 'Tab' key is pressed while the diagram is in focus. Is this possible?
- I have another case where I introduced a custom shape that is really just a text box. Currently it takes three clicks before I can actually edit the text in the box of the shape. One click to select the shape, another to signify I want to edit the text in the box, and the third click, i'm not sure about. Regardless I would like to trigger the editing of the text in the box after one click. If I override the shapeclicked event how do I get the contained shape into edit mode?
- The final question revolves around the same text box shape. The text box is supposed to accept returns, but for some reason when I press return while editing the textbox something (the diagram) intercepts the return key and finishes the edit. Can I override this behaviour?
Below is the xaml I have used for the text box shape style. Its pretty basic and I took it pretty much straight from your Dashboard Designer example.
<Style TargetType="local:ASTextBoxShape" BasedOn="{StaticResource RadDiagramShapeStyle}"> <Setter Property="Background" Value="Wheat" /> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" /> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Text, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=local:ASTextBoxShape}}" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType=local:ASTextBoxShape}}" Margin="0,0,0,0" TextWrapping="Wrap" MaxWidth="800" FontSize="{Binding Path=FontSize, RelativeSource={RelativeSource AncestorType=local:ASTextBoxShape}, Mode=TwoWay}" FontWeight="{Binding Path=FontWeight, RelativeSource={RelativeSource AncestorType=local:ASTextBoxShape}}" /> </DataTemplate> </Setter.Value> </Setter> <Setter Property="EditTemplate"> <Setter.Value> <DataTemplate> <TextBox Text="{Binding Path=Text,Mode=TwoWay, RelativeSource={RelativeSource AncestorType=local:ASTextBoxShape}}" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType=local:ASTextBoxShape}}" Margin="0,0,0,0" TextWrapping="Wrap" MaxWidth="800" FontSize="{Binding Path=FontSize, RelativeSource={RelativeSource AncestorType=local:ASTextBoxShape}, Mode=TwoWay}" FontWeight="{Binding Path=FontWeight, RelativeSource={RelativeSource AncestorType=local:ASTextBoxShape}}" /> </DataTemplate> </Setter.Value> </Setter> </Style>