I'm trying to change the app title dynamically in a Win 10 UWP app using the code below. The colors change but the title won't change. Any suggestions?
public AppShell()
{
this.InitializeComponent();
var appTitle = ApplicationView.GetForCurrentView().Title;
appTitle = house.Name;
var appTitleBar = ApplicationView.GetForCurrentView().TitleBar;
appTitleBar.BackgroundColor = Colors.LightBlue;
appTitleBar.ButtonBackgroundColor = Colors.LightBlue;
appTitleBar.ButtonForegroundColor = Colors.Black;
...
}
Current accepted answer modifies the View title, not the App title. That appears to be good enough for the OP but if you want to actually change the App Title for a UWP app, here's what you do.
Open your package manifest and navigate to the "Application" tab. You'll see the app's display name like so,
Then just change the "Display name:" field to whatever you want your custom app title to be, then re-build and you're good to go, like below,
Try this:
var appView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
appView.Title = "Your title...";
Related
I display label on screen, but string of label is too long, it hidden a part of my screen. I want custom or replace label to layout as same as Local Notifications (https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/notifications/local-notifications#expanded-layouts)
How to collapse long string to short string with " ..." ?
I am using Xamarin Forms version 3.4.
Please help me! Thanks!
You can use the LineBreakMode Property of Label like.
var lblDetail = new Label
{
LineBreakMode = LineBreakMode.TailTruncation,
Text = "a really long string that should show 2 lines then ..."
};
Question: How can I make a list of link buttons so that when a user clicks on a link it opens it up in windows explorer.
So I have a rich text box that contains a list of all folder names and I have a list of all the folder paths. I want to be able to click on the folder name and have it linked using the path to the correct folder in windows explorer.
LinkLabel link = new LinkLabel();
link.Text = transfer2;
//link.Text = "something";
link.Name = dirName;
link.LinkClicked += new LinkLabelLinkClickedEventHandler(this.link_LinkClicked);
LinkLabel.Link data = new LinkLabel.Link();
data.LinkData = #"C:\";
link.Links.Add(data);
link.AutoSize = true;
link.Location =
this.Display_Rich_Text_Box.GetPositionFromCharIndex(this.Display_Rich_Text_Box.TextLength);
this.Display_Rich_Text_Box.Controls.Add(link);
this.Display_Rich_Text_Box.AppendText(link.Text + " ");
this.Display_Rich_Text_Box.SelectionStart = this.Display_Rich_Text_Box.TextLength;
I started with this code. I am using a foreach statement to get the folder names and path. I tried to change the name of link so it will appear to the user that they are clicking on folder A, but when you click on folder A it uses the path to open the windows explorer where the folder is from.
Any ideas or help would be greatly appreciated.
Update
I changed the code a little so now it will display, but I cant scroll down. It appears to be only on the surface as I ran something in the rich textbox and it was scrollable while the link stayed on the surface.
I also added a picture so you can see what the problem is. I scrolled a little bit so it would b easy to see.
LinkLabel link = new LinkLabel();
link.Text = dirName;
//link.Text = "something";
link.Name = transfer2;
//link.LinkClicked += new LinkLabelLinkClickedEventHandler(this.link_LinkClicked);
LinkLabel.Link data = new LinkLabel.Link();
data.LinkData = #"C:\";
link.Links.Add(data);
link.AutoSize = true;
link.Location =
this.Display_Rich_Text_Box.GetPositionFromCharIndex(this.Display_Rich_Text_Box.TextLength);
this.Display_Rich_Text_Box.Controls.Add(link);
this.Display_Rich_Text_Box.AppendText(link.Text + "\n");
this.Display_Rich_Text_Box.SelectionStart = this.Display_Rich_Text_Box.TextLength;
Update: I am trying to make essentially a list of hyperlinks so I don't think I can use linklabel as I think it is in a fixed position.
For the first part of your problem, opening Explorer, you can do this on the click event for each item in the list (or the click event of the whole list area, as I describe later):
System.Diagnostics.Process.Start("explorer.exe", "\"" + path + "\"");
(the quote/slash thing is to make sure paths with spaces work)
For the UI bits, I've never even seen LinkLabels before, so I don't know how you got on the road to that, lol! I'm not sure whether you're using WinForms or WPF but in either you'd generally want to use something like a ListBox (or a custom control that behaves/looks precisely how you want, but I'd guess you aren't ready for that). In WPF you could set the ListBox's ItemsSource to your data and DisplayMemberPath to whatever property the text comes from (if it is only strings then just don't set DisplayMemberPath). You'd then set up an event for clicking on the ListBox and respond to that by checking what item is selected and running the code above to open Explorer.
If you want to get your UI working with minimal changes, try replacing the LinkLabels with Buttons (you can style them to look like links if you want, at least in WPF) since those work the same way.
I am working with a Windows Forms application in Visual Studio 2010. I have a resources file, Flags.resx. I have uploaded images to the resource file, and want to show them in an Image control (picFlag). What is funny is THIS is super-easy, because my image files are strongly typed:
picFlag.Image = Flags.AE_Flag
But what I want to do, of course, is not. I want to dynamically provide the name of the image like this pseudo-code:
string strFlag = "AE_Flag";
picFlag.Image = Flags[strFlag]
Any suggestions on the simplest way to do this?
you can use the following
var rm = new System.Resources.ResourceManager("YourProject.Properties.Resources",
typeof(Resources).Assembly);
var image = rm.GetObject("AE_Flag") as System.Drawing.Image;
hope it will help you
When I run my Windows Universal App on my Windows 8.1 phone, the LiveTile has additional text (the name of my app) on it that I'm trying to hide. The text seems to be coming from the Package.appxmanifest
<m3:VisualElements DisplayName="This Text Appears" ...
I found a similar question (Is it possible to create a Windows Phone live tile where no title is displayed?) that suggests leaving the value empty. When I do this, Visual Studio complains that it is invalid and I'm not able to compile. Removing the DisplayName entirely also results in an error.
I can see other applications that do not show any text, so it does seem possible.
Can anyone tell me how to hide the DisplayText from my LiveTile, but still have the name of my app appear correctly on the list of installed apps on the phone?
The template I'm using for the live tile (TileWide310x150Image).
The DisplayName attribute inside the Package.appxmanifest file is required and cannot be left blank. It's also the name that will show in the Phone's list of installed Apps. You want that be the proper name of your app.
The name of the app will appear on the LiveTile and, in that context, it's called 'Branding'.
https://msdn.microsoft.com/en-us/library/windows/apps/br212854.aspx
<binding template = tileTemplateNameV2
fallback? = tileTemplateNameV1
lang? = string
baseUri? = anyURI
branding? = "none" | "logo" | "name"
addImageQuery? = boolean
contentId? = string >
It seems to default to 'name', but by setting it to 'none' the text will no longer be displayed on the live tile.
I was able to remove the Wide Tile Display Name in a Windows Phone 8.1 Runtime C# Application with the following code:
XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150PeekImage04);
XmlNodeList brandAttribute = squareTileXml.GetElementsByTagName("binding");
((XmlElement)brandAttribute[0]).SetAttribute("branding", "none");
squareTileXml is the name of the XML being configured to the Live Tile while TileWide310x150PeekImage04 is the chosen template.
Basically I specified a tile template (documentation) and I changed the property branding, which is inside the binding in the XML tree, according to this documentation, to none, removing the Display Name.
I'm not sure if this is the right way of configuring that, but at least it worked.
I'm trying to create a mobile app in xamarin in c# for ios using the google maps api
When you click a marker, the title appears, but when you click it again the title goes away. Is there any way to keep the title from disappearing on the second click?
I want the double click to change the content of the title, but I can't display the info if the title disappears.
Ive been playing around with different combinations of setting mapview.SelectedMarker = marker when I detect a second click on the same marker, but it won't work and I can't find any answers online.
Any help would be appreciated, thanks.
This seems to be working if anybody is having the same problem.
mapView.TappedMarker = (map, marker) => {
//Change the title
mapView.SelectedMarker = null;
return false;
}