Using a DatePicker without TextBox (Silverlight Toolkit) WP7 - c#

I am developing an app for Windows Phone 7.8 (probably WP8 at a later date) that needs the user to enter a date. I am currently using the DatePicker control from the Silverlight Toolkit as I like the visual style of it.
The DatePicker control, when placed on the page, is shown as a TextBox that when clicked opens the DatePicker.
Is there anyway to not have the TextBox included as I do not need and it is cluttering up my form. Maybe a way to open the DatePicker through code rather than trough the OnClick event?
Any help is appreciated :)

You can simply edit the Control Template of the DatePicker to change the way it looks.
VS 2012 can do this by default (right click and edit template), else you will need to edit the template using Expression Blend.
In particular, the Control Template consists of a Button (among other things):
<Button x:Name="DateTimeButton"
Content="{TemplateBinding ValueString}"
...
The Buttons Content property is bound to ValueString. If you remove this Binding (for example) you will be left with a blank button. You could put anything you like in the content of the button...
These links should help you get started with using Blend:
Styling a control that supports templates
Create or modify a template
The guides on Project Rosetta are nice too.

may be, you can create the DatePicker and hiden it.
when you click item (item which you want to use), you change focus to DatePicker.

I think that you can instantiate the DatePickerPage object and navigate to it. As I understand it has a Value property (coming from the IDateTimePickerPage interface) which you can set and read.
I cannot test it at today but I will definitely try it tomorrow and let you know what I found. Meantime you can go to the http://silverlight.codeplex.com/ page and check the source of the Toolkit.

What is the event that should trigger the opening of the datepicker page? Is it a click or tap on a button, an image or what?
If it is any of these, you could place a DatePicker in xaml over that control so that they overlap (placing them in a grid's same row, same column). Set the Opacity of the DatePicker to 0. Then the user will not see the DatePicker's TextBox, just the control below it. However, when the user clicks on that control (button, image, etc), he or she will in fact click on the invisible DatePicker and then the datepicker page will open up.

Related

How to create an user control containing collapsed text that is expandable on button click?

Is it possible to create a WPF user control like this - a text region which is shown couple of lines initially and when user clicks a button it will open up the rest of the text ?
I have checked the expander class but dint find any properties with this behavior.
The nearest example I can think of of such a behavior is the ToggleButton.
You can modify its default Template to show whatever you want.
The default Template: http://msdn.microsoft.com/fr-fr/library/cc296245%28v=vs.95%29.aspx

Visual Studios C# switching between grid controls

I have begun windows programming and have just completed a functional calculator. I would like to take this calculator further by adding a "Fnc" or "function" button to the user controls which would allow you to view a new set of buttons, but still see the text box with the current entries. I am not sure of how I would complete this using Visual Studios Desktop Edition with Xaml and C#. Could I please get some help?
One possible way is by adding another <Grid> -or any other container control you see it suitable: StackPanel, WrapPanel, DockPanel, you name it- containing additional buttons. Then you can simply switch the <Grid>'s Visibility between Visible and Collapsed upon "function" button clicked.

GridView selection color in WinRT Metro

How do I set / change the item selection color in XAML for a WinRT GridView control? I've tried looking around, is there also a procedure for doing it visually on Blend for VS11?
I've looked at GridView.ItemContainerStyle tag and I couldn't find much help online.
There was an earlier question that was asked about disabling tap visualization in a GridView that might help you.
Extracting the style of a GridViewItem is not available on the GridView itself, so if you want to do it yourself - you need to put a GridViewItem control separately in some page/user control and use the designer tool to edit the template. Or you can just use mine from that other question. I think what you would need to change is the use of the ListViewItemHighlightBrush in that template.

c# change combobox button size and image

I have a combobox in my winform, and I wish change the button that show the list (with the triangle) with another button or at least change the image..
it's possible? how can I do this?
thanks!
you should use OwnerDrawn techniques like the one described here: https://stackoverflow.com/questions/2891981/net-ownerdraw-combobox-vista-7-themed-dropdownlist
or you override the window proc and redefine whole control message handling or you create your own control from scratch or you use third party controls like DevExpress WinForms suite or Telerik ones.

C# How to get the date mouseover with a DateTimePicker?

I want to add a tooltip to the DateTimePicker Calendar that show some informations based on the date that the mouse is over. Is there a way to retrive the date under the mouse without clicking it?
The native Windows DTP control is quite primitive. It doesn't support anything like HitTest() as supported by ListView and TreeView. Trying to guess where the mouse is located from the mouse position is dangerous, DTP is sensitive to format overrides in the Control Panel's Region settings. Don't try to make this work.
Are you talking about the Calendar control (AFAIK there is no DateTimePicker built into WPF as it stands).
See the section Replacing the CalendarItem Template in the article below: you can add your ToolTip there, right in the control.
http://msdn.microsoft.com/en-us/magazine/dd882520.aspx
It shows a calendar with phases of the moon, modified to look like a planner: very customisable!
Edit: Obviously I should say, there is source code included.
Hope that helps!

Categories