Silverlight textblock binding converter


















It is like it's evaluating the text of the TextBlock before the Hyperlink get loaded or something The converter that you wrote is comparing the Text of the TextBlock to empty, not the text of the inner Hyperlink. I think you really want to set the RelativeSource to the child Hyperlink , but I don't think that is possible.

Are you sure that it is the TextBlock 's size that doesn't get collapsed? If you put the style on the Hyperlink instead or even its inner TextBlock , maybe that would still work?

Edit: Hyperlink doesn't have a Visibility property, so moving the style to it won't help, unfortunately. The only other option that I can think of is to create a custom control that derives from TextBlock , and it contains a Hyperlink and TextBlock. If you add an Email DependencyProperty to it, then you can use that to determine if the control should be visible or not, and for the value of the Hyperlink and its inner TextBlock. It seems like there should be a better way to handle this, but I can't think of anything currently.

Shame on me. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Collectives on Stack Overflow. Learn more. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services. Privacy policy. To convert data during binding, you must create a class that implements the IValueConverter interface, which includes the Convert and ConvertBack methods.

Hurry up and avail the benefits now! Now, in retrospect, it looks like I could have done something with a FlowDocument Viewer that might have been a little easier, but I figured I would post my solution in case it helps out someone else.

I basically took the converter sample project and combined it all into one file so I could easily incorporate it into my project or any other project for that matter; you can download the code below. All that's left is adding an Attached Property for us to bind to and replace the TextBlock's Inline elements. Parse xaml. Count]; xamLines.

CopyTo newLines, 0 ; txtBox. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more.

Asked 10 years, 11 months ago. Active 9 years, 4 months ago. Viewed 2k times. Thanks in advance for any help. Best regards. Add a comment. Active Oldest Votes. It's too easy to be true Drew Noakes k gold badges silver badges bronze badges.



0コメント

  • 1000 / 1000