Terje Isaksen Developer blog

2010-02-03 (Wednesday)

Mask on Textbox

Filed under: Developing — Terje Isaksen @ 17:16
Tags: , ,

Ruben Hakopian shows us how it is done:
http://rubenhak.com/?p=8

2009-09-24 (Thursday)

WPF ComboBox and binding

Filed under: Developing — Terje Isaksen @ 12:26
Tags: , ,

XAML:

<Grid x:Name="xDetails" >
...
 <ComboBox x:Name="CurrencyCode" 
           SelectedValuePath="CurrencyId"   
           DisplayMemberPath="ISOCode"  
           SelectedValue="{Binding BaseCurrency.Id}" 
  />
...
 </Grid>

Code behind:

ICollection<Currency> CurrencyList; // object populated elsewhere
xObject CurrentObject; // object with one field called BaseCurrency
...
CurrencyCode.ItemsSource = CurrencyList;
xDetails.DataContext = CurrentObject;

xObject definition:

public partial class xObject : DtoBase
 {
...
 [DataMember]
 public IdDisplayValue BaseCurrency
...
}

IdDisplayValue definition:

[DataContract]
 [Serializable()]
 public class IdDisplayValue : DtoBase
 {
 ...
 [DataMember]
 public int Id
...
 [DataMember]
 public string DisplayValue
...
 }

Currency definition:

public partial class Currency : DtoBase
 {
...
 [DataMember]
 public int CurrencyId
...
 [DataMember]
 public string ISOCode
...
 }

Blog at WordPress.com.