Popup Bug in WPF GridComboBox demo by Marco Zhou - wpf

I need to have a ComboBox with multiple columns and column headers. I found Marco Zhou's GridComboBox demo which I like because it's a pretty bare bones approach to doing so and it supports declarative column binding. I've found a couple minor "bugs" or lacking styles with it, but the one that has me stumped is when I bind the combobox to a DataView with a few thousand rows, the first time I open the drop down, the popup displays in the top left hand corner for a few seconds, then jumps down under the toggle button where it should be. I notice while its displaying in the top left, if I hover my mouse over the items its response lags. After it pops back into the correct position it responds quickly. So it seems like it is still loading/processing while it is in the top left and then updates its position once it's done. Almost like virtualization is not working. How can this be fixed?
http://www.cnblogs.com/Files/sheva/GridComboBoxDemo.zip

ComboBox is not virtualizing by default. It must be switched on manually and this is not done in the code you provided. Read about: VirtualizingStackPanel for ComboBoxes.

Related

programmatically making a dropdown menu in vb.net WPF

I'm making a custom dropdown button (since the one included in wpf requires too much hacking to style right). Now that i got the button bit out of the way i need to add the drop down part.
My first thought was to add a stackpanel and use that to contain the items but it gets cut off if it leaves the borders of the grid that the button is in. Next up was the popup primitive, it gets on top of everything nicely enough but position wise it just free floats and i haven't figured out how to make it follow the button it was spawned by. I also tried using contextmenu but that seems to have no positioning controls at all and just sits where the mouse made it..
Anyways wpf is a big package and I'm just getting into it, anybody know which direction i might find what I'm looking for?
Preferred approach normally is to use a Popup. You got two very important properties with a Popup
PlacementTarget and Placement
Setup a binding for PlacementTarget on the Popup to your custom Button and then use Placement to position the Popup accordingly w.r.t to the PlacementTarget(Button)
Placement accepts an enum of type PlacementMode which gives you quite a few options to position the Popup.

XamDataGrid XamTabControl WPF MVVM Peculiar Behavior

I'm facing a problem in implementing the following scenario:
When the user selects a record in a XamDataGrid, the control flows into another tab showing the details of the selected record.
The way I have done this is:
At the selection change of the XamDataGrid, I'm sending index of the tab to be activated using MVVM Light Messenger.
Setting the property bound to the Seledted Index of the Tab Control to that number.
Everything works smooth till here. Afetr that if I go back to the tab containing the grid, somehow the control comes back to tab which was activated.
As if, some intrinsic selection of cells in happening in the grid. Does Hover also affects the selection of the xamdatagrid?
I'm new to Infragistics and kind of confused. If some one can help.
All code are in View Model files and no code in the code behind of xaml file.
Cheers,
Anshuman
I played around a lot.
But the only way to get this wqorking was to disable all hover animations and effects.
Now it works as expected!

Silverlight: Drag multiple rows from a datagrid

I am working on an app where the user needs to be able to drag items from a datagrid onto a button (this then fires some data updates). After some messing around, I have this working quite well. I have used the DataGridDragDropTarget controls from the toolkit for this.
I now need to allow the user drag multiple rows at once. While the datagrid allows me to select multiple rows, the DataGridDragDropTarget will only drag the first of the selections.
It looks like the DataGridDragDropTarget is not built for multiple dragging.
Would be grateful for any help on this one, this is the first time I have posted on SO - and hoping you guys can come through for me.
Thanks all.
It will drag multiple rows for sure. I am sure you are doing same mistake as i did. I believe all your code are fine.
To drag multiple row click on one row press shift or ctrl to select multiple but "Note here: If you release your mouse click here before drag it will forget what are the multiple items it has selected", so just drag without leaving mouse on your last selected item.(So, I think it works that way without doing anything)
However I am also searching for someway to make it work like drag and drop as in desktop. ;-)

How to make popup grow up in silverlight?

I'm having a problem with combobox popup (not sure if it's a problem of combobox). First when i click it, dropdown popup opens correct - upwards(there are about 50 items in it, and combobox is located in the bottom of the page, if it goes downwards, there would be only 5 items visible). But then if i select any item, and them open it again - it will open downwards and put items in a scroll. So how can I fix this and force popup open in the desired direction?
Are you setting the "MaxDropDownHeight" at some point? By default it is infinity but maybe setting to hard # greater than # in combo box might help.
Also I just tested this in SL4/Firefox and the combo box pops up each time (with or without a selected item). What version of SL are you using?
Well, what I've done - I subscribed to SizeChanged event of the Border element which is a child of Popup.Child canvas. In that method, I'm calculating space below and above the combo box and then setting Top offset using Canvas.SetTop method to that border and it's MaxHeight. Maybe I will post some code later.
I was having this exact same issue (actually with Silverlight 5, but the same behavior nonetheless). I tried various things with MaxDropDownHeight but that did not correct the problem.
#Walker the approach you mentioned in your answer sounded promising but I was not able to tell from your description how you actually implemented that.
In any case, I found a rather unlikely solution. I discovered that if I populated my ComboBox with ComboBoxItems instead of a collection of custom objects, then the dropdown/selection/direction issue does not occur. I've posted an answer here that goes into a little more detail.

Animating through listbox items in Silverlight 4

I have a ListBox bound to a collection of custom objects. I have an ItemTemplate set up for displaying those items. Each item takes up a large rectangular area, so what I want to do is actually only display one item at a time. After ten seconds, I want to animate (maybe slide in/out or fade in/out) to the next item so that only that one is displayed and so on.
I can't get to grips with how to achieve this, can anyone help please?
Maybe a listbox isn't even the right approach?
If you are not dead set on using a listbox, you can get this effect using a TransitioningContentContol instead. How-to Video here (the control is in system.Windows.Controls.Layout.Toolkit). It is now part of the released toolkit (the video is old).
Part of the demo shows how to emulate exactly the behaviour you are after. You can add a slider to the side if you still want it to look a bit like a listbox (and change the selection in response to the slider value changes).

Resources