WPF Listview Gridview styling column header presenter - wpf

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.

Related

Custom DataGrid Control WPF

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.

Datagrid style help XAML

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

Expander in DataGrid (Silverlight)

I have a DataGrid and I need to add an Expander control dynamically to group few rows based on some conditions... Can anyone help me in this... I am completely new to Silverlight :(
Found the answer, I have created a separate column for the expander and managed to display it when my condition is satisfied. It is not dynamic though, but solved the purpose. :)
Dynamically--not sure what you want. I've done expanders statically. My two cents: keep it simple and don't try and do too much. If by dynamically you are taking about Master/Details data gridview, that can be done by XAML and loading the gridview with an ObservableCollection class (search the net). Also search for PagedCollectionView and .Visibility properties for controls. If you want to add controls to a StackPanel, dynamically, search the net for .Children.Remove methods.
Good luck, but as a beginner you are probably trying to do too much IMO.

Dynamically Styling TreeViewItem? (Silverlight)

Hey all, I've noticed that if I have a style setup for a treeview, and a different one setup for the treeviewitem, it gets overridden once I put the item in the tree. Does anyone have suggestions for how to control the style of each treeviewitem individually while mantaining a default style that is applied to the whole treeview? Basically I want to make the text of my treeviewitem red depending on a data field in the item. Otherwise I want it to be black. Thanks
DataTemplateSelector is not in Silverlight. Try below link
http://blog.timmykokke.com/archive/2009/09/28/datatemplateselector-in-silverlight.aspx
Thanks, turns out it was TreeViewItem.Style CAN be set to an ItemContainerStyle if you use the objects as references.

Encapsulating and customizing a third party WPF control

I'm interested in customizing a 3rd party control, such as Telerik's RadGridView, as a standalone control, for example adding New Row and Delete Row buttons above the grid, yet still supporting XAML manipulation of the internals of the control by the window upon which my control exists (i.e. for the window to add its own style to a column of the grid).
Is there a way to add the buttons, etc. with templates? Styles?
My current "solution" is to inherit from the RadGridView, but I'm stuck on how to add the features I need.
Thanks!
My suggestion is to use composition over inheritance.
You can create your own control (UserControl should do the work). Then you can define the layout (may be in Grid panel): buttons on the top, RadGridView bellow them, etc. For custom column styling you can use DynamicResource trick. Set the styles of the columns you want to modified with DynamicResource. This way when the control is added to the logical(visual) tree; WPF will walk up the control tree and find appropriate resource. This way in each window/page resources you can define the different resource.
Another idea that come to my mind is that you can extract the buttons as a separate control. The only reference that they will need will be RadGridView and you can use binding with element name to provide it.
I would go the custom UserControl route instead of inheritance route. Styling and theming work strangely when you're dealing w/sub-classes. Unless you're planning on duplicating and modifying Telerik's ControlTemplates and DataTemplates, it can get pretty hairy.

Resources