Click here to Skip to main content
15,887,355 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: silverlight Pin
Pete O'Hanlon29-Jun-14 6:51
mvePete O'Hanlon29-Jun-14 6:51 
GeneralRe: silverlight Pin
Jammer30-Jun-14 23:32
Jammer30-Jun-14 23:32 
GeneralRe: silverlight Pin
Pete O'Hanlon30-Jun-14 23:59
mvePete O'Hanlon30-Jun-14 23:59 
GeneralRe: silverlight Pin
thatraja30-Jun-14 23:52
professionalthatraja30-Jun-14 23:52 
GeneralRe: silverlight Pin
Pete O'Hanlon1-Jul-14 0:10
mvePete O'Hanlon1-Jul-14 0:10 
QuestionRepost from C# forum WPF app Pin
Wesley2026-Jun-14 23:26
Wesley2026-Jun-14 23:26 
AnswerRe: Repost from C# forum WPF app Pin
Mycroft Holmes29-Jun-14 4:55
professionalMycroft Holmes29-Jun-14 4:55 
QuestionWPF Combo Box SelectedValue = null issue Pin
Mhister Pamakwas25-Jun-14 11:54
Mhister Pamakwas25-Jun-14 11:54 
I got a combo box in wpf form I set the ItemSource to the collection of Dictionary of (Pet Type) and just display the Value and hid the Key

C#
public void BindComboBoxes()
        {
            this.cboTypes.ItemsSource = new    BindingSource(CommonMgr.GetPetTypesDropDown(false), null);
            this.cboTypes.DisplayMemberPath = "Value";
            this.cboTypes.SelectedValuePath = "Key";
        }

Then whenever I type to encode a new Breed Object, and type a text in the cboTypes of something that doesn't exist in its items(not in the db), my program will ask if the end user wants to add that new PetType in the db, if yes, then it will do so.

Then i update the cboTypes using the BindComboBoxes method again, set the cboTypes.Text into the new item and assign the Key to the designated field, but the problem is, it says, it was null. it worked fine in the windows form though. Here's my code:

C#
public Breed GetPageEntity()
        {
            Breed setEntity = new Breed();
            bool doesExist = false;
            setEntity.Id = DefaultValue.GetInt(this.txtId.Text);
            setEntity.BreedName = DefaultValue.GetString(this.txtName.Text);


            try
            {
                setEntity.PetTypeId = DefaultValue.GetInt(this.cboTypes.SelectedValue.ToString());
            }
            catch (Exception)
            {
                var addAnother = MessageBox.Show(String.Format("{0}: This type is not in the database. \nAdd {0} to the database?",
                    this.cboTypes.Text), "Pet Type Cannot Be Found", MessageBoxButtons.OKCancel);

                if (addAnother == System.Windows.Forms.DialogResult.OK)
                {
                    petTypeMgr.Entity = this.PetTypeAdder(cboTypes.Text);
                    string temp = this.cboTypes.Text;
                    petTypeMgr.Insert((petTypeMgr.Entity), fUser.Entity.Id, ref doesExist);
                    //cboTypes.ItemsSource = null;
                    //cboTypes.Items.Clear();
                    BindComboBoxes();
                    cboTypes.Text = temp;

//SelectedValue became null
                    setEntity.PetTypeId = DefaultValue.GetInt(this.cboTypes.SelectedValue);
                }

            }

            setEntity.Description = DefaultValue.GetString(this.txtDescription.Text);
            setEntity.SortOrder = DefaultValue.GetInt(txtSortOrder.Text);
            setEntity.StatusId = true;
            return setEntity;
        }

AnswerRe: WPF Combo Box SelectedValue = null issue Pin
Mycroft Holmes29-Jun-14 5:01
professionalMycroft Holmes29-Jun-14 5:01 
QuestionWPF RichTextBox Document Bind using Binding property Pin
moorthy00724-Jun-14 0:29
moorthy00724-Jun-14 0:29 
AnswerRe: WPF RichTextBox Document Bind using Binding property Pin
Richard Deeming24-Jun-14 0:43
mveRichard Deeming24-Jun-14 0:43 
QuestionDisplaying (Calling) 2 UserControl within a UserControl (WPF) Pin
LAPEC23-Jun-14 23:56
LAPEC23-Jun-14 23:56 
AnswerRe: Displaying (Calling) 2 UserControl within a UserControl (WPF) Pin
Matt T Heffron24-Jun-14 7:09
professionalMatt T Heffron24-Jun-14 7:09 
GeneralRe: Displaying (Calling) 2 UserControl within a UserControl (WPF) Pin
LAPEC24-Jun-14 7:32
LAPEC24-Jun-14 7:32 
QuestionAsync method using RenderTargetBitmap and BitmapEncoder Pin
FlurryKnox18-Jun-14 21:40
FlurryKnox18-Jun-14 21:40 
AnswerRe: Async method using RenderTargetBitmap and BitmapEncoder Pin
Gerry Schmitz19-Jun-14 13:39
mveGerry Schmitz19-Jun-14 13:39 
GeneralRe: Async method using RenderTargetBitmap and BitmapEncoder Pin
FlurryKnox20-Jun-14 6:34
FlurryKnox20-Jun-14 6:34 
GeneralRe: Async method using RenderTargetBitmap and BitmapEncoder Pin
Gerry Schmitz20-Jun-14 10:21
mveGerry Schmitz20-Jun-14 10:21 
GeneralRe: Async method using RenderTargetBitmap and BitmapEncoder Pin
Pete O'Hanlon20-Jun-14 10:48
mvePete O'Hanlon20-Jun-14 10:48 
GeneralRe: Async method using RenderTargetBitmap and BitmapEncoder Pin
Gerry Schmitz20-Jun-14 11:10
mveGerry Schmitz20-Jun-14 11:10 
GeneralRe: Async method using RenderTargetBitmap and BitmapEncoder Pin
Pete O'Hanlon20-Jun-14 11:16
mvePete O'Hanlon20-Jun-14 11:16 
GeneralRe: Async method using RenderTargetBitmap and BitmapEncoder Pin
FlurryKnox21-Jun-14 19:35
FlurryKnox21-Jun-14 19:35 
GeneralRe: Async method using RenderTargetBitmap and BitmapEncoder Pin
Gerry Schmitz22-Jun-14 1:51
mveGerry Schmitz22-Jun-14 1:51 
QuestionStarter MVVM Framework Recommendation Pin
cjb11018-Jun-14 2:58
cjb11018-Jun-14 2:58 
AnswerRe: Starter MVVM Framework Recommendation Pin
Pete O'Hanlon18-Jun-14 3:24
mvePete O'Hanlon18-Jun-14 3:24 

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.