I have a grouped gridview inside my "zoomed in" part of the semanticView control. Groups can be empty (I used ).
In my "zoomed out" gridview I have listed all letters from "A" to "Z". Letters referring to empty groups appears disabled (dimmed Foreground, there isn't a "IsEnabled" property available here).
What I need to do is abort the "zoom in" transition in response to a click on a letter corresponding to an empty Group.
Any suggestion?
Thanks for your time.
Orf Quarenghi
I'm not 100% sure of this answer as I currently have no way to check/test - but as a suggestion I would check if IsEnabled property disables the semantic zoom transition from firing.
You mentioned there isn't an 'IsEnabled' property - what are you checking? If you use a datatemplate to render your UI in the gridview you could use something like a Border (which does have IsEnabled) to wrap your Child/Item UI and bind the 'IsEnabled' property to the respective field on whatever you have placed in your ItemSource.
Related
I am working on a project in which I am using a property grid to display the properties of the selected control.
The Property Grid is fixed to the left edge of the container and in the rest of the space I have the form I am designing.
On clicking a control on the form, the specific control’s property is getting selected.
In the above figure, I have selected the textbox and the textbox’s properties get shown on the propertygrid.
Here if you observe, by default, the Name property is highlighted as well.
Is there some way to unselect this property programmatically?
I have tried some suggestions online but none have helped. I am not able to find find a way to remove all selections from the PropertyGrid, but its behaviour seem to be different form a DataGrid...
Here is why I need this...
On selecting a control, if a property in the property grid is selected, then the property is getting modified.
For example, If i cut the control using Ctrl + X, the selected value in property grid is getting cut which in some cases is forcing user to set the property before modifying anything on the form.
I have tried selecting multiple controls, but in that case alse the selected property seems to be persistent
Since PropertyGrid uses DefaultProperty to select a property in its grid, as an option you can set DefaultProperty attribute at run-time for your object to a non-browsable property, for example:
this.propertyGrid1.SelectedObject = null;
TypeDescriptor.AddAttributes(someControl,
new Attribute[] { new DefaultPropertyAttribute("Site") });
this.propertyGrid1.SelectedObject = someControl;
Well, what you are trying are hacks. It is never a good idea to do such hacks particularly if you are not the only person that use the software.
In your case, the focus should be on the designer while you interact with it. So if the user press Ctrl+X, the designer should respond to the keyboard and it should not have any effect on the property grid (as only one control can have the focus at the same time).
Thus it is up to you to make sure that your designer is focusable, that it has the focus when initially displayed, that it get the focus when you press the TAB key. Pressing the TAB key again should put the focus on the property grid so that user can interact with the grid without using the keyboard.
If you have more than these 2 controls, then obviously TAB should also stop at any appropriate controls. Also, it can be a good idea to have some direct shortcuts like F4 to (show and) activate the properties pane.
If you are not able to make it works, then the best compromise would be to use another windows for the properties grid. By using a distinct Tool windows for the properties, it should not respond to the keyboard when the main windows has the focus.
Here are some links that might help you:
Panel not getting focus
Control.Focus Method() — See Remarks section.
In any case, you should not prevent Ctrl+X to works as expected when the property grid has the focus and a property is selected. Users don't like software that do not follows UI conventions.
As a software developer, you should as much as possible ensure that your application follows standard behaviors. I recommend you that you take one or 2 extra days developing your software properly instead of doing hacks.
Often, compromise to gain a few days will never be fix and will be a pain for many years. Better to do it right from the start. Unselecting an item in the property grid is not an acceptable workaround. Your manager should not allows you to do that.
I have a groupbox of checkboxes, I want to link the groupbox with Themes checkboxThemes image is an example.
How to link Theme1 and Theme2 with Themes?
You gave no indication what 'linking Themes to the groupbox' means nor what the indeterminate state means. However, since checking/selecting Theme1 probably excludes the use of Theme2, it seems like you are not using the right UI presentation (since the user can select both).
Consider a ComboBox with the Entries {"No Theme", "Theme 1", "Theme 2"}. That way no one is confused and less form space is consumed.
Edit
If your edit really reflects what you want, set the "outside" check state whenever one of the inside checkbox's checkstate changes. It still makes no sense - what do you do when the user checks/unchecks the outside box?
I've noticed a strange bug when creating a desing with xaml:
sometimes I'm able to "select" controls the way I'd select text.
Normally the controls would look like this:
while if accidental selection happens, it looks like this:
Why does this happen, and how do I prevent it?
UPDATE
Here's the controls that I'm using:
TreeView->Expander->StackPanel->DataGrid
Based on the answers, the problem probably originates from TreeView.
How do I prevent TreeView items from being selected?
It appears your control is based off a listbox which supports being able to select items in that manner. Perhaps change the underlying control to be based on an 'items control' instead.
Edit:
Tree view has the same behavior allowing to select an item. See this question...
Disable WPF TreeView (or TreeViewItem) selection?
That should only be the case if the control is inside something selectable like a ListBoxItem, to prevent that use ItemsControls instead of subclasses of Selector (e.g. ListBox). If that is not it i don't know what is going on as i have never seen something like that.
Judging from your edit you appear to have TreeViewItems, you could either override the respective brush-keys to hide the selection or add a TreeView.ItemContainerStyle which changes the Template to something which will not show the selection in the first place.
I have some DomainUpDown controls in my application. The behaviour is set like this:
Normal: Each control can individually goes Up/Down (Change selected item)
Special: If a check box is checked, Up/Downing the first control will cause the other controls to change as well
Now there are some cases that I want some of the controls to be disabled by setting Disabled = true. I did it, but in this case changing the selected item of the first control will cause the other disabled controls to change the selected item as well.
Is there a way to completly disable a control so it does not accepts something like control.Text = "bla bla" ?
P.S: I need not to hide the control!
One way:
You can hold a list of Textbox.Text values, which will hold entries for all of your textboxes.
Upon OnTextChanged:
if your textbox is enabled - update it's text property and store it up in the list.
if your textbox is disabled - set it's text property to the last value you had in your list.
You can use a Dictionary or anything similar that contain KeyValuePair objects.
I'm afraid there's not. At least not without additional work.
I have 2 grids. When user is doing edits in one grid, I want to disable the other grid from getting focus, or atleast other grid from changing its foccussed row.
Example:
Parent grid, children grid.
If user is making edit in children of particular parent. I want to prevent user from suddenly shifting focus to different parent row. how to do that ?
The only ways you can prevent a control receiving focus is to change it's Enabled or Visible properties.
Simply changing the parent's Enabled property to "false" (e.g. for the CellBeginEdit) and then back to "true" (e.g. in the CellEndEdit event) will prevent the user from selecting a new parent row.
There are a lot of ways to do this but thats how I would do it (just a concept so ignore if any property does not match):
Create a property called mode and then use enumeration to set it to Edit or None etc.
Suppose you have GridViewParent and GridViewChild. In the FocusedRow event of child grid, at the start of all code, set the value of mode to Edit and at the end of all code in the event set it to None.
Then in the FocusedRow event of parent grid check whether the mode value is edit or not, if it is edit then use e.Cancel or something to get out of the focused event of the parent.
Now if you let me know exactly which grid are you using I might send you the code.