i have to show Text and Graphical status in one(same) column of the XAMDataGrid.
can please someone suggest me template for this.
There are two ways you can accomplish this. The first is to use a Style targeting the CellValuePresenter where you change the Template. If you are not editing the values, this is the recommended approach and there is an example in the Embedding a Custom Control in a Field help topic.
The second way to do this is to create a custom ValueEditor which is better if you need to allow editing. You may be able to use the ControlHostEditor that Andrew Smith provides in the sample in his Hosting WPF Controls in a XamDataGrid Cell blog post.
Related
I want to have different columns based on the datatype that is set on the DataGrid.
Example: if I supply ItemsSource of "core.Customer" or "core.ServiceLocation" I want different columns based on that datatype. How do? I constantly find conflicting information. I need guidance for this.
Edit: By the way I was hoping to define the columns via XAML, and load the "template" programmatically or define a "DataType" so it'd immediately know what column template to use.
Also, I have nested properties in my classes that i'd like to display.
Example: Customer class has "BillingName" property. I don't want to display "BillingName" I want to display "BillingName.First" and "BillingName.Last" instead. How to achieve this desired functionality?
After several hours of searching stackoverflow and google I found this which has my exact functionality desired under "Rendering templated columns"
I have a textbox with a search icon next to it inside of a dockpanel that I use in every page of mine. I plan on hooking up the click of the search icon to a command and on each page it brings up the same popup with a listview, whose contents vary from page to page based on the viewmodel binding.
I would like to be able to centralize this text+search control so I can re-use the control and include it in each with a line or 2 of code - the inclusion such as and the line for binding to a different search method (if necessary).
What is the best way to do this? Create a custom or use some kind of template approach?
Please advise and if possible, describe the design and provide an example.
Thanks in advance
I want to implement a custom TextBox that will allow me to edit tags. Hotmail's "To" TextBox is the best example I can think of:
Also Facebook's "To" implements the same concept:
Oh yeah, and StackOverflow does it too to tag a question :)
Does anyone have some experience in building something like that in WPF? What would be the first steps that I should make?
I believe this Tokenizing control does most of what you're looking for:
http://blog.pixelingene.com/2010/10/tokenizing-control-convert-text-to-tokens/
I'd try the following:
implement a TagEditor, which has the functionality to edit a single Tag (based on an AutoComplete TextBox that is swapped with a TextBlock once an existing Tag has been recognized or editing is ended)
create an DataTemplate that uses the TagEditor
create an ItemsControl that utilizes the DataTemplate
that breaks it down to three challenges, of which only the first is a bit tricky, but solveable with the given keywords and stackoverflow ;-)
I understand and have read about using WPF's FlowDocument to create an XML style document on screen, but is the content presented editable by the user, or is it read only? And, if so, how is this done?
My question mostly centres around the use of the listitem control because it would be nice to be able to edit the order of the list items presented for use in my program, rather than me having to create my own custom control(s).
Regards.
FlowDocuments as objects are editable, if they can be edited in the UI depends on the controls that use them. If you use them in a Page they are not, if you use them in a RichTextBox they are.
I would like to have a ListView that would have have items similar to Microsoft Outlook inbox with items arranged by Conversations (see the attached photo). An item can either be a simple textblock containing the topic of the conversation (on the photo this are the blue lines) or it can contain email information specified by the ListView's header. It would be best if the items with conversation topics would be push buttons so that emails inside that conversation could be shown or hidden by pressing this button.
Any ideas how can I achieve this? Do I specify two ListViewItem templates? If yes, how do I tell in the code which template to use for each item?
Any help will be GREATLY appreciated!!
Regards,
Gregor
alt text http://img401.yfrog.com/img401/1719/inboxy.png
You should check out DataTemplateSelector. just google it.
The idea is this.
You will define 2-3 templates in XAML
create a class derived from DataTemplateSelector and based on a field/ typeof object
you will return the appropriate template
The concept used in your screenshot is called Grouping. You can easily use grouping if you have a ListCollectionView as your ItemsSource. You then need to specify several GroupDescriptions for the ListCollectionView's GroupDescriptions property.
To define how these groups look like, you might have a look at this SO post: How do I group items in a WPF ListView. Other blog posts of interest might be: Bea Stollnitz: How can I do custom Grouping?, and Bea Stollnitz: How do I sort groups of data items?
In your scenario you would use the title of your email conversation as the group header, and maybe some additional data.