Add element to Hub header - windows

the hub design is builded in MSN's app, like sport, new, weather.
I want to use that, too.
I study textbook and found that tutorial.
but that only teach add header to hub
<Hub Header="this header"> </Hub>
not include element
in msn app, it has search icon in header.
How to do that?

Hub class has a content presenter in itself and can present HubSection which you can find detailed MSDN page by clicking here
I don't know which MSN app you are mentioning , but if you want to search icon in your Headers you must modify HeaderTemplate to achieve that.

<Hub Header="Text Your Header">
<Hub.HeaderTemplate>
<DataTemplate>
<!-- Put you element here -->
<!-- Below is example -->
<ListBox>
<ListBoxItem>No.1 </ListBoxItem>
<ListBoxItem>No.2 </ListBoxItem>
</ListBox>
</DataTemplate>
</Hub.HeaderTemplate>
</Hub>

Related

how to display TabBar on all shell child pages in single page app

I want to create a single page application using Shell where each page contains a titlebar that looks like [Back] [Title] [Settings].
If I have this sequence of pages [Login] -> [Home] -> [Settings] I want when I navigate between them to see the same titlebar on each.
I have a ControlTemplate setup for the titlebar and I add it to each of the xaml pages like this: =
<Shell.TitleView>
<TemplatedView ControlTemplate="{StaticResource TopBar}" />
</Shell.TitleView>
I have the Login and Home pages registerd as routes in the Shell constructor.
public AppShell()
{
InitializeComponent();
Routing.RegisterRoute(nameof(MainPage), typeof(MainPage));
Routing.RegisterRoute(nameof(SettingsPage), typeof(SettingsPage));
}
In the Shell.xaml I have the login page registered like this: -
<TabBar>
<Tab>
<ShellContent ContentTemplate="{DataTemplate views:LoginPage}" Route="LoginPage" />
</Tab>
</TabBar>
When I run the app the TitleView is displayed on the login page. I then click the button to login and I'm taken to the home page but the TitleView is missing. If navigate to the Settings page by clicking on the TitleView icon it is also missing.
Both settings page and Home page have Shell.TabBarIsVisible="True" set.
I'm navigating like this from Commands
await Shell.Current.GoToAsync($"{nameof(Views.SettingsPage)}");
Can someone tell me if this is possible and if so what I'm doing wrong please?
Thanks
Answer is don't add Shell.PresentationMode="ModalAnimated" by mistake to pages you are navigating to. Doh!

Url format for App Store and Google Play to install app with deep link

Prerequesits:
I've already implemented deep linking and universal linking, everything works great.
Here is what I need:
I'm sharing with you a url that looks like that:
https://play.google.com/store/apps/details?id=com.foo.bar&invite=asdf
You open this link on your Android device, navigate to the Google Play listing. Tapping "Install".
Now, I want the app to do the same thing, like if i would open installed app with this link
myfoobar://?invite=asdf
I also need the same for App Store.
Could you show me how do I format App Store/ Google Play url to achieve this?
I think this should fulfill your needs: https://firebase.google.com/docs/dynamic-links.
It also goes further and honors the initial deep link after the app is installed.
What I did in a previous app is to catch custom URIs, start a specific router activity which will redirect to the right URL depending on the caught URI.
Code is note the most important, you need to understand the idea.
You can't directly setup a magic logic that will allows you to link a custom URI to a custom URL. What you CAN do, is to make your app react to a specific/custom URI (myfoobar://) that will launch a specific and dedicated activity / view controller that will itself redirect to the URL of your choice.
For instance, on Android side:
<activity
android:name="com.example.android.RouterActivity"
android:label="#string/title_gizmos" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://gizmosā€ -->
<data android:scheme="myfoobar"
android:host="whatever" />
</intent-filter>
</activity>
And then, in your RouterActivity, launch your URL.
More information here
On iOS side, same idea, but instead you need to register your custom URI in your info.plist.
More information here and also here.
I hope it helped you. That is how I did in previous apps and it works like a charm.

How to override the event handlers of built-in controls and its visibility in VSTO Outlook addin 2010

I have created a custom group with a toggle button in built-in 'TabAppointment' tab, where clicking on the button will open a new winform.
Only after proceeding with that form, 'Save&Close' button should be enabled in the appointment screen.
But iam not able to disbale the built-in controls, i have tried as like below
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon>
<tabs>
<tab idMso="TabAppointment">
<group idMso ="GroupActions">
<button idMso="SaveAndClose" getEnabled="GetEnabled"/>
</group>
<group id="GroupRBS" insertBeforeMso="GroupActions" label="RBS">
<toggleButton id="btnBookRoom" label ="Add Room" supertip ="Room booking option for an appointment" imageMso="AddRoom" onAction="CallRBS" size="large" getEnabled="GetEnabled" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
I have created 'GetEnabled' callback method in ribbon class, but it is firing only for custom group controls, cant we override builtin control attributes?
Iam able to hide builtin groups, but not able to hide a particular builtin control inside the builtin group, is there any way to do this?
Pls help me for getting ny solution
Unfortunately, you can not change the Enabled state on built-in ribbon buttons. Only on the Custom ribbon buttons you add yourself.
But there are a couple solutions you could try:
Display your WinForm dialog modally to ensure the user has to complete it before they can carry on
Handle the Microsoft.Office.Interop.Outlook.AppointmentItemClass.Write event. The ItemEvents_10_WriteEventHandler has a ref Cancel parameter which you can set to true to stop the Appointment being saved.
((ItemEvents_10_Event)appointmentItem).Write += AppointmentItem_Write;

How do I use relative http urls for Xaml images

I have a need to treat an image in XAML as a special case and have it download the image using the relative HTTP URL and not the relative DLL path. But I cannot seem to get that to work properly. I've tried the pack URL, but it seems to ignore it. None of these appear to work.
<Image Source="pack://siteoforigin:,,,/images/logo.png" />
<Image Source="~/images/logo.png" />
<Image Source="/images/logo.png" />
I would simply like these to work like ordinary HTML img src. I know I can do this in code, but I'm hoping to avoid that if I can.
I finally found a way to get this to work. My xap file is loaded from /ClientBin/, so the resulting URLs for the download are actually this:
/ClientBin/images/logo.png.
Once I realized that was happening, I was able to add URL map to my web.config and an HttpHandler to redirect the image download where I need it to go.

PrettyPhoto.js using blogengine.net 2.0

I'm using BlogEngine.Net 2.0 and installed prettyphoto extension
but I dont know how to use prettyphoto in my post pages.
Thanks
You need to add:
rel="prettyPhoto"
to the anchor element surrounding your picture. Here is simple example from project site:
<img src="images/thumbnails/t_2.jpg" width="60" height="60" alt="This is the title" />

Resources