RE: [OzSilverlight] SL Combobox SelectedItem ?

2008-10-31 Thread Muhammad Niaz
Hi All,

   Thanks for idea, but can you tell me what can be world best
Binding in SL for Combobox, because previously I was using 3rd party DDL but
now I have to replace.

 

Any idea not with sample code like Combo   DataContext={Binding
SomeCollection} ;), please dot mind.

 

Thanks  Regards,

Muhammad Niaz

Software Engineer

Intagleo Systems Pvt Ltd

 http://www.intagleo.co.uk www.intagleo.co.uk

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Miguel Madero
Sent: Friday, October 31, 2008 4:44 PM
To: listserver@ozSilverlight.com
Subject: RE: [OzSilverlight] SL Combobox SelectedItem ?

 

Make sure that the object is already in the ItemsSource. The combo can only
select items that are part of the collection they're bound to. 

 

ddl.DataContext = MyCollection;  // or
dll.ItemsSource

ddl.SelectedItem = new MyClass(); // Won't work
because MyClass is not part of the collection

ddl.SelectedItem = MyCollection[0];   // J

 

The order is also important so this won't work either. 

ddl.SelectedItem = MyCollection[0];   // J

ddl.DataContext = MyCollection;  // or
dll.ItemsSource

 

Similarly in XAML if you're databinding the properties

Combo   SelectedItem={Binding SomeProperty} 

DataContext={Binding SomeCollection}/

 

This won't work because it will try to get the SelectedItem first and then
bind the items, just as in the previous C# example

This will do the trick

Combo   DataContext={Binding SomeCollection}

SelectedItem={Binding SomeProperty} /

 

 

 

 

 

 Miguel A. Madero Reyes

  http://www.miguelmadero.com/ www.miguelmadero.com (blog)
  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] 
 +61 (0) 406-704-161

 623/243 Pyrmont Street 
 Pyrmont, NSW, 2009

 Australia

P Please reconsider your environmental responsibility before printing this
e-mail

The information in this e-mail is confidential and may be legally
privileged. It is intended solely for the addressee. If you are not the
intended recipient, any disclosure, copying, distribution or any action
taken or omitted to be taken in reliance on it, is prohibited and may be
unlawful.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Muhammad Niaz
Sent: Friday, 31 October 2008 2:55 AM
To: listserver@ozSilverlight.com
Subject: [OzSilverlight] SL Combobox SelectedItem ?

 

Hi All,

 I am working on MS Combox in SL App,

  But I have an issue, like ddlMediatype.SelectedItem =
(ContentTypeDTO)innerContentTypeDTO;

Mean I have no success to set SelectedItem through code.

 

 

Any details sample code or Article, in which if there are multiple
Comboboxes on each change other reflects. ;)

 

Thanks  Regards,

Muhammad Niaz

Software Engineer

Intagleo Systems Pvt Ltd

www.intagleo.co.uk

 

---
OzSilverlight.com - to unsubscribe from this list, send a message back to
the list with 'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net 

---
OzSilverlight.com - to unsubscribe from this list, send a message back to
the list with 'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net 




--- 
OzSilverlight.com - to unsubscribe from this list, send a message back to the 
list with 'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net


RE: [OzSilverlight] SL Combobox SelectedItem ?

2008-10-31 Thread Miguel Madero
The ComboBox inherits from selector, which is also the baseclass for the
ListBox so the way you use it will be really similar. 

You can use any collection or to be more specific any IEnumerableT

If you want you can define a datatemplate to personalize the way each object
will look or go with the default template that will display the ToString of
each object in the collection. 

 

 

 

 Miguel A. Madero Reyes

  http://www.miguelmadero.com/ www.miguelmadero.com (blog)
  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] 
 +61 (0) 406-704-161

 623/243 Pyrmont Street 
 Pyrmont, NSW, 2009

 Australia

P Please reconsider your environmental responsibility before printing this
e-mail

The information in this e-mail is confidential and may be legally
privileged. It is intended solely for the addressee. If you are not the
intended recipient, any disclosure, copying, distribution or any action
taken or omitted to be taken in reliance on it, is prohibited and may be
unlawful.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Muhammad Niaz
Sent: Friday, 31 October 2008 11:55 PM
To: listserver@ozSilverlight.com
Subject: RE: [OzSilverlight] SL Combobox SelectedItem ?

 

Hi All,

   Thanks for idea, but can you tell me what can be world best
Binding in SL for Combobox, because previously I was using 3rd party DDL but
now I have to replace.

 

Any idea not with sample code like Combo   DataContext={Binding
SomeCollection} ;), please dot mind.

 

Thanks  Regards,

Muhammad Niaz

Software Engineer

Intagleo Systems Pvt Ltd

www.intagleo.co.uk

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Miguel Madero
Sent: Friday, October 31, 2008 4:44 PM
To: listserver@ozSilverlight.com
Subject: RE: [OzSilverlight] SL Combobox SelectedItem ?

 

Make sure that the object is already in the ItemsSource. The combo can only
select items that are part of the collection they're bound to. 

 

ddl.DataContext = MyCollection;  // or
dll.ItemsSource

ddl.SelectedItem = new MyClass(); // Won't work
because MyClass is not part of the collection

ddl.SelectedItem = MyCollection[0];   // J

 

The order is also important so this won't work either. 

ddl.SelectedItem = MyCollection[0];   // J

ddl.DataContext = MyCollection;  // or
dll.ItemsSource

 

Similarly in XAML if you're databinding the properties

Combo   SelectedItem={Binding SomeProperty} 

DataContext={Binding SomeCollection}/

 

This won't work because it will try to get the SelectedItem first and then
bind the items, just as in the previous C# example

This will do the trick

Combo   DataContext={Binding SomeCollection}

SelectedItem={Binding SomeProperty} /

 

 

 

 

 

 Miguel A. Madero Reyes

  http://www.miguelmadero.com/ www.miguelmadero.com (blog)
  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] 
 +61 (0) 406-704-161

 623/243 Pyrmont Street 
 Pyrmont, NSW, 2009

 Australia

P Please reconsider your environmental responsibility before printing this
e-mail

The information in this e-mail is confidential and may be legally
privileged. It is intended solely for the addressee. If you are not the
intended recipient, any disclosure, copying, distribution or any action
taken or omitted to be taken in reliance on it, is prohibited and may be
unlawful.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Muhammad Niaz
Sent: Friday, 31 October 2008 2:55 AM
To: listserver@ozSilverlight.com
Subject: [OzSilverlight] SL Combobox SelectedItem ?

 

Hi All,

 I am working on MS Combox in SL App,

  But I have an issue, like ddlMediatype.SelectedItem =
(ContentTypeDTO)innerContentTypeDTO;

Mean I have no success to set SelectedItem through code.

 

 

Any details sample code or Article, in which if there are multiple
Comboboxes on each change other reflects. ;)

 

Thanks  Regards,

Muhammad Niaz

Software Engineer

Intagleo Systems Pvt Ltd

www.intagleo.co.uk

 

---
OzSilverlight.com - to unsubscribe from this list, send a message back to
the list with 'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net 

---
OzSilverlight.com - to unsubscribe from this list, send a message back to
the list with 'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net 

---
OzSilverlight.com - to unsubscribe from this list, send a message back to
the list with 'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net 




--- 
OzSilverlight.com - to unsubscribe from this list, send a message back