views:

22

answers:

1

I have a combox box which is bind with dependencyproperty My itemsource is bind to arraylist of string and the selectedValue to a string

I want to modify the combobox context by code The first one is it OK but as i click in my comboxbox and after i want to change her contains it doesn' work

My xmal

<ComboBox Name="ComboCateg3" SelectionChanged="Filter_SelectionChanged" DockPanel.Dock="top"     
  Height="26" VerticalAlignment="top" HorizontalAlignment="Stretch" SelectedValue="{Binding        
  Path=Categ3Filter}"  ItemsSource="{Binding Path=Categ3Values,Mode=OneWay}"  Margin="3,0" />

my declaration property in MVVM
public static readonly DependencyProperty Categ3FilterProperty = DependencyProperty.Register
("Categ3Filter", typeof(string), typeof(ControlerEvtConsult), new UIPropertyMetadata (Dcns.SmsType.Shipmaster.Plugins.StorageUnitPlugin.Properties.Resources.RES_LIB_ALL));

 public static readonly DependencyProperty Categ3ValuesProperty = DependencyProperty.Register
    ("CategValues3", typeof(ArrayList), typeof(ControlerEvtConsult), new UIPropertyMetadata(null));

Could you please help ?

A: 

Not sure I understand the question, but if you want changes in the ComboBox to update Categ3Values you need to use a TwoWay binding:

<ComboBox Name="ComboCateg3" SelectionChanged="Filter_SelectionChanged" DockPanel.Dock="top" 
Height="26" VerticalAlignment="top" HorizontalAlignment="Stretch" SelectedValue="{Binding        
Path=Categ3Filter}"  ItemsSource="{Binding Path=Categ3Values,Mode=TwoWay}"  Margin="3,0" />
Jackson Pope
I have already test the two way it doesn't work.
nonoballain
I have already test the two way it doesn't work.
nonoballain
Excuse me I have already test the two way it doesn't work. I notice that in the code behind when i verify the combobox of the itemsource it's OK but the contains of the combobox is not refresh. In fact at the beginning my solution was good because i set the combobox one time. I must do an evoluation thaht when i change the contain of a combox one i must refresh others. Is what the solution would be cut and reaffect the binding in the code behind and so how i do that
nonoballain