Weird grid behavior ( must click scroll bar ) - wpf

I'm programming an application that loads a list of rows in a grid using WPF, DevExpress with an MVVM approach.
I have a button that adds an new element to a ListRow, which is binded to GridControl's ItemSource. This list notifies the view when it's modified.
The problem is that when you click NewRow button the scroll bar grows bigger with each click but only when you click in the scroll bar the content of the list is repainted in the window.
Does anyone have any idea? Why is this happening?
PS: I didn't write here any code because I think is needless to show such a long code. But I can put it if you want.

Related

How can I get back my lost Checkboxes (after moving them from the Form to the Panel)?

I placed several panels on my form. When I clicked the central panel in the designer, the main form was what was actually selected (even though the panel should be on top of it, and the main form should not be (easily) clickable in the designer).
By the way, clicking the other panels on the form don't have this problem (all of the other panels are on top of the form).
Because of the form being clicked when I expected that I was clicking the panel, when I added several controls to what I thought was the panel (after successfully adding some labels on top of the panel), all of these controls (checkboxes) ended up on the form / below the panel, so that they don't display at runtime:
When I realized that the controls were on the form, and not on the panel, I selected the form from the Property browser, selected all of the checkboxes at once, and cut the group of them.
I then selected the main panel from the Property Browser, and pasted those cut checkboxes onto the panel. It sort of worked, but all I saw was their outline (all selected together). I used the Ctrl+Up arrow to move them in a body up on the panel, a little at a time, until they were all near the top where they belong. But then they just disappeared.
From now on I will make sure to right-click the panel and select "BringToFront" before adding any controls to that area; for now, though, I don't see the checkboxes on either the form or the panel. How can I get them back (and place them on the panel), and prevent the form from ever appearing on top of the panel (except if/when I select it from the Property browser)?
The checkboxes do still exist, although their names were changed from "ckbxAll" etc. to Checkbox1, etc. They appear on the correct panel in Form1Designer.cs, but do not display. Here is how they are represented there:
// panelMain
//
this.panelMain.BackColor = System.Drawing.Color.White;
this.panelMain.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panelMain.Controls.Add(this.checkBox21);
this.panelMain.Controls.Add(this.checkBox20);
this.panelMain.Controls.Add(this.checkBox19);
this.panelMain.Controls.Add(this.checkBox18);
this.panelMain.Controls.Add(this.checkBox17);
this.panelMain.Controls.Add(this.checkBox16);
this.panelMain.Controls.Add(this.checkBox15);
this.panelMain.Controls.Add(this.checkBox14);
this.panelMain.Controls.Add(this.checkBox13);
this.panelMain.Controls.Add(this.checkBox12);
this.panelMain.Controls.Add(this.checkBox11);
this.panelMain.Controls.Add(this.checkBox10);
this.panelMain.Controls.Add(this.checkBox9);
this.panelMain.Controls.Add(this.checkBox8);
this.panelMain.Controls.Add(this.checkBox7);
this.panelMain.Controls.Add(this.checkBox6);
this.panelMain.Controls.Add(this.checkBox5);
this.panelMain.Controls.Add(this.checkBox4);
this.panelMain.Controls.Add(this.checkBox3);
this.panelMain.Controls.Add(this.checkBox2);
this.panelMain.Controls.Add(this.checkBox1);
this.panelMain.Location = new System.Drawing.Point(160, 0);
this.panelMain.Name = "panelMain";
this.panelMain.Size = new System.Drawing.Size(639, 740);
this.panelMain.TabIndex = 2;
//
UPDATE
It turns out they ARE there, but they are invisible now (except for their outlines when I click on them):

What is good choice between Modal Window & Dialog in order to display some data using MVVM Light Tool Kit?

I am new in MVVM world. I have a question about the child window and I want some explanation. I have some collection of data and I am displaying it in the datagrid of main window. I want to select a item from collection and want to display that data in some Modal Window, Dialog or Popup. I want to edit that data and these changes should be reflected in the datagrid of main window.
Can anyone tell me what is good choice among Modal Window, Dialog and pop up. I am using MVVM Light Toolkit.
In my opinion choise between modal and non-modal window depends only on the UI experience you want to achieve. If for some reason update of the row item can't be done simultanously to other actions on the grid items you need modal one.
As described here Dialog boxes overview
A modal dialog box is displayed by a function when the function needs additional data from a user to continue. Because the function depends on the modal dialog box to gather data, the modal dialog box also prevents a user from activating other windows in the application while it remains open.
Modal dialog would be easier solution as you dont need extra validation on the row you are editing - you simply can edit one row at the time (and I assume you it wouldn't be possible to remove this row in main view while editing in edit window).
If you want to have changes done in child window reflected in your main grid, just use observable collection of items in your main view and pass certain item from this collection as a DataContext of your child window.

Dropdown menu overlaps other controls

In my WPF application I would like to get a dropdown menu under some other elements in the window. When menu is expanded it overlaps other controls. But I need these controls remain over the menu anytime.
I tried to play with ZIndex, but without any success.
Is it possible somehow to show dropdown menu under other controls?
Thanks for help!
You cannot achieve this with a drop-down menu, because by definition it is displayed on a separate window above the current window.
So if you want some control to appear under other controls, you have to use just normal controls like Grid, make them invisible at the beginning, and show as soon as you need the "dropdown" to appear (and of course hide afterwards).

Sizing panels in an ItemsControl

I have a parent view model, that contains a collection of other view models (of same type) (children). On Initialization the number of children will be decided (varying).
The child View consists of a button and a list box. Initially the listbox is hidden. On click of button the list box appears and on clicking outside (outside of the control or any other child button).
On init only buttons will be shown. I want these buttons to be spaced across the available width. The requirement is that once the button is clicked (when listbox is shown) the width of the whole child will increase (lets say 350) and when it is hidden it reverts back to the original size.
In the parent i am using a ItemsControl to show the children views. I have tried all controls but not able to figure ou a appropriate solution for this. I have two issues:
On Button click i am able to show current listbox. If i click another button teh first one goes off. Till here it works fine. But i also need that the currentopen listbox closes on click anywhere outside of the control (child control)
How to automatically size and resize based on what is clicked . First all should be propotionately sized and then when one is clicked it's size increases (here other childs resize with the rest available space). When the one (open control) is collapsed, all of them come back to normal proptionate sizes.
Any ideas ?
BTW, i am using MVVM pattern for this.
how about using a flag to direct the view to perform calc and refresh/readjust the sizing as when needed.
like on-click routine, set the flag on
whenever the view (pre-)painting/drawing event is kicked in, check if the flag is on, do the calc and sizing, then off the flag.

silverlight combobox - highlight a few items in the popup list

I'm wondering if I can make fake sections in the popup menu:
The rule would be, if the 5th character of the displayed item is different from the 5th char of the previous item in the menu, it has to be highlighted
What do you think?
Thanks!
To achieve this would be a hack.
Normally the items that appear in the popup part of a combo box will be an instantiated data template, and each gets its own data item and has no clue or knowledge of the other items in the list, so you couldn't use a converter or anything else to achieve this behavior.
What you could do though is inject (attach) your own control into the popup part of the combo box, and take over the rendering of the data items. How you do this will depend upon which combo box you are using (i.e. MS or some other vendor's) and would be a whole new question.
Would that be easier if I were to create my own combobox as follow:
a TextBox associated with a Button that when pushed would popup a datagrid in which I could implement this conditional formatting?

Resources