Click here to Skip to main content
15,919,358 members
Home / Discussions / WPF
   

WPF

 
QuestionMultipass MeasureOverride() not calculating updated items size (added code sample) Pin
Super Lloyd2-Jul-14 3:50
Super Lloyd2-Jul-14 3:50 
QuestionDraw a rectangular box Pin
Subin Mavunkal1-Jul-14 23:24
Subin Mavunkal1-Jul-14 23:24 
AnswerRe: Draw a rectangular box Pin
Matt T Heffron2-Jul-14 13:53
professionalMatt T Heffron2-Jul-14 13:53 
QuestionXAML Pin
Member 97193591-Jul-14 22:21
Member 97193591-Jul-14 22:21 
AnswerRe: XAML Pin
Pete O'Hanlon1-Jul-14 22:55
mvePete O'Hanlon1-Jul-14 22:55 
QuestionWPF Expander Problem Pin
Kevin Marois1-Jul-14 13:49
professionalKevin Marois1-Jul-14 13:49 
AnswerRe: WPF Expander Problem Pin
Pete O'Hanlon1-Jul-14 19:11
mvePete O'Hanlon1-Jul-14 19:11 
QuestionWPF - PRism Framework Pin
Muhammed Nigil29-Jun-14 23:36
professionalMuhammed Nigil29-Jun-14 23:36 
AnswerRe: WPF - PRism Framework Pin
Pete O'Hanlon30-Jun-14 0:17
mvePete O'Hanlon30-Jun-14 0:17 
GeneralRe: WPF - PRism Framework Pin
Muhammed Nigil30-Jun-14 1:00
professionalMuhammed Nigil30-Jun-14 1:00 
GeneralRe: WPF - PRism Framework Pin
Pete O'Hanlon30-Jun-14 3:03
mvePete O'Hanlon30-Jun-14 3:03 
GeneralRe: WPF - PRism Framework Pin
Muhammed Nigil30-Jun-14 18:56
professionalMuhammed Nigil30-Jun-14 18:56 
GeneralRe: WPF - PRism Framework Pin
Muhammed Nigil30-Jun-14 19:26
professionalMuhammed Nigil30-Jun-14 19:26 
QuestionHow to display from nested usercontrol another usercontrol class on button click event? Pin
LAPEC29-Jun-14 7:12
LAPEC29-Jun-14 7:12 
QuestionHow to Display .aspx page in SilverlightWeb Application Pin
RavitejaPammi28-Jun-14 5:22
RavitejaPammi28-Jun-14 5:22 
Questionsilverlight Pin
Member 1087962427-Jun-14 19:40
Member 1087962427-Jun-14 19:40 
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 

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.