Having multiple pages with multiple identical elements managed by a single code - visual-studio

in my xamarin application I have multiple pages that contain the same elements (header and horizontal menu), and every time I have to make a change I have to change the code in every single page, there is a way to insert fixed elements in each page ?

In xamarin, use Xamarin.Forms control templates to achieve what you want.
First create a template, design the style you want and set bindable parameters. Then when you use it, you only need to import the class directly, and you can flexibly bind the values you want to use.
For more information, please refer to the official documentation: Xamarin.Forms control templates.

Related

Sitecore page editor dropdown

I would kindly ask for your help :) From couple of days I am trying to achieve "linked" custom field in content editor and dropdown in page editor.
Basically I want to have dropdown in page editor and content editor which are responsible for a same thing.
In my c# code i have enums which represent directions. I created custom field which accepts assembly and class with overridden onload method and successfully populate dropdown values in the content editor. So far so good but i have no idea how to create dropdown which will represent the same functionality inside page editor.
So please give me any ideas...
Judging from your reply to my comment you need to think of the following: How is my field value being rendered onto a page?
If you are always using 1 control to do this then you just need to ensure that this control has 2 different rendering modes depending on the Context.PageMode
But as I understand it you want this dropdown to also appear when someone renders your custom field using a <sc:FieldRenderer>. In this case you'll need to look into the RenderField pipeline of Sitecore. There you find a processor called RenderWebEditing. Possibly through some manipulation here you can get your dropdown appear as you wish.

Load a XAML Layout dynamically based on User interaction

Good day, I am quite new to windows phone and so please bear with me. I have a requirement to load a XAML layout based on what the user chooses. For example, if i have 4 XAML layouts A, B, C, D, when the user chooses C, the respective XAML layout should be loaded and if A is choosen later, that should come up. I can create different XAML layouts and use the OnNavigateTo Method, but i think its not very efficient. Is there a way, i can group the XAML Layouts together so that it can switch between them easily?.. I have heard of using templates, but can't really find any concrete example of how it works. Any help or links will be greatly appreciated. Thank you.
From my understanding you do not need to use templates. Since there are four different actions that have four different views associated with them, there shouldn't really be a problem with having a separate page for each action.
The problem might also be this - how different are the layouts? If data is the only thing that changes across them, you might think about having a view model to bind to and simply change the bindable source.
Bottom line: just use pages, or a single page bound to dynamic data, depending on your scenario.
In my knowledge , I ask you to prefer the UserControls implementation in your UI. You can have A,B,C and D layouts as a separate UserControls and can have those UserControls in the same page. Just make the visibility changes based on the condition that recognize it in the code behind. I think it may help you.
You can solve this in many different ways. If you are not supposed to load the layout on the same page, create 4 separate pages for each view and navigate to correct page.
If you are required to update the current view, you can choose one of the following:
- Place all four layouts into each own Grid and set Visibility="Collapsed" for each one. Then, when you need to show a layout, simply change its Visibility to True.
- Same as above, but use Visual States to add some animations.
- Create 4 user controls and dynamically create the one you need and add it to the current page.
You need to account for several factors here:
- Clean code and clean design.
- Animations and transitions.
- What about Back key? If user is supposed to navigate back to selection screen once he is done, consider navigating to separate pages.
Don't forget the last point, it may be crucial when choosing the right solution.

Bind various panaroma/pivot items using MVVM

could someone help me with design/understanding the problem: what I need to achieve is page with Panorama/Pivot control, where its items (panos/pivots) will be set via binding, using standard MVVM pattern. Problem is I need to have different content (different user controls) on each pano/pivot, that means If I define a panorama/pivot item template, I doom all of them to be alike, which is not what I want.
I found this question here already asked: Databound windows phone panorama with MVVM design but its still not clear to me. Many thanks.
If you have a dynamic page count on panorama/pivot you could use selector to choose what template is right according to your content.
Implementing DataTemplateSelector
Also, Data Binding Pivot to MVVM may help you too
You could add a dependency property to the user control that you want to use as a data template, a dependency property named "Type" for example and depending on that property you can change the layout of your user control (data template) - for example you could have multiple grids inside your user control and you could show and hide them depending on the type.

how we use pageindiactor in pivot

i want to use page indicator control in pivot ,to show the user which page they attract.but i also want to add some functionality in page indicator to select the page with the help of page indicator like android .but i don't know how it is possible.if u know then send me a link or example
You could create the ui yourself and update the current page indicator by using the selectedIndex property. There are controls created by other developers, like here, which you could use. But for complete control over the functionality, I'd suggest you create your own or use the source code provided by other developers (see above link) to get ideas.
To make the implementation clearer:
You can add the same UIElement containing a list of dots equal to the number of pivots, and using the SelectedIndex property you can fill the corresponding dot. Add gesture events to this element and handle it to change the SelectedIndex appropriately.

Data binding controls in asp.net

I have to display a set of data in the following manner:
Which ASP.NET 3.5 control best matches my requirement?
If one matches, could you please give me an idea about how to format it to view like the image?
Well, first off you have multiple blocks (multiple rows) so I would suggest a Repeater. Within each block you must display three columns (the image the text and the small images), and you should use a Panel (renders as a ). In the second panel you have multiple lines of text for which you can use Labels because they allow for rendering as a so that you an include a class.
Style everything nicely with CSS and you should be able to remake the above picture.
I think repeater control would be fine for your requirement.

Resources