I have a system of closable tabs, and each tab has RichTextbox (as a scratchpad). The problem I am having is that whenever I create a new tab it should supposedly create a new RichTextBox, but it overwrites the contents of all the previous RTBs, clearing them all. Can someone tell me why this happens?? It doesn't happen however when I create fixed RTBs (eg create a tab control with 4 tabs and each tab has its own RTB), then everything works fine. but it doesn't work for dynamic tabs?
The code below is from a Usercontrol that is contained within each tab item:
<Border Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0" Grid.RowSpan="3" BorderBrush="#FF939393" BorderThickness="26" CornerRadius="26" >
<Border.Effect>
<DropShadowEffect />
</Border.Effect>
</Border>
<TextBlock Grid.Column="1" Grid.Row="0" Height="23" Name="textBlock1" Text="{Binding Path=TestMessage}" />
<Button Grid.Column="0" Grid.Row="1" Style="{DynamicResource PageNavigationButton}" Height="52" Width="26" Command="{Binding Path=CMD_SwapLeft}" >
<Button.RenderTransform >
<RotateTransform Angle="180" CenterX="13" CenterY="26" />
</Button.RenderTransform>
</Button>
<Button Grid.Column="2" Grid.Row="1" Style="{DynamicResource PageNavigationButton}" Height="52" Width="26" Command="{Binding Path=CMD_SwapRight}" />
<View:DebtorTabView Grid.Column="1" Grid.Row="1" Visibility="{Binding RelativeSource={RelativeSource Self}, Path=Parent.DataContext.MyDataContextVisibility}" DataContext="{Binding Path=MyDataContext}" />
<Grid Background="Blue" Grid.Column="1" Grid.Row="1" Visibility="{Binding Path=MyDataContextOtherVisibility}">
<TextBlock Text="{Binding Path=TestMessageTwo}" Height="23" Width="124" Margin="6,6,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" />
<RichTextBox HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
I haven't done any of the bindings done(which is part of a custom control when I sort out this problem).
Thanks All