I'm trying to create a custom datagrid control for my application. But I've encountered a problem for which I have no idea what is the problem. For some reason the changes I try to apply to the column header just wont apply to my control.
If I try changing DataGrid style/template it works just fine, but for DataGrid column header it just wont budge. I've even tried to copy the existing default template and changing just the basics of it and it still won't do anything.
I would really appreciate any thoughts/help.
Thanks
Found solution that fixed problem. In datagrid style i've specified static resource for columnheader style.
Related
I make my own style for datagrid, I had changed every thing but there's a small part of datagrid make me crazy, because I can't change color for this part. I don't know the name of this part, as showing in the image :
How can I change color it?
It's not so clear from your image, but if that part is part of the ScrollBar then you can add a Style without defining an x:Key for it into your DataGrid.Resources section. That way, it can be implicitly applied to the ScrollBar parts. You can start with the default Style and then adjust it for your needs. You can find the default Style in the ScrollBar Styles and Templates page on MSDN. There is quite a lot of it so you'll have to do some experimentation with it.
UPDATE >>>
If you are talking about the Buttons that you can click to select the row, I believe that that part is called the row header. You can add a Style for that using the RowHeaderStyle property. Please see the WPF override DataGrid RowHeader template and manage to select rows still post for help with that.
Alternatively, I believe that you can hide it altogether by setting the DataGrid.RowHeaderWidth property to 0.
I am making a style for gridview in WPF which consists of several parts, currently I am stuck with the column headers part
I made a style for GridViewColumnHeader but now I need a style for its container
is there a part similar to "DataGridColumnHeadersPresenter" which is a wrapper for all of the columns?
Any help where to find the parts of the control? I want to find the name of that part and the default template for it.
Thank you
Another reason why Snoop is very good.
You get Snoop to identify the element your looking for
Guess it's GridViewHeaderRowPresenter what your looking for.
I just learned how to create SampleData and place them into a Datagrid using Blend. I havent found good tutorials on styling Datagrid without using WPFToolkit or Infragistics. I have extracted the template and styles from it, but I'm not sure where to even start hacking into the style.
I would like to create a Datagrid similar to this image http://blogs.infragistics.com/cfs-filesystemfile.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/kiril_5F00_matev/XamDataGridFilteringSlider.jpg
Also, I would want to have it so when someone selects a row an arrow will show up for that row. Are there any good tutorials or codes you can share? A break down of the parts that make up the Datagrid control would surely help me understand better.
Thanks!
I've always loved Jaime Rodriguez's article for most basic DataGrid styling
And if you're looking to overwrite the template entirely, you can find the default template on MSDN
Silverlight 4 has a new ContextMenu control in the latest toolkit.
I can't find any examples anywhere on how to reliably use this ContextMenu on a DataGrid row. Theres a tonne of context menus out there but I want to use the new version from the toolkit.
I'd like to be able to set context menus for rows as well as cells.
The only way I've found is to manually create the menu on right click and show it, but I'd like to do it in XAML.
Note: You need to currently use this workaround to avoid binding problems when using ContextMenu in XAML for a datagrid cell.
The developer of the Toolkit's ContextMenu wrote this article, specifically talking about using it with a DataGrid Delay's Blog
You can use this open source multi-level menu and context menu as alternative:
www.sl4popupmenu.codeplex.com
The demo on the main page shows how to do it in code. But you can also create the menu anywhere in your XAML like any other control and then associate it with the Datagrid using the RightClickElements property. The control will then handle everything else for you.
I did some searching but it wasn't what I was looking for. So, does anyone know a way how to style the validation tooltip in Silverlight(the thing in the green border)?
alt text http://img689.imageshack.us/img689/222/validationtooltip.png
Any help would be greatly appreciated!
Best Regards,
~K
Unfortunately you can't easily provide a style for the validation tooltip without effectively styling the entire Textbox control. Blend makes this fairly easy if you are familiar with using that design tool. However if your a dyed in the wool coder like me then...
Goto this page on MSDN TextBox Styles and Templates
Copy the vsm namespace alias to your UserControl xaml
Copy the TextBox style into UserControls.Resources give it at an x:Key name (say MyTextBoxStyle")
Copy the ValidationToolTipTemplate from the web page to the UserControls.Resources, paste it above the TextBox style. It already has an x:Key name that the TextBox style will be referencing.
Add Style="{StaticResource MyTextBoxStyle}" to your TextBox in the data grid.
Now you play around with the validation elements of the templates to get your desired result.
The validation messages are displayed as a visual state. you can get to these (and edit them) as templates directly from blend.