I'm using the DatePicker from the Silverlight Toolkit on Mango
I want to programmatically display the date picker full mode display, but I can't see any API hook to do that at the moment.
Is this possible? or do I have to implement this myself by (intelligently) writing a new control?
Build your own I'm afraid.
Be careful about the user expectations around opening it automatically though. ;)
Sadly Matt was right - there's no public or protected API to hack into and security prevents the use of Reflection - so I've +1'd his answer... and a full answer is:
take the files from Silverlight.codeplex.com
either use the whole project or create your own library with just DatePicker.cs, DateTimePickerBase.cs and the DatePicker Style template from Generic.xaml
in your DateTimePickerBase, add:
public event EventHandler<EventArgs> PopupClosedByDateSelection;
in ClosePickerPage() inside PopupClosedByDateSelection inside the if(_dateTimePickerPage.Value.HasValue) block, add:
if (PopupClosedByDateSelection != null)
PopupClosedByDateSelection(this, EventArgs.Empty);
This seems to work for the Back button case as well as for the cancel and OK cases.
Related
I was just wondering if it was possible to have a nativescript prompt dialog select all of the text upon opening without going so far as to create an entire custom dialog. I don't see any settings when creating it, but I was wondering if someone knew of a way to do this?
Thanks in advance.
The native dialog controller or the UI components inside are private to the dialogs module, not exported for public use. Hence you will need a custom one in order to operate on the textfield.
I'm learning the new Wix Code online development IDE and want to understand how to control the visibility of an item on mobile or desktop. How should I approach this?
If you're just trying to hide things from mobile, there's an easier way to do it (go to the mobile editor and click the element's hide button).
But assuming you're asking about WixCode because you need custom behavior:
Check out the formFactor API
https://www.wix.com/code/reference/wix-window.html#formFactor
And the properties panel
https://support.wix.com/en/article/working-with-the-properties-panel-6441151
The properties panel is where you'll set the element's default visibility.
Then check the formFactor using that API above
And finally use $w('#elementname).show() or hide() to change its visibility.
You have two options -
If you only want to control what appears on mobile vs desktop, you have a toggle to hide elements on mobile.
If you want to change dynamically visibility of elements on each or both, use the formFactor and hide/show/collapse/expand APIs.
For instance, on a button click you may want to show element1 on desktop and element 2 on mobile. The code will look something like the following -
import wixWindow from 'wix-window';
export function button1_onClick() {
if (wixWindow.formFactor === 'Mobile') {
$w('#element2').show();
}
else {
$w('#element1').show();
}
}
Is there a proper mvvm way to show CustomMessageBox from the view and get callback from it?
This sample is quite nice, but it uses hardcoded MessageBoxButton (only Yes/No/YesNo are avaivable, but i need custom buttons).
This contains lots ofuseful info about Messages in MvvmLight, but DialogMessage is also showing only YesNo sample (also no custom buttons).
Figured out that Cimbalino toolkit (Cimbalino saves the day again!) has quite nice custom messagebox.
First time I've used the windows form so I'm not very familiar with the interface. But how do I set behaviors when I add buttons? For example, if I want to click "Button 1" and have it open up a new window to enter information in different fields, how is this done?
Thank you.
edit: Sorry, I forgot to include the language. It's in C#, and I'm using MS Visual Studios. I've never really programed in C#.
Another question that just popped up: could I do this Windows Form in other languages such as C++?
Yes the comment above is key but, if your are using the UI designer on a windows form then under the properties tab on the side of visueal studios, you can view 'events'. from here double click the event you want, probably 'onclick'. This will create a method stub with the event handler automatically set up.
Look something like:
public void Button1_OnClick(Object sender, EventArgs e){
// open the other window for input
Form whateverForm = new Form();
whateverForm.show();
}
Hope this helps. Sorry im not sure about any c++
[Edit]
tutorial not great but take a look:
http://www.ehow.com/how_7241167_tutorial-microsoft-visual-studio.html
What is the best way to create a view for a single control that I need to load into a Shell region in a Prism app. I know I can wrap the control in a UserControl, but I suspect there may be a better way.
I am working on a demo app to learn Prism 4. Each module will load a navigation button into an ItemsControl in a region in the Shell. These navigation buttons will function like the Mail, Calendar, and other buttons in Outlook.
I am creating the view in each module that will hold the module's navigation button. The simplest way to create the view seems to be to wrap it in a UserControl. My question is this: Is there a better way to do it? Thanks for your help.
If you need graphical control, what you are doing is the way to go. If you find yourself making all of the buttons look the same (copy - pasting) you might find that a menu registration service is the way to go.
You'd have a service like IMenuService that you register with your container and modules can come around and register menu items to. You can then create buttons for the module. I've provided a sample for this here:
http://dl.getdropbox.com/u/376992/CAGMenus.zip
Your question, though, seems to be about whether or not you need to wrap a control in a UserControl to register them with a region? If that's the question, I believe the answer is no, although you might amend your question to tell us what you are running up against that makes you think this.
I ended up wrapping the control in a UserControl, and it seems to work fine. I am still interested in seeing if there is a better way to load the button, so I will hold this question open for a few days.
Edit 02/22/2011: I tried using a control without a UserControl wrapper, and I got the following error:
Library project file cannot specify ApplicationDefinition element.
I wrapped the control in a UserControl and the error went away.