c# - The value is not within the expected range -


Can we present two UI elements in the same grid position in the selection of the combo box in a related event.

The exact problem I have is the grid and there are two rows inside the grid. The first line always shows me a combo box (from which I was talking about the first line) In the second row of the same position will have to render the different UI elemts.

So I tried rendering the UI elements in the Combo Selection Changed Event.

But the problem occurs when I select the first element, it is displayed correctly but when I try to select the second UI element in the same situation on the combo selection change One warns "Value is not within the expected range." On line: "biggrid.children.Add (ck);"

My code for doing this is:

  grid childGrid = createChildGrid (); Grid ck = new grid (); // The second row on the CK will include line zero and the UI elements include the combo box. Roud Definition. Add (New Row Definition ()); Ck.RowDefinitions.Add (new lineology ()); Int loopCount = 0; // This variable will help change the line pointer if (loopcount == 0) {combo box CBB = new combo box (); // Here I add the item to the combo: foreach (string ccp in attributeName) {if (ccyp! = Null) cmb.Items.Add (ccyp); } Cmb.SelectionChanged + = (O, E) => {TxtblkName.Text = cmb.SelectedValue.ToString (); Ck = GeneratedUImailConarkingSomethingTotLabelNameNameOn-Combo Selection (txtblkName.Text); // This function will give the grid to the UI elements selected from the combo box. Grid Satro (ck, loop number); BigGrid.Children.Add (ck); // ** Provide this line exception: "Value is not within the required range." **}; } Grid .Set column (CMB, 1); ChildGrid.Children.Add (CMB); Grid Satro (hair grid, loop number); BigGrid.Children.Add (childGrid); LoopCount ++; // I incrtease loop count so that the sequence of the combo UI on the selection is displayed in the second row. Arrow number = 1  

edit: On debugging I get: The result of the break point is: loopcount = 1 (second Line for rendering of combo items) This " grid .setto (ck, loopcount); big grid; child.ed (ck); " and loopcount = 0 for combo box display (Here's the meaning: "Grid Seetorov (Child Grid, Lupacount); Big Grid. Add Child (Hair Grid); Loop Calculation ++; "

< / Div>

The question can be:

"This error can occur when two elements add to the same name." What is the identifier in the combo box

If this is the problem, as suggested in the linked question, you can add a unique identifier to each combo box.

< / Html>

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -