Click here to Skip to main content
15,921,382 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: DataBinding using WPF Pin
Pete O'Hanlon13-May-08 0:42
mvePete O'Hanlon13-May-08 0:42 
QuestionWorld map using silverlight Pin
rajahram11-May-08 21:35
rajahram11-May-08 21:35 
AnswerRe: World map using silverlight Pin
Michael Sync11-May-08 22:07
Michael Sync11-May-08 22:07 
QuestionHow to create Tab control in silver light (Expression Blend 2) Pin
kishorekumar.malla@live.com10-May-08 23:41
kishorekumar.malla@live.com10-May-08 23:41 
AnswerRe: How to create Tab control in silver light (Expression Blend 2) Pin
Michael Sync11-May-08 22:03
Michael Sync11-May-08 22:03 
QuestionExpression Blend UserControl [modified] Pin
BlitzPackage10-May-08 19:42
BlitzPackage10-May-08 19:42 
AnswerRe: Expression Blend UserControl Pin
Insincere Dave11-May-08 8:01
Insincere Dave11-May-08 8:01 
Questioncombo Box Binding Pin
AAKAra9-May-08 11:38
AAKAra9-May-08 11:38 
Hi,

I am creating a combo box, the database field is a binary with a true or false value.

I have to convert this and show "Lock" if the value is "true" and Unlock if the value is "False".

How do I do it with the databinding,





To begin with, I created an array,



private string[] binaryOnOffText = new string[2] { "Lock", "UnLock" };

public string[] BinaryOnOffText

{

get

{

return this.binaryOnOffText;

}

set

{

this.binaryOnOffText = value;

OnPropertyChanged("BinaryOnOffText");

}

}





And in my xaml I have used the booleantoIndexConverter,



<ComboBox ItemsSource="{Binding Path=BinaryOnOffText}" SelectedIndex="{Binding Path=OpenOnExitReq, Converter={StaticResource booleanToIndexConverter}}" >



</ComboBox>









public class BooleanToIndexConverter : IValueConverter

{

#region IValueConverter Members



public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

{

bool boolValue = System.Convert.ToBoolean(value, CultureInfo.InvariantCulture);

if (boolValue)

return (int)1;

return (int)0;

}



public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

{

return null;

}



#endregion

}





The binding does not work when I create the dialog(when I get the selection on the Lock irrespective of whatever value is saved), it work otherwise.

Am I missing something?



Thanks In Advance
AnswerRe: combo Box Binding Pin
User 27100910-May-08 0:17
User 27100910-May-08 0:17 
GeneralRe: combo Box Binding Pin
AAKAra10-May-08 5:41
AAKAra10-May-08 5:41 
GeneralRe: combo Box Binding Pin
User 27100910-May-08 5:44
User 27100910-May-08 5:44 
QuestiondnrTV Silverlight presentations won't run Pin
Kevin McFarlane9-May-08 9:27
Kevin McFarlane9-May-08 9:27 
AnswerRe: dnrTV Silverlight presentations won't run Pin
Michael Sync15-May-08 7:34
Michael Sync15-May-08 7:34 
QuestionKarl Shifflett - MasterPages Pin
Jammer9-May-08 5:01
Jammer9-May-08 5:01 
AnswerRe: Karl Shifflett - MasterPages Pin
User 2710099-May-08 5:22
User 2710099-May-08 5:22 
QuestionWPF App and Debug Issue Pin
Jammer9-May-08 3:33
Jammer9-May-08 3:33 
AnswerRe: WPF App and Debug Issue Pin
User 2710099-May-08 5:23
User 2710099-May-08 5:23 
GeneralRe: WPF App and Debug Issue Pin
Jammer9-May-08 5:24
Jammer9-May-08 5:24 
GeneralRe: WPF App and Debug Issue Pin
User 2710099-May-08 5:36
User 2710099-May-08 5:36 
GeneralRe: WPF App and Debug Issue Pin
Jammer11-May-08 23:17
Jammer11-May-08 23:17 
GeneralRe: WPF App and Debug Issue Pin
User 27100911-May-08 23:59
User 27100911-May-08 23:59 
GeneralRe: WPF App and Debug Issue Pin
Jammer12-May-08 4:47
Jammer12-May-08 4:47 
GeneralRe: WPF App and Debug Issue Pin
User 27100912-May-08 5:34
User 27100912-May-08 5:34 
GeneralRe: WPF App and Debug Issue Pin
Jammer12-May-08 5:51
Jammer12-May-08 5:51 
GeneralRe: WPF App and Debug Issue Pin
User 27100912-May-08 5:55
User 27100912-May-08 5:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.