I'm lost...Back to SO :)
The following code correctly displays lines of text through my customcontrol, ccGistaFigure. I am now placing an InkCanvas over the control. Initially, the InkCanvas will be set to recognize Gestures only.
What I am trying to figure out is how upon receiving a specific gesture, the InkCanvas can tell the customcontrol to change itself or, is there a way of having the XAML swap out the ccGistaFigure for another ccGistaFigure object?
Specifically, if I tap over a word on the InkCanvas, I want to be able to determine what word I tapped over and force the customcontrol to add spaces between the letters of that word. So if the word is "Testing", then a tap (or gesture) over the word should change the text to "T_e_s_t_i_n_g".
(ccGistaFigure derives from FrameworkElement and is displaying strings directly from a FormattedText object).
Assuming I can determine the word that was tapped on, what is the best method to change the display?
My current XAML is:
<UserControl x:Class="Nova5.UI.Views.Ink.InkEditorView"
.....
<Grid Background="#FFE24848" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Canvas Grid.Row="1" Grid.RowSpan="3">
<ScrollViewer VerticalScrollBarVisibility="Auto"
Width="{Binding Parent.ActualWidth, Mode=OneWay, RelativeSource={RelativeSource Self}}"
Height="{Binding Parent.ActualHeight, Mode=OneWay, RelativeSource={RelativeSource Self}}"
>
<Grid Background="White" >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<wc:ccGistaFigure Grid.Row="0"
Text="{Binding Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}"
LineHeight="{Binding LineHeight, UpdateSourceTrigger=PropertyChanged,Mode=OneWayToSource}"
AscenderlineOffset="{Binding AscenderlineOffset, UpdateSourceTrigger=PropertyChanged,Mode=OneWayToSource}"
DescenderlineOffset="{Binding DescenderlineOffset, UpdateSourceTrigger=PropertyChanged,Mode=OneWayToSource}"
MidlineOffset="{Binding MidlineOffset,UpdateSourceTrigger=PropertyChanged,Mode=OneWayToSource}"
BaselineOffset="{Binding BaselineOffset, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"
WritingPadSize="{Binding WritingPadSize, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"
/>
<InkCanvas Grid.Row="0" Grid.RowSpan="2"
Background="Transparent"
DefaultDrawingAttributes="{Binding Pen}"
EditingMode="{Binding EditingMode}"
Strokes="{Binding Strokes}" />
</Grid>
</ScrollViewer>
</Canvas>
</Grid>
</UserControl>
Any idea is most appreciated. Thanks.