The NotificationsExtensions::TileContent in windows 8.1 doesn't work in windows 10.
Therefore, I am using TileUpdateManager for live tiles, but live tiles doesn't work.
I am using struct like below for TileUpdateManager :
<tile>
<visual version='3'>
<binding template='TileSquare310x310Image' branding='name'>
<image id='1' src='ms-appx:///Assets/Tiles/310x310.png' alt='' />
</binding>
</visual>
</tile>
Is it the right way to use TileUpdateManager for live tiles?
What can I use to update live tiles like NotificationsExtensions::TileContent in windows 8.1?
Yes TileUpdateManager is the way to do it in Windows 10. Below is a small snippet in C#
var updater = TileUpdateManager.CreateTileUpdaterForApplication();
updater.EnableNotificationQueue(true);
XmlDocument document = new XmlDocument();
document.LoadXml(content); 'content is your xml'
TileNotification notification = new TileNotification(document);
updater.Update(notification);
Related
I am working on very simple demo of NavigationView in WinUI3 using C++.
It is very unfortunate that there is no material or tutorial available for this.
<Window
x:Class="App1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<NavigationView x:Name="NavView"
IsTitleBarAutoPaddingEnabled="False"
IsTabStop="False" IsBackButtonVisible="Collapsed" PaneDisplayMode="Left">
<NavigationView.MenuItems>
<NavigationViewItem Icon="Page2" Content="Tab1" Tag="Tab1" IsSelected="True"/>
<NavigationViewItem Icon="Page2" Content="Tab2" Tag="Tab2"/>
</NavigationView.MenuItems>
<ScrollViewer>
<Frame x:Name="ContentFrame" Padding="12,0,12,24" IsTabStop="True"/>
</ScrollViewer>
</NavigationView>
</Window>
How to navigate to a Page on NavigationView using C++?
ContentFrame().Navigate(**WHAT CODE GOES HERE**);
I already know how to do it using C#. and I am not using UWP with c++/winrt.
I need solution for WinUI3 using c++
Check out the C++/WinRT sample code in the docs for NavigationView on MSDN (you can search for void MainPage::NavView_Navigate inside the page to quickly find it).
Here is a summary:
Windows::UI::Xaml::Interop::TypeName pageTypeName =
winrt::xaml_typename<NavigationViewCppWinRT::SettingsPage>();
ContentFrame().Navigate(pageTypeName, nullptr, transitionInfo);
// transitionInfo is passed to your event handler
// if you do this without a transition info, simply
// omit the last argument.
I am new to windows programming
I wanted to start the notification system of my program with the documents I saw from Microsoft
It works fine when I use ready-made templates
XmlDocument doc= ToastNotificationManager::GetTemplateContent(ToastTemplateType::ToastText02);
doc.SelectSingleNode(L"//text[1]").InnerText(L"Hellow :D");
doc.SelectSingleNode(L"//text[2]").InnerText(L"Im greate :X:X:X");
ToastNotification notif{doc};
toastNotifier_.Show(notif);
But when I make my own template it doesn't work
std::ifstream tro(address);
std::string str((std::istreambuf_iterator<char>(tro)),
std::istreambuf_iterator<char>());
XmlDocument doc;
doc.LoadXml(winrt::to_hstring(str));
doc.SelectSingleNode(L"//text[1]").InnerText(L"Hellow :D");
doc.SelectSingleNode(L"//text[2]").InnerText(L"Im greate :X:X:X");
ToastNotification notif{doc};
toastNotifier_.Show(notif);
XML file
<toast>
<visual>
<binding template="ToastGeneric">
<text id="1"></text>
<text id="2"></text>
</binding>
</visual>
</toast>
I noticed something, when I change the template attribute name from ToastGeneric to one of the ready template names like ToastText02, the notification is displayed, but the information is not placed in the children.
add activationType to toast solve this issue
<toast activationType="protocol"> // protocol,Background,Foreground
<visual>
<binding template="ToastGeneric">
<text id="1"></text>
<text id="2"></text>
</binding>
</visual>
</toast>
I am following Microsoft's documentation to implement a TreeView in a Universal Windows Platform app in C++. I have successfully been able to create a tree view with one node using the following codes:
XAML:
<TreeView x:Name="treeSolution"></TreeView>
C++:
TreeViewNode ^treeNode = ref new TreeViewNode();
treeNode->Content = "Hello";
treeSolution->RootNodes->Append(treeNode);
Now, I want to set the text to bold. I tried the following:
TextBlock ^textBlock = ref new TextBlock();
textBlock->Text = "Hello";
textBlock->FontWeight = Windows::UI::Text::FontWeights::Bold;
treeNode->Content = textBlock;
treeSolution->RootNodes->Append(treeNode);
The code displays Windows.UI.Xaml.Controls.TextBlock instead of Hello in bold.
The documentation says that In Windows 10, version 1803, you have to retemplate the TreeView control and specify a custom ItemTemplate if your content is not a string. It then gives a complex example using the Music and Picture library.
Could somebody provide a simple example of how to display the text in bold? Thanks.
You have to provide a custom style for the whole control in XAML to be able to set the TreeViewItemDataTemplate:
<DataTemplate x:Key="TreeViewItemDataTemplate">
<Grid Height="44">
<TextBlock
Text="{Binding Content}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Style="{ThemeResource BodyTextBlockStyle}"
FontWeight="Bold" />
</Grid>
</DataTemplate>
<Style TargetType="TreeView">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeView">
<TreeViewList x:Name="ListControl"
ItemTemplate="{StaticResource TreeViewItemDataTemplate}"
ItemContainerStyle="{StaticResource TreeViewItemStyle}"
CanDragItems="True"
AllowDrop="True"
CanReorderItems="True">
<TreeViewList.ItemContainerTransitions>
<TransitionCollection>
<ContentThemeTransition />
<ReorderThemeTransition />
<EntranceThemeTransition IsStaggeringEnabled="False" />
</TransitionCollection>
</TreeViewList.ItemContainerTransitions>
</TreeViewList>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I have the following code to restrict an input field to numbers only:
<p:inputText value="#{myBean.tlf}" maxlength="9">
<pe:keyFilter regEx="/[\d\-\.]/" />
<p:ajax />
</p:inputText>
It is working like I expect in Firefox but not in Chrome or IE/Edge, where it allows someone to write values that are in number keys but aren't numbers like #|~ and so on.
Testable on PrimeFaces Showcase for <p:keyFilter /> also.
What is the reason? Is it possibly a bug in PrimeFaces (Extensions)?
EDIT: I'm using PF 5.3, Chrome 50, Edge 20 and IE 11.
I have a Metro app in C# & XAML. The tile is updated periodically and I've used WebAPI to serve the tile notification XML. So far so good. I was then told that I cannot use WebAPI as the server that I was planning to host it on does not have .NET 4.5. No plans to install it anytime soon either. I had to change the WebAPI to a plain old Web service (.NET 3.5) which does the same thing - return tile notification XML. I've enabled HTTP-GET (I know, security concern) and was able to invoke the webservice like this -
http://server/TileNotifications.asmx/GetTileData?user=user#domain.com
But ever since I made the switch, the tiles are not being updated. I've checked Fiddler and made sure the app is hitting the webservice and the XML is being returned correctly. But the tiles are not updated. If I replace it with the WebAPI, the tiles are updated.
Do I need to do anything special with the web services? like decorating the web method with a custom attribute? Here's my web service code -
[WebMethod]
public XmlDocument GetTileData(string user)
{
// snip
var xml = new XmlDocument();
xml.LoadXml(string.Format(#"<tile>
<visual>
<binding template='TileWideSmallImageAndText02'>
<image id='1' src='http://server/images/{0}_wide.png'/>
<text id='1'>Custom Field : {1}/text>
<text id='2'>Custom Field : {2}</text>
<text id='3'>Custom Field : {3}</text>
</binding>
<binding template='TileSquarePeekImageAndText01'>
<image id='1' src='http://server/images/{0}_square.png'/>
<text id='1'>Custom Field</text>
<text id='2'>{1}</text>
</binding>
</visual>
</tile>", value1, value2, value3, value4));
return xml;
}