views:

11

answers:

1

I have a textbox inside a Expasnders contentemplate that I'm trying to bind to from outside the expander, but it's not really possible, I have another textbox inside the expander looking like this:

and an exact duplicate of this markup outside the expander, The textbox inside the expander updates it's text proeprty when txtTitle is changed, the one outside doesn't so how do I get bind to txtTitle from outside the expander??

I will try to illustrate it with some sample xaml (sounds fun pronounced).

<TextBox Text="{Binding ElementName=ExpandertxtBox, Path=Text}" />

<toolkit:Expander>
<toolkit:Expander.ContentTemplate>
<TextBox Name="ExpandertxtBox" />
</toolkit:Expander.ContentTemplate>
</toolkit:Expander>

The problem is that the binding wont work because ExpandertxtBox is inside a contentemplate, and I'm trying to bind from outside, so how can I access it, what is the correct bindingpath?

A: 

I Ended up creating this method to handle my problem

 private void SetFilterBinding(object ctrl, object value, FilterOperator fo, string ctrlproperty, string dbproperty)
                    {
                            var fd = new FilterDescriptor(dbproperty, fo, value);

                            BindingOperations.SetBinding(fd, FilterDescriptor.ValueProperty, new Binding{ Path = new PropertyPath(ctrlproperty), Source = ctrl});

                            nodeDomainDataSource.FilterDescriptors.Add(fd);
                    }
Jakob