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.
Related
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.
Can one one please suggest me which one will be the best, fast and efficient method to fill a ListView in a WPF app.
From ObservableCollection or from DataSet?
Thanks.
I always go for ObservableCollection, I'd never use a DataSet bound directly to a control.
And if you are not changing the items in the collection, you should consider using List.
But with a little more info, maybe there would be good reason to use the dataset, but I don't think so.
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
This feels like a stupid question, but is there a simple control for WPF that just displays a collection of items? I am currently using a ListBox to display a collection of usercontrols, but the selection element is not needed and the highlighting is actually a distraction. I could disable the highlighting, but this seems like extra work if a simpler control exists. I don't need to track the selected item.
Basically, I want a stackpanel that I can just define an itemssource of viewmodels for. Does such a thing exist?
You can use an ItemsControl - it's pretty much exactly what you are looking for
I am trying to work though the best approach to accomplish the following. Within a page I have it divided into two section. On the left a listbox and the right is empty. (Grid etc). What I would like to accomplish is when an item is selected from the listbox a different user control loads in the right panel. For example if I have three items (one, two three) selecting one would load a red user control, two would load a blue user control and three a green user control.
I was taking this approach since Content Template / Data template selectors are not available in SL. However if anyone has another suggestion I would be grateful for your thoughts.
I'm creating this with MVVM in mind and traditionally I have managed this within the code behind of the user control however I have seen mention of how this could be managed within the ViewModel as well.
Any suggestions or guidance on a best approach is always appreciated.
Cheers
You can bind both listbox selected item and user control visibility properties to the same property in the viewModel.
Then just use a valueConverter for each user control to switch on/off the visibility.
Please tell me if i should elaborate/add a code sample.