This question is locked. New answers and comments are not allowed.
Hi,
I am posting this thread because i am getting some issues in the binding of the combobox. I've even followed your examples and demos, and it wont work.
Let's list the problems:
Here is a sample code of this issues :
and now the XAML:
Thanks in advance for your help, Best Regards
I am posting this thread because i am getting some issues in the binding of the combobox. I've even followed your examples and demos, and it wont work.
Let's list the problems:
- First the items won't show up
- And i wanted to make one specific item (for each client i.e) to appear, so i am not speaking about SelectedIndex
Here is a sample code of this issues :
namespace SilverlightApplication1{ public partial class Page1 : Page, INotifyPropertyChanged { public Page1() { InitializeComponent(); } private ObservableCollection<test> _list = new ObservableCollection<test>(); public ObservableCollection<test> List { get { return _list; } set { if (_list == value) return; _list = value; LauchNotification("List"); } } private test _test = null; public test Test { get { return _test; } set { if (_test == value) return; _test = value; LauchNotification("Test"); } } private void Page_Loaded(object sender, RoutedEventArgs e) { MessageBox.Show("test"); _list = new ObservableCollection<test>(); test test2 = new test(); test test3 = new test(); Test.Description = "Item1"; Test.Id = 1; test2.Description = "item2"; test2.Id = 2; test3.Description = "item3"; test3.Id = 3; _list.Add(Test); _list.Add(test2); _list.Add(test3); } public event PropertyChangedEventHandler PropertyChanged; private void LauchNotification(string propName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propName)); } } } public class test : INotifyPropertyChanged { private string _description = string.Empty; public string Description { get { return _description; } set { if (_description == value) return; _description = value; LauchNotification("Description"); } } private int _id = 0; public int Id { get { return _id; } set { if (_id == value) return; _id = value; LauchNotification("Id"); } } public event PropertyChangedEventHandler PropertyChanged; private void LauchNotification(string propName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propName)); } } }}and now the XAML:
<navigation:Page x:Class="SilverlightApplication1.Page1" mc:Ignorable="d" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" d:DesignWidth="640" d:DesignHeight="480" Title="Page1 Page" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" Loaded="Page_Loaded"> <Grid x:Name="LayoutRoot"> <ComboBox Height="23" Name="comboBox1" VerticalAlignment="Top" Margin="160,148,0,0" ItemsSource="{Binding List}" SelectedItem="{Binding Test, Mode=TwoWay}" DisplayMemberPath="Description"/> </Grid></navigation:Page>Thanks in advance for your help, Best Regards