Timepicker control? - windows-phone-7

Is there an easy way to make a number picker for windows phone 7 that looks like a timepicker control? I want go have custom ranges of 0-99 : 0-59 . 0-9 while keeping the native windows phone look. Google, bing, and msdn seem to be very vague with information on the subject.
I found an article that describes exactly what I want to do here. My problem is that the article is old and if I type toolkit: in my XAML code, no suggestion comes up for a loopingselector. If I go into my toolbox, right click, choose items. There are no controls for a loopingselector or infinite list selector.
The source code also doesn't work.
I am kind of at a loss on what to do here.
I am using Visual Studio 2010 / c#4.0.

The easiest way is to add a reference to the recent August WP7 Silverlight Toolkit release to your project using NuGet and then add the following namespace reference to the top of your xaml
<phone:PhoneApplicationPage
...
xmlns:toolkitPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit"
/>
You should then be able to use code like this:
<toolkitPrimitives:LoopingSelector ... />

Make sure that you are using the right namespace. LoopingSelector is in Microsoft.Phone.Controls.Primitives namespace. So your xmlns should be something like:
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit"

Related

How can I programmatically add xaml elements in Visual Studio 2017?

I have a C++/winrt project with a complex and dynamic xaml interface created in C++ code. Now I am moving to the latest VS 15.9.0 Preview 3, which has platform support for C++/Winrt and also allows use of the xaml designer in such a project. But I don't want to use the designer and have turned it off in Tools/Options/Xaml. The result is that none of my programmatic xaml elements appears. The project seems to expect me to enter these elements in a xaml code page, rather than using C++, e.g. Grid(), StackPanel(), view.RowDefinitions.Append(), view.SetRow() etc. The GeneratedFiles folder is now full of items that were not present in the previous project, yet can't be removed. Is it still possible to use the C++ interface for xaml, and what must be done to enable it if so? Thanks.
Ryan is correct: C++/winrt does support programmatic creation of xaml, and it works great. With the help of a couple of c++/winrt guys at MS I think I also know why my code was not doing anything. In the former version of my app I had declared MainPage as a C++ class, not a struct, and had assigned the starting Grid for the xaml by getting the current Window and setting currentWindow.Content(theGrid). But in the new template app MainPage is a struct, which might matter, and while setting window.Content that way no longer works, this does: this->Content(theGrid). Leaving aside some irrelevant issues about declarations in the BlankApp, this I think is the answer. Programmatic xaml works if you set that initial content as above.
Unfortunately, this is not the intended way to use this UI system. XAML-based UI systems are descendants of WPF, which relies on the Model-View-ViewModel (MVVM) pattern.
This pattern intends three types of classes to make up your application: Views, which are primarily written in XAML, and only deal with displaying data they are given; ViewModels, which are the wrapper and translator to give the views data, and to give the models commands; and lastly, Models, which are your backend business-logic classes.
Your instinct to not trust the designer is reasonable - it generates messy and unidiomatic XAML code. But it is an excellent way to preview the way your XAML code looks.
To get back to your specific situation, there are real problems in the library's API that will be serious roadblocks to programmatically define a UI in C++. Instead, you will want to use XAML to declare the UI. Adding and removing grid column definitions is not something that is well-supported, but using StackPanels and DockPanels is the normal way to do this.
If you have more specific questions, feel free to open a new question here, but do bear in mind that you may want to search first under the tags mvvm and wpf in addition to xaml, c++-winrt, and winrt.
If you have more questions that are rather broad and may be too broad for the main site here, feel free to join the WPF channel on chat, but bear in mind that most of us don't have experience in WinRT specifically.

Xamarin Forms Dropdown Menu

I am new to Xamarin and I was wondering if it is possible in Xamarin Forms to create a menu similar to this:
.
It looks like you are trying to do a SlideOver menu which I would suggest using SlideOverKit
They support some nice menu options which you can adapt with and is easily implementable by using their nuget package.
Yes. It is possible. I recommend you have a look at Custom renderers. They enable you to do whatever the executing platform is capable of. Note that depending on what you need there may be plenty of platform knowledge that is needed.
I would suggest using SyncFusion component called DataGrid. SyncFusion has many great components for Xamarin forms. They also have a community license were you can get all components for free if you are qualified.
you can use this list in your custom master detail or menu component.

XAML fragments and the Visual Studio XAML designer

I'm new to XAML and likely not even thinking about this problem in the right way, but...
Basically I want a little XAML fragment that I can inject into various UserControls under some circumstances. The XAML just shows a small tag at the side of the control using a Border and a TextBlock.
It would be easy enough to cut and paste this to each control, but that feels clumsy and will be a pain any time I want to update it. Sure, I could do this at runtime in the control base class, but I would rather use the designer. I could make the tag a UserControl in its own right, but that sounds needlessly heavyweight too.
So is there some way of making little XAML fragments in the designer that I'm missing? I'm thinking there it would just have (in this case) the Border at the root of the XAML document.
This is for a Windows 8 store app using VS2013.
Have you tried XAML Code Snippets? Tim Heuer has a nice post with examples here:
http://timheuer.com/blog/archive/2013/07/08/xaml-code-snippets-for-visual-studio.aspx

WP7 / WP8 - Apply text styles

As you know, in Windows Phone SDK there are several styles that you can apply to textblocks.
For reference: MSDN
Since you can't always remember the full name of the style, is there an easy way to apply them? Do I really have to go to that link everytime I need to apply a new style?
IntelliSense is not helpful enough? I usually, write StaticResource text and then the list gets filtered with all the styles containing the "text" string. Kind of depends according to your needs. If you want to apply for font style, write "font" and see the list of suggestions.
Now, I'm not sure if my IntelliSense is as yours or is already enhanced by Resharper. If you haven't heard of it, take a look at it. You gotta hit CTRL+SPACE if the suggestion list isn't there, and it will get filled with possible matches. It's a nice productivity tool that does MUCH more and actually is not free but, I guess you could also get it crac... ahem :)
Other than this, I guess a quick bookmark to that web address, does that job pretty well. :)
The easiest way is to ensure you have the visual designer open while creating the view. You can right click on your TextBlock select Edit Style -> Apply Resource ->. From here you will see a long list of available styles to pick from.
I just found out that what I was looking for will be implemented in Visual Studio 2013!
Here you go: http://blogs.msdn.com/b/visualstudio/archive/2013/08/09/xaml-editor-improvements-in-visual-studio-2013.aspx

Custom controls in Visual Studio Lightswitch

Can someone point me to an article or tutorial on using custom controls in Visual Studio Lightswitch? I'm trying to add a rich text box to a page, linked to a string property. When running the app, sometimes the field will show up, sometimes it won't. If it does show the width of the field is small, about 2 characters, but will expand when text is pasted inside. Saving doesn't work, though.
I'm not even sure about whether or not I'm allowed to use controls like these in a Lightswitch app, even though custom controls are obviously supported. Are the custom controls restricted to a certain type or set?
Thanks in advance for any assistance.
W.
Have a look at the following example, http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/10/LightSwitch-Student-Information-System-Part-3-Custom-Controls.aspx
Also the Training Kit has examples of Custome Controls included.
There is also this tutorial:
Creating A LightSwitch Custom Silverlight Control
http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/2/Creating-A-LightSwitch-Custom-Silverlight-Control.aspx

Resources