DISQUS

fortes.com: BindableRun

  • Ian Griffiths · 2 years ago
    So how come it was cut, given it's quite straightforward? I've ended up having writing this thing (well, something very like it) a couple of times now on real projects, and it's always perplexed me that it didn't work like this out of the box.

    Given that so many of the properties are DPs on most elements, it seems almost perverse that an exception was made in this case.
  • Fortes · 2 years ago
    You know how it is in software, trade-offs have to be made. In this case it was the test cost (lots of tricky cases when you bring in databinding). Given how easy it is to implement, we chose to cut this in order to gain other (harder for a developer to add, but easier to test) features.
  • Walt Ritscher · 2 years ago
    I had the same thoughts as Ian when I read this post. I wrote a similar class earlier this year. It seems so simple, that's what makes you wonder why it's not in the framework.
  • Robert Zurer · 2 years ago
    Your post has helped me on the way to solving a rather knotty problem. I have tried to implement two-way binding with no success using FrameworkPropertyMetadataOptions.BindsTwoWayByDefault when registering the BoundTextProperty. Any ideas? Thanks so much.
  • Bea Costa · 2 years ago
    Hey Robert,
    Can you please share a reduced repro of your sample? Setting BindsTwoWayByDefault to true when registering the DP should be enough to make that DP two way data bound by default. I'm not aware of any gotchas or bugs in this scenario.
    Thanks!
    Bea
  • Laurent · 2 years ago
    Great! I've been looking for something like that. Thanks for the tip!

    Laurent
  • Robert Zurer · 2 years ago
    Bea,
    Thanks so much for your comment and for your wonderful, indispensable blog.

    Two way binding does work as expected. When I set the BoundText procedurally, all was well.

    The problem was that I had placed the BindableRun in a Paragraph in a FlowDocument in a RichTextBox, thinking that, magically, the BindableRun would receive text input from the RichTextBox. I just have to figure out how to route the input.
  • Devaraj · 2 years ago
    I get this error "{"Collection was modified; enumeration operation may not execute."}" when i use the BindableRun element more than once in my flow document - if i use only use it keeps quiet - any clues. ???
  • Brian · 1 year ago
    I have the same question as Robert Zurer. Anyone have a sample of working 2-way binding example? Each of my BindableRun tags is in a Paragraph. I'm styling a ListBox like this:


















    Looks great and binds great, but none of the changes make it back to the Binding Source.

    Thanks.
  • Ed Ball · 1 year ago
    I think we have a solution to the "Collection was modified" issue:

    http://code.logos.com/blog/2008/01/data_binding...
  • Patrick · 1 year ago
    Thanks for sharing the BindableRun.

    Is there anyone who created a two-way binding successfully?