I'm using the DevExpress WPF grid control. When you hover the mouse over a grid cell, and that grid cell is too small to display the entire value, a tooltip is automatically generated containing the full value, like this: (sorry, print-screen doesn't capture the mouse pointer)
Is there any way to suppress this? Ideally, i'd like to suppress it for only certain grid columns if possible.
The MSDN documentation for the event FrameworkElement.ToolTipOpening (exposed by the grid column) says:
To prevent a tooltip from appearing in the UI, your handler for ToolTipOpening can mark the ToolTipEventArgs event data handled.
However, I've tried that, and it doesn't work in this case. Other posts on the web refer to using a TooltipController, but since I'm using the WPF grid, there's no such class (that I can see).
You can forbid toltip by setting the column's Settings.ShowTooltipForTrimmedText to false.
Related
I'm using a UI-Grid control for user input in a big project at work. There are cases when the grids should be available in read-only mode, meaning that any clicks from the user should remain without effect.
I have searched the documentation as much as I could, but all I've come up with is the isRowSelectable property in the options of the grid. However, I am also using the grid as a treeView. And the expand/collapse buttons are still active.
Is there a possibility to make the grid read-only as if it had supported a "disabled" attribute the way that text inputs do? Is it possible to disable it altogether?
In the end, I have used a div acting as an overlay that I put right above the grid. It has a semi-transparent gray background, the exact dimensions of the grid, a higher z-index, a not-allowed cursor, and a no-op click handler.
Depending on whether the parent container of the grid (and the overlay) has a CSS class that says the grid is meant to be disabled, the overlay shows up and blocks the user from interacting with the grid. It's a simple solution that covers my needs.
I want to show all the ToolTips on a view as soon as it's opened. That's fine, I can set the ToolTip.IsOpen properties to true. That certainly shows the ToolTips, the problem is they all show up at (0, 0). Apparently the positioning of the ToolTips doesn't happen until its target control is hovered. Only after hovering are the ToolTips positioned correctly. Setting focus to all the controls first doesn't help either; the target control has to receive the hover event. I'm assuming the ToolTip hooks into the hover event of its target and positions itself inside this event. Is there a protected method I can call in a ToolTip subclass or some such?
ToolTipService.SetPlacement(button1,
System.Windows.Controls.Primitives.PlacementMode.Top);
See this MSDN Page to see all the placement options
EDIT
See this article about the custom positioning of tooltips. It refers to a project on codeplex that contains the code: SmartToolTips
As far as I can tell what I'm asking here is not possible beyond manually doing layout or customizing the source. I implemented a completely custom tooltip instead. sigh
My requirement is rather a tricky one (it seems to me).
I will explain the scenario.
I have a DataGrid. In the DataGrid, I have two columns in which I have a grid in every cell of these two columns, inside of which, there are two comboboxes - the purpose being to switch the visibility based on some conditions.
When we select a value in the combobox, the combobox itself, plus some other controls in some other columns will get disabled (requirement of the pjt). Now there is also, another requirement like, Tab should not be allowed in the cell which has disabled controls - say disabled combobox.
We are setting the controls as Enabled or Disabled based on a selected value from the combobox. So, since we are applying the disabling property on the control level, and the IsTabStop property is on the cell level, I am not able to restrict Tabbing in the cells having disabled control.
Any thoughts?
Don't use a DataGrid.
DataGrid's are awesome for read-only stuff, but they seem to suck for doing any kind of interesting editing. After well over a week of fighting with it, I've given up on it.
Right now I'm looking for a replacement, which may end up just being a scrollable stack panel with manually added controls.
WPF: Is there a "ListBox" without the ability to select items?
We are using WPF and have a window derived from a DockingLibrary. This window has a grid with multiple items in it, one being a WPF datagrid. We are using the M-V-VM pattern. When this windown is created and shown, none of the rows in this datagrid are selected. We can set the row to display as highlighted by doing something like:
SharedWindow.ShipmentWin.shipmentDataGrid.SelectedIndex = 0;
This causes the first row in the datagrid to be shown as highlighted. But, and isn't there always one of these, this row is not Selected nor does it have Focus. I tried setting IsSelected and Focus on this row as in:
SharedWindow.ShipmentWin.ShipVM.IsSelected = true;
bool focused = SharedWindow.ShipmentWin.shipmentDataGrid.Focus();
Am I going about this all wrong and is there some other way to Select the first row in the datagrid and set focus to it? Typically, when a datagrid is created, no row is selected until the user mouse clicks on the desired row.
Any thoughts would be greatly appreciated.
thanks!
Have a look at the FocusManager. It allows you the set the focus to another UI element via the SetFocusedElement method. Additionally, it allows you to determine the currently focused element in your application which is can get handy to debug focus issues. Snoop can be useful, too. It shows the currently focused element in the bottom status bar.
If you use the DataGrid from the WPF Toolkit, be prepared to find some bugs in relation to focus handling. Some have been addressed recently.
It's also worth understanding the difference between logical focus and keyboard focus, which are quite different animals. The .Focus() method sometimes only sets logical focus - which probably isn't what you want.
The documentation for the Focus method tells you that it will return true if the keyboard focus was set, and false otherwise.
I have a Silverlight form that contains a Stack Panel (orientation = vertical) with 10 rows. Each row contains a TextBlock and Textbox control except the last row has a TextBlock and Drowdown.. At the bottom of the control are two buttons. Previous & Continue.
There are 10 items in the Dropdown. When I select a value from the Dropdown, only two of the ten items are showing up. I believe that the remaining items aren't displying because there's some sort of clipping effect going on. Fair enough.
Does Silverlight allow the dropdown control to display upwards (instead of the default down direction)? Will I have to override some rendering capabiliities before the dropdown is rendered to the control or is there a property that allows me to accomplish this functionality?
The Silverlight ComboBox auto aligns the dropdown popup to always be visible whenever possible.
all Popup based controls (ComboBox, AutoCompleteBox, DatePicker and TimePicker) all have this feature enabled.
So if there's not enough screen real-estate below the ComboBox to show the dropdown popup, it'll show up above the control.
The combobox nesting in the visual tree should not affect the dropdown popup auto alignment. The internal Popup control (inside the ComboBox) ignores the Visual Tree and is nested "above" the visual tree.
If you have specific issues, please share minimal and relevant XAML. Since Keith is on this thread, I think it's safe to say he'll log a bug if needed.