DatePicker with the ability to choose a span - wpf

Here is a quick visual of the idea that I got from Google Analytics.
ComboBox Collapsed:
ComboBox Collapsed http://www.googlemapscontrol.net/images/CalendarDropDownClosed.jpg
ComboBox Expanded:
ComboBox Expanded http://www.googlemapscontrol.net/images/CalendarDropDownOpen.jpg
I am not concerned with the functionality of the timeline or the date range text boxes. Basically I am looking to have something that looks kind of like a ComboBox with a single calendar control. When the date range is selected and the control is closed then the range is shown in the text box.
I don't think that I can get a ComboBox to behave this way and I think that I need to use something along the lines of a textblock, button and a popup.
Does anyone have a sample I can start with?
If you don't have a sample how would you approach this issue?
Thanks

The WPF Toolkit has a Calendar/DatePicker control that could be a suitable base for you to modify into an elaborate date range picker.
I would start with the DatePicker Generic.xaml file from the WPF Toolkit distribution, and examine what they have done with the DatePicker control template. The interesting section for you will be around the area that PART_TextBox and PART_Button is used. They indeed use a combination of grids, textbox, button, and popup controls.
Hope that helps!

Related

Multiline Combobox Control in WPF

I would like to build a multiline combobox in WPF. This would be similar to label control wherein the width of control will grow such that entire selected text is visible. The text displayed can go over next line if there is no enough space available on current line.
I tried few things around control template of combobox. But still no success.
Below is sample screenshot of how it should look like!
Any pointers?
Thanks,
Sambhaji
As per my understanding setting the control template for this particular scenario would be a tedious job. I would have created a TextBlock and tried setting the event triggers which will open a container on mouse hover or click event.

WPF slider behaving like combobox

I need a control where user can pick only one option. Combobox is fine, radiobuttons are ok, but for some purpose I think about another crazy, but interesting solution.
There should be a slider control on a window and three possible positions of this sliding thing. I know this can be easily accomplished by setting slider's Minimum and Maximum plus TickFrequency and IsSnapToTickEnabled properties.
Now, is there a way how to add labels on left/right edge and center of slider showing user options within the slider? Or is it neccessary place labels/textblock below?
Last, though the most important thing is, how to associate integer slider positions with string options? I thought about switch, but this is wpf - there is "more wpf" solution, isn't it?
Just drag slider's rider to it's position and by binding set class string property to appropriate value.
Every control within WPF can have its visuals completely modified to suit your needs. This was/is the beauty of WPF over WinForms.
Can your slider have a TextBlock within it? Absolutely. Style as you desire and be on your way. A great article can be found via MSDN Magazine which outlines the approach to customizing WPF controls.
With regard to the integer values, use an IVauleConverter to translate the values to whatever you prefer.

Adding filter textbox to header of a Listview in Gridview mode

I watched a demo video of Mole 2010 (a WPF debugger) in which there is a nice datagrid feature where the header contains a filter textbox, so you can type in a string and filter for that column. Here is the video, the feature is demonstrated at 3:00 minutes
http://www.youtube.com/watch?v=bgMg61iM9G8&feature=player_embedded#at=180
I am interested in replicating that feature, but I am not sure how to do it gracefully. My application is a WPF MVVM EF app, it's my first WPF app.
Is it possible to create a template for the header where I can also add a textbox, and a button with a cross so the contents can be cleared?
If so, how could I bind the textbox to filter its column?
Should I be hiding the actual header row and making an artificial one where I add my own header and textbox and button etc. and then bind them to filter clause properties that I add to my CollectionViewSource when a filter string is typed? I hoped to avoid this so I could retain sorting by clicking the header.
I dont really know how to start this. Are there any gurus that could suggest how this could be done? Thanks!
You might have a look at the BookLibrary sample application of the WPF Application Framework (WAF). It shows how to use a TextBox for filtering the data in a DataGrid. It uses MVVM and the Entity Framework as well.
you might want to try that : http://dotnetexplorer.blog.com/2011/04/07/wpf-itemscontrol-generic-staticreal-time-filter-custom-control-presentation/ => it filters any collections and you just have to decalre the control in XAML...

I want to create a combobox in wpf

I want to create a combobox with some style. I dont want old dropdown what we are getting. I want some new dropdown which looks very nice. Is there any way to create a dropdown like that.
Plz give me suggestions
Check this link out on msdn. This is the actual control template for the combo box. You can copy and paste this into your application (within your app's Resources).
Create a form and slap a combo box on it with some data in it. Then start changing the control template and view the results. Start off simply by changing colors and adding borders around elements to see what controls which part. Then you can start switching out larger parts of the template to match what you're looking for.
one can start with the standard combobox, and then use various controls and styles to change the look and feel of the control, and it's corresponding drop down.

My Calendar control is cut

I've got an own control with a calendar popup and other functionality.
I've placed that Control into a grid in the content of another Page.
My problem now is, that the Calendar Control is cut. So i only see half of the calendar. How can i bring it to the Front? Like the normal DatePicker Control does??
Update:
What I'm trying to build is a something like the DatePickerControl but with more functionality. It doesn't look so bad so far, the control itself works fine, but implemented into a content area it cuts the calendar control. The calendar control should be visible when a textbox has the focus,what I need to find, is a way to put the calendar to the front to create an overlay for the control. If someone has an idea about how to do it I'd appreciate it.
If its a calendar control used in grid of asp.net then specify a fixed size to your calendar control and accordingly set the width of grid column.

Resources