Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
CellValuePresenter Value binding does not work
posted

I am dynamically generating most of the fields in a XamDataGrid with unbound fields. I use the CellsInViewChanged event to get all uninitialized CVP's and set a binding on the Value property.

cvp.SetBinding(CellValuePresenter.ValueProperty, binding);

Initially, the binding works and gets the initial value, however changes to the binding to not update the CVP. I bound a text box in the exact same manner and it is updating.

Parents
No Data
Reply
  • 235
    Offline posted

    I also notice that the bindingexpressiong.status is immediately detached for some reason. 

     

    Window window = new Window();

                TextBlock block = new TextBlock();

                block.Width = 100;

                block.Height = 100;

                window.Content = block;

                window.SizeToContent = SizeToContent.WidthAndHeight;

                window.WindowStartupLocation = WindowStartupLocation.CenterScreen;

     

                Binding asdf = new Binding("UnitsTotal");

                asdf.Source = this[3][0].UnitsTotal;

                asdf.Mode = BindingMode.OneWay;

                block.SetBinding(TextBlock.TextProperty, asdf);

     

                var asdfasdf = block.GetBindingBLOCKED EXPRESSION;

     

    this code works using the same source and binding path. When side by side, the textblock will update, but the value presenter won't until it goes in and out of view.

Children