To bind to Run.Text, checkout the BindableRun class by Fortes. Simple to implement, I use it all over my projects.
PortageMonkey
2009-08-16 00:42:07
To bind to Run.Text, checkout the BindableRun class by Fortes. Simple to implement, I use it all over my projects.
Solution: BindableRun class + the following markup:
<TextBlock>
<Button x:Name="MyButton" Command="{Binding Path=MyCommand}" Content="+" />
<common:BindableRun x:Name="Subject" BindableText="{Binding Path=Subject}"/>
</TextBlock>
I found that implementing BindableRun correctly is pretty tricky - and almost all other available implementations will cause an exception from wpf layouting engine when the bound content changes from null to something non-null - see this problem, keyword "Collection was modified; enumeration operation may not execute."
Corrrect implementation from Microsoft is here - it shows how tricky this really is.