If I have a normal DataGridView and I want to show only the horizontal lines, I apply the following code:
dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal;
Using the UI template Krypton for WinFroms, it is not working for me. I use:
kryptonDataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal;
And the lines still appear!
Did anyone come across this problem and solve it?
I know this is an old question, but I hope you can still find this useful:
Why your code doesn't work:
Well, KryptonDataGridView inherits from the DataGridView WinForms control, and by looking at the source code, you'll find that KryptonDataGridView.CellBorderStyle simply gets or sets the value of base.CellBorderStyle which are not the same borders displayed by KryptonDataGridView.
A lot of the inherited properties doesn't have an effect on Krypton controls (the Font property, for example). But in most cases, Krypton provides an alternative (with more features usually).
Solution:
To replicate the behavior of DataGridView.CellBorderStyle, with KryptonDataGridView, you should use the DataCell.Border.DrawBorders property of the appropriate State:
using ComponentFactory.Krypton.Toolkit;
//
kryptonDataGridView1.StateCommon.DataCell.Border.DrawBorders =
PaletteDrawBorders.TopBottom;
Result:
Hope that helps.
Related
Sorry but I am a newbie to WPF, I would really appreciate if you could help me-
Tag 1 in pic- Which control can I use to create a menu similar to that in the picture ? The closest I came was using a gridview within a listview but that ends up using a header for the gridview. Normal listview just highlights the entire strip and doesn't look good at all.
Tag 2 in pic // (No longer relevant, sorry)
Edit:
Looking for something simple like when using gridview with listview (as in pic below) there is automatically that standard window gradient & bevel effect etc. (As an idea, implementing it with buttons seems to cumbersome, first strip button border, then create all these effects.) So essentially anything already inbuilt in WPF.
Thanks for any help :-D !!!
ListBox or ListView are good controls to use. If it's just the 'pretty' factor you don't like, you can provide Templates to change the appearance. But functionally, ListBox and ListView provide the function of that menu.
When working with WPF, that should be your primary motivation when choose controls. What FUNCTIONS the way you want. You can always make it LOOK different with Templates, but getting the right FUNCTION is the primary goal for the control.
is there a simple way to set the tooltip property of a listview item to be a balloon? Typically all i would do is:
Tooltip tt = new Tooltip("This is a tooltip");
tt.isBalloon = true;
but how do i do this for a listview item
You can manually show ToolTip when mouse is over certain item
check this article
There isn't an easy way to change the tooltip on a ListView. See this blog for a detailed explanation of why.
ObjectListView -- an open source wrapper around a standard WinForms ListView -- does a reasonable amount of work for you so that you can show enhanced tool tips with minimal effort on your part.
Even if you don't want to use ObjectListView, you can still look at the code to see how it is done (admittedly, in the case of tool tips, there was a lot of work done and it would be tricky to extract that work into another project)
I've just started developing in Silverlight, and I have a calendar control which shows details for each day.
The text within the calendar is held within lots of textblocks, for some browsers the text size might be too big, so I want to have a slider control on the 'usercontrol' which allows the user to adjust the font size.
I'm building the calendar through c# code, so my question is.. what is the best way to 'wire' this up. I'm guessing it would be one of these options.
Add an event to the slider control for ValueChanged, then iterate through all TextBlocks setting the fontsize to the new size. This seems long-winded.
Maybe using a 'Style', which is attached to each TextBlock, then just changing the FontSize of the 'Style'.. ?? maybe ?
Using 'binding' & 'Dependancy Property'. I've looked into this, and it seems to be the way to do it, but I can't find an example where you're passing a value from one control to multiple other ones. Maybe I'm missing something.
I can do option 1 quite easily, but I want to learn about alternative methods of doing this.
Thanks
Rich.
A way to handle this is to not use fixed sizes but to size everything to its content. that way the control will get bigger when a larger font size is selected. Just like the TextBlock.
I've actually got this working now using option 3 which I'm happy with, it was very simple, but there seemed to be little documentation on it (maybe I was searching for the wrong thing).
It was as simple as adding a few lines...
Binding bind = new Binding("Value");
bind.Source = FontSlider;
The for every control that I want to apply the FontSlider's 'Value' to.. I do this...
MyTextBlock.SetBinding(TextBlock.FontSizeProperty,bind);
Simples.
Cheers
Rich.
I have a form which has a Combo Box Control. I have selected the drop down style property to DropDown. I have also set the DropDown Width to 250.
I have set the auto complete mode to suggest and the auto complete source to listitems.
it works absolutely fine when i click on the drop down. but when i type in somethin, the auto complete mode activates a drop down which has a small width.
any help appreciate.
i wanna know how to increase the width of the auto complete drop down via code so that the list items are viewed properly.
I am using C#
Yes, this is by design. ComboBox uses the SHAutoComplete API function to implement the autocomplete feature. Note the declaration, the function takes a handle to the text box portion of the ComboBox. As such, it has no idea that it is actually providing autocomplete info for a ComboBox instead of a TextBox. Accordingly, there is nothing it can do to compensate for the non-standard dropdown width you use.
Well, that explains why it doesn't work. Fixing it is technically possible but quite ugly. You would have to run code in the KeyUp event and use EnumTheadWindows() to find the autocomplete window handle. Then you can use SetWindowPos() to make it larger. There is already code similar to this in ComboBox.cs (AutoCompleteDropDownFinder.FindDropDowns), use the Reference Source or Reflector to help you get this right. Good luck!
EDIT:
I removed my first suggestion to come up with a new link:
Actually its possible to control the width of the Autocomplete dropdown box, but its a little bit tricky and involves using win API extensively ...
Combobox too small when doing Suggest
Maybe this article that I wrote on Codeproject might help you in relation to the combo-dropdown boxes and a way that I hacked this...
Visual Studio QuickWatch window has a hierarchical property grid control. Is a control like that available somewhere?
The default property grid control doesn't seem to work for me as it requires the objects to have an ExpandableConverter attribute to work the way I want. Although, if any of you know a way to turn the property grid into a QuickWatch-like control it would also be accepted.
Thanks.
It is very spread type of control. Each Library-of-Controls company created at least one.
http://images.google.com.ua/images?q=tree%20like%20grid
Here you have two samples:
http://www.codeproject.com/KB/grid/PropertyGridExWinForms.aspx
http://www.howtocode.net/software-development/c/propertygrid-utilities
I don't think so, its something you would have to create your self.
looks like it wouldn't be to difficult, I think its DataGridView where the first column is a custom cell that when clicked does a hit test to see if its hit a node glyph.
But i could be wrong.