Hi am using the following code, the live tiles works fine but what i found the small logo is always there on there left bottom of the tile, how can i get rid of it? see this
XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImageAndText01);
XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquarePeekImageAndText01);
XmlNodeList textElements = tileXml.GetElementsByTagName("text");
textElements[0].AppendChild(tileXml.CreateTextNode(_serviceOrderItems.Count.ToString()));
XmlNodeList imageElements = tileXml.GetElementsByTagName("image");
XmlElement imageElement = (XmlElement)imageElements[0];
imageElement.SetAttribute("src", "ms-appx:///Assets/Image310X150.jpg");
imageElement.SetAttribute("alt", "Aker Solutions");
XmlNodeList squareImageElements = squareTileXml.GetElementsByTagName("image");
XmlElement squareImageElement = (XmlElement)squareImageElements.Item(0);
squareImageElement.SetAttribute("src", "ms-appx:///Assets/Image150X150.jpg");
squareImageElement.SetAttribute("alt", "Aker Solutions");
IXmlNode subnode = tileXml.ImportNode(squareTileXml.GetElementsByTagName("binding")[0], true);
tileXml.GetElementsByTagName("visual")[0].AppendChild(subnode);
TileNotification tile = new TileNotification(tileXml);
TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);
Set branding="none"
<?xml version="1.0" encoding="UTF-8"?>
<tile>
<visual lang="en-US">
<binding template="TileSquareImage" branding="none">
<image id="1" src="http://abc..../xx.png"/>
</binding>
<binding template="TileWideImageAndText01" branding="none">
<image id="1" src="http://abc.../yy.png"/>
<text id="1">Test message</text>
</binding>
</visual>
</tile>
Edit
Just noticed the comments that you can set the branding attribute on the visual or binding node.
tileXml.getElementsByTagName('visual')[0].setAttribute('branding', 'none');
There is a small logo property on the tile that controls this. However the documentation states:
If this image is not provided, the small logo of this secondary tile's parent app is used.
Since a small logo is also required for your app there is no way to turn it off. A workaround is to set the small logo to a completely transparent 30 by 30 pixel png.
var tile = new Windows.UI.StartScreen.SecondaryTile(newTileID, newTileShortName, newTileDisplayName, TileActivationArguments, newTileOptions, uriLogo);
tile.smallLogo = new Windows.Foundation.Uri("ms-appx:///images/smallLogoBlank.png");
Related
Hello i Have uploaded image using ImageResizer
using this code
var instructions = new ImageResizer.Instructions
{
Width = Convert.ToInt32(Newwidth),
Height = Convert.ToInt32(Newheiht),
Format = "jpg",
Mode = ImageResizer.FitMode.Crop,
Scale = ImageResizer.ScaleMode.Both,
};
File.InputStream.Seek(0, SeekOrigin.Begin);
ImageResizer.ImageJob i = new ImageResizer.ImageJob(File, Filepath, instructions);
i.CreateParentDirectory = false;
i.Build();
i have tried using
AutoRotate = true
i still got the image rotated to horizontall
i also tried Rotate=90
the pic was rotated and lost the proportion here is how it looks like after rotate
the resized roteted picture changed it to width=296 height=437 instead of height=296 width=437
the image was taken vertically using samsung galaxy 3 buy when resized it and upload it it show horizonally
here is the original photo taken:
here is how it shown after uploaded:
You haven't posted the diagnostics page, which lists which plugins are installed.
The most likely cause is that you didn't <add name="AutoRotate" /> or new AutoRotate().Install(Config.Current) to install the AutoRotate plugin, and therefore &autorotate=true had no effect.
It's also possible that there's a new form of image metadata that we can't detect yet, but that seems less likely.
Try Autorotate property "True"; It worked for me.
&autorotate=true
Having some issues adjusting margins properly and having to launch the emulator each time to check it has become a royal pain and inefficient. Ive looked a tutorial that uses blend but I have been unable to see generic data loaded in the longlistselector in Design View. If it helps any, my app loads data into the LongListSelectors from xml files.
Public void LoadData()
{
Test = LoadFromXml("Test.xml");
IsDataLoaded = true;
}
private SoundGroup LoadFromXml(string xmlName)
{
SaveSoundGroup isolatedGroup = new SaveSoundGroup();
SaveSoundGroup assetsGroup;
XmlSerializer serializer = new XmlSerializer(typeof(SaveSoundGroup));
using (Stream fileStream = Application.GetResourceStream(new Uri("Xmls/" + xmlName, UriKind.Relative)).Stream)
{
assetsGroup = (SaveSoundGroup)serializer.Deserialize(fileStream);
}
Here is a sample of the xml. Items is what is tied to the longlistselector:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<SaveSoundGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Items>
<SoundData>
<Title>Test</Title>
<FilePath>https:***</FilePath>
<SavePath>Test.mp3</SavePath>
<Status>NotDownloaded</Status>
<DownloadProgress>0</DownloadProgress>
</SoundData>
I've tried adding this to my xaml, with no luck:
mc:Ignorable="d"
d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True}"
LongListSelector:
<controls:LongListSelector x:Name="LongList6"
Margin="0,10,0,0"
ItemsSource="{Binding Test.Items}"
LayoutMode="Grid"
GridCellSize="400,72"
ItemTemplate="{StaticResource SoundTileDataTemplate}"
SelectionChanged="LongListSelector_SelectionChanged"
IsGroupingEnabled="True" />
</controls:PivotItem>
Edit: All I want is for the Tiles in the longlistselector, with some text(Title), to be viewable in design view. Just two tiles even, would be good enough to be able tweak and edit placement and layout.
I'm using this code to show a toastnotifcation in my application:
var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText02);
var image = toastXml.GetElementsByTagName("image")[0];
var title = toastXml.GetElementsByTagName("text")[0];
var text = toastXml.GetElementsByTagName("text")[1];
image.Attributes[1].AppendChild(toastXml.CreateTextNode("ms-appx:///Assets/Images/logovboardnotif.png"));
title.AppendChild(toastXml.CreateTextNode("Board"));
text.AppendChild(toastXml.CreateTextNode(message));
var toastnotifier = ToastNotificationManager.CreateToastNotifier();
var toastnotification = new ToastNotification(toastXml);
toastnotifier.Show(toastnotification);
My problem is when the toast is shown, there's a small logo (azure color):
How can I hide this logo?
UPDATE 1
According to Programming Windows® 8 Apps with HTML, CSS, and JavaScript by Microsoft Press There are no means to override this; the branding attribute in the XML is ignored for toasts.
You have to set branding attributte to none, default is logo. See here try the below given code.
var xml = #"<toast>
<visual>
<binding template=""ToastImageAndText02"" branding=""none"">
<image id=""1"" src=""{0}""/>
<text id=""1"">{1}</text>
<text id=""2"">{2}</text>
</binding>
</visual>
</toast>";
xml = string.Format(xml, "ms-appx:///Assets/Images/logovboardnotif.png", "Board", message);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
var toastnotification = new ToastNotification(xmlDoc);
ToastNotificationManager.CreateToastNotifier().Show(toastnotification);
I create a custom image in my app (by capturing ink data for example) and then want to show the generated image on Live Tile. How can I do this?
all you need to do is assign the image to the live tile template.
TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImageAndText01);
XmlNodeList tileTextAttributes = tileXml.GetElementsByTagName("text");
tileTextAttributes[0].InnerText = "Hello World! My very own tile notification";
XmlNodeList tileImageAttributes = tileXml.GetElementsByTagName("image");
((XmlElement)tileImageAttributes[0]).SetAttribute("src", "ms-appx:///images/redWide.png");
((XmlElement)tileImageAttributes[0]).SetAttribute("alt", "red graphic");
XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquareText04);
XmlNodeList squareTileTextAttributes = squareTileXml.GetElementsByTagName("text");
squareTileTextAttributes[0].AppendChild(squareTileXml.CreateTextNode("Hello World! My very own tile notification"));
IXmlNode node = tileXml.ImportNode(squareTileXml.GetElementsByTagName("binding").Item(0), true);
tileXml.GetElementsByTagName("visual").Item(0).AppendChild(node);
TileNotification tileNotification = new TileNotification(tileXml);
tileNotification.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(10);
TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
The following blog post by Jeff Blankenburg can be used as a starting point for everything you want to know about Live Tiles:
31 Days of Windows 8
I'm writing a Windows 8 app and am trying to get live tiles working. Here's what I have so far (all in App.xaml.cs):
In OnLaunched():
Window.Current.VisibilityChanged += Current_VisibilityChanged;
The event handler for that:
void Current_VisibilityChanged(object sender, Windows.UI.Core.VisibilityChangedEventArgs e)
{
// create a string with the tile template xml
string tileXmlString = "<tile><visual><binding template=\"TileSquareBlock\">" + App.VM.GetImageLinks() + "</binding></visual></tile>";
// create a DOM
Windows.Data.Xml.Dom.XmlDocument tileDOM = new Windows.Data.Xml.Dom.XmlDocument();
// load the xml string into the DOM, catching any invalid xml characters
tileDOM.LoadXml(tileXmlString);
// create a tile notification
TileNotification tile = new TileNotification(tileDOM);
// send the notification to the app's application tile
TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);
}
App.VM.GetImageLinks() returns:
<tile>
<visual>
<binding template=\"TileSquareBlock\">
<image id=\"1\">Assets/Img1.jpg</image>
<image id=\"2\">Assets/Img2.jpg</image>
<image id=\"3\">Assets/Img3.jpg</image>
</binding>
</visual>
</tile>
At the minute, I'm basically trying to just get these images to show on the start screen. My guess is that VisibilityChanged is the wrong event, because it seems to occur too often.
The XML being used is invalid, as the TileSquareBlock template doesn't contain any images. See the tile template catalog to see the various visual templates and their corresponding XML.
The NotificationsExtensions library (found in the MSDN tiles sample) provides an object model that maps the image and text fields to named properties. It provides more validation and may simplify your code.