For one of my projects I need to create a custom control that contains sub-items and I need to be able to add these sub-items in XAML code. I mean something like this:
<controls:CustomControl>
<controls:CustomControl.Item>
</controls:CustomControl.Item>
</controls:CustomControl>
I did a search in Google and found some sample codes but all of them were for WPF and not Windows Phone. I found the usage of [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)], but it's not available in Windows Phone 8.1 and Windows 8.1.
What's the best way for creating custom controls that may contain sub-items inside and can be edited in XAML code?
To implement custom TabControl you should create a custom control derived by the Panel class and overide MeasureOverride and ArrangeOverride methods to implement custom layout.
XAML custom panels overview
Related
I am developing an app where I need a panel like the one shown below. The left panel shown in the second image slides in from the left when the user presses the plus icon next to the English dropdown.
What is this element and how can I recreate it?
This is a Windows 8.1 C# XAML app.
you should use Windows.UI.Xaml.Controls.SettingsFlyout control, here is a sample that shows you how to configure the settingflyout https://code.msdn.microsoft.com/windowsapps/App-settings-sample-1f762f49
thats what you are looking for
There is no standard control to do all of that. Use a Grid and define an animation for the fly-in is the easiest option.
UWP (Win10) has a control to do this, called a SplitView control. More information on that an how to use it can be found on MSDN.
Martin
For creating this menu for windows 8.1 need create own control, then create style for him and etc.
Please see this post:
How to create a hamburger menu control for Windows 8.1 and Windows Phone
But if you create WUP app it is very simple ;)
Windows 10 SplitView – Build Your First Hamburger Menu
p.s. if you need create hamburger menu for windows phone 8.1 existing more nu-get packages for him, like this: SlideView : Facebook-like panel for Windows Phone
Good luck.
I need some help in creating a grouped ListView for an Universal Windows App.
I found an example to do that but it was for windows 8 phone, and it was using CollectionViewSource class and bind the ListView ItemsSource to it. But this is not available anymore, at least for Universal Windows App template.
Please Help.
Thanks in advance.
There is no default XAML control for UWP that represents Expandable Listview.
However you can create your own or use custom one. Below you can find two possible solutions:
First one - I have created "Expandable ListView" like on the picture below.
You can find whole source code on my GitHub:
https://github.com/Daniel-Krzyczkowski/Windows10/tree/master/ExpandableListView
Second solution is to use "WinRTXAMLToolkit" which contains TreeView control:
https://github.com/xyzzer/WinRTXamlToolkit
Here you can find the post how to customize the control:
WinRT XAML Toolkit TreeView expanded display
Hope that I helped.
I am looking for a grouped collapsible navigation control for use in one of the Windows 8.1 apps I have searched quite a bit and am not able to find this control.However I do find few existing apps in the store using this control, the mail app being one such example. Is there any collapsible grouped control available ?
Else I figure I should use a custom control with a button and an attached flyout
But the flyout would disappear if the user clicks anywhere else in the screen.
Windows Phone 8 has an Expander control in the form of the Windows Phone Toolkit but the performance is very poor when put into a ListView as you would do if you were trying to mimic the built in email app. The best way I've found to get the behavior you're after is to put all of the group header items into the ListView then use an ItemTemplateSelector to choose the visual appearance of group headers vs their items, then only add the child items (to the main ListView) when the group header is expanded. It sounds complicated but I wrote a blog about it here and there is a source example of it here and here
I would like to use a custom font for a Label in my WinForms project without installing the font. I found this as a solution, however it does not work since the FontStyle I want to use is Thin, which is not included in the System.Drawing.FontStyle enumerator.
Since I read instead that it should be quite easy in WPF to use such a custom font, I thought that a possible solution is to create a custom label (ThinLabel) in WPF and to host it in Winforms. Can you please instruct me on which is the proper way to create a custom label in WPF for this purpose? I read that in WPF controls can be customized in several ways (Styles, Data Templates,..) but I've no idea of which should be taken for this purpose. Please consider I've never used WPF so far.
In Order to implement WPF UserControls in Winforms you need to use and ElementHost
So if you want to create an WPF Label like you said in WPF you create a DLL project with your label inside it and reference it in your winforms project, after building you should be able to see a the UserControl with the label in the toolbox if not use an ElementHost
I am developing a Windows Form Application in Visual Studio 2008 (C#)
And I want to add Style to the items.
I have been investigating a few ideas about it but I have not found an example about how to do it. Is it really possible?
My app looks like:
But I really want to add more style in buttons, textboxs and other items I have:
My boss insists on using Visual Studio 2008.
To do this without purchasing anything else, you could create your own custom button and text box controls, either from scratch or as controls derived from the existing windows forms controls and then overriding OnPaint etc. Take a look at what's been done here:
http://dotnetrix.co.uk/button.htm
You could also investigate third party options.
Or, use WPF if that's a possibility as others have said. I'd push for WPF! If there's an existing WinForms Code base you can always host WPF Elements in WinForms. See:
Walkthrough: Hosting a Windows Presentation Foundation Control in Windows Forms
IF you wana to use Winforms than you have to buy this one for example:
http://devcomponents.com/
You have to bind the new assemblies in your application that is not a lot of work!
But better way do that with WPF
http://wpftutorial.net/DataGrid.html