What the problem with this << give the button name like this not accepted in xaml
< , > , & , "" and space Thank You
Try this:
<Button Content="<<"/>
To explain this behavior we need to know the following:
Button is one of content controls, which are simply controls that are
constrained to contain a single item. Content controls all derive from
System.Windows.Controls.ContentControl, which has a Content property
of type Object that contains the single item. Because a content
control’s single item can be any arbitrary object, the control can
contain a potentially large tree of objects. There just can be only
one direct child.
If you open an Error list window, you can see many errors there, not just that one in your picture.
For me, it's
White space is missing.
The value "<" is not valid in an attribute.
Expecting an XML tag name.
The token "" HorizontalAlignment="Left" (omitted for brevity) is unexpected.
2x The open angle bracket character '<' is not valid in an attribute. It should be written as &lt;.
Now, you could guess why it's not a valid character, not to mention that a solution is also described there in the last error. The compiler is confused, it thinks that you are nesting in a new UI element.
As for the other question about not allowed characters in a name, it's obvious. They are not allowed to be used in names in C# or VB.NET either. If you try it in XAML, it will produce an error saying what's allowed. It's just a decision made by a team who designed this. There are languages where these characters can be used as identifiers for objects.
There's a more elaborative explanation in the following blog post.
Try « for << and » for >> this are called "ISO Latin-1 code" for more checkout this link:
http://www.utexas.edu/learn/html/spchar.html
I have just written an answer which is
I guess you should use < instead.
but actually I mean
I guess you should use < instead.
The characters < in my answer were escaped to <.
<Button><</Button>
Related
Is there a way to handle null value for a field in XDocReport? or do I need to manipulate it on my own? example:
if (thisVar == null)
context.put("sampleText", "");
else
context.put("sampleText", thisVar);
or is there an option in docx quick parts?
I found this line in the error message of XDocReport. However I could not understand where to apply this, in the template or in the code.
Tip: If the failing expression is known to be legally refer to
something that's sometimes null or missing, either specify a default
value like myOptionalVar!myDefault, or use [#if
myOptionalVar??]when-present[#else]when-missing[/#if]. (These only
cover the last step of the expression; to cover the whole expression,
use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
In docx, append ?if_exists to the field name
«${tx.amount?if_exists}»
you may also append !
«${tx.amount!}»
Please refer to this link for those who uses freemarker. How to check if a variable exists in a FreeMarker template?
I'm creating a custom directive that I want to use to display the value of a field and an optional suffix (expected for units and such). Note that my example is shortened to stay concise.
My template looks something like
<div class="my-value">{{boundValue}}{{boundSuffix}}</div>
For the value, I'm using a two-way binding (=) and for the suffix, I'm using a string binding (&).
It worked great when I bound ° into the suffix to display a temperature, but when I tried to bind in meters (note, there's a leading space - I don't want it pushed up against the number) the leading space seems to get trimmed and my result ends up looking like 123meters.
Using the chrome developer tools, I added a link function and inspected the directive's scope. By the time it reaches the link function, boundSuffix has already been trimmed. It seems like Angular is pulling some shenanigans on my behind the hood. Is there any way for me to avoid this trimming?
It's better to use angular filters to solve your problem. Filters allow to format your output as currency or as UPPERCASE (for example). Try to look here for more info. And here is working example
I've got a button with the following ID
<button id="Emp Btn"....
I'm unable to access it because of the space
I've tried the following and they don't work
element(by.id("Emp Btn"));
element(by.id("Emp%20Btn"));
element(by.id("Emp%Btn"));
element(by.id('Emp Btn'));
its bad idea to use spaces in ID. HTML 5 says, that an id must contain at least one character and must not contain space characters.
But you still can find such element using XPath.
Try to use something like this:
.\\button[contains(#id,'firstPart') and contains(#id,'secondPart')]
Image im=new Image();
string ii="123456789";
im.Name=ii;
It's ok
but
Image im=new Image();
string ii="123.456.789";
im.Name=ii;
It throw exception. Why is it denied to allocate comma "." to control Name property?
The code you wrote is probably not what you want. As MDoobie said, there are restrictions on what the value of Name can be. The Image class is inheriting the Name property from its immediate parent class, "System.Windows.FrameworkElement." Follow MDoobie's "msdn" link to see what the purpose of that Name attribute is. Near the end of the Remarks you will see a link that will lead you to the specific information about Name restrictions.
In WPF, Names have some restrictions (for instance it cannot contains dots).
"The string values used for Name have some restrictions, as imposed by the underlying x:Name Directive defined by the XAML specification. Most notably, a Name must start with a letter or the underscore character (_), and must contain only letters, digits, or underscores. " (from msdn)
I've got a FlowDocument generating a document for a client, and it's getting a line break that they don't like. Is there any way to mark a section of text that it should avoid line breaks? Something like this:
<Paragraph>Here is a paragraph where there should be <span NoLineBreak=True>no line break</span> in a certain part.</Paragraph>
Obviously, a Span doesn't have a NoLineBreak property, but I'm wondering if there's some equivilant functionality available, or if someone can get me started on a way of implementing a SpanWithNoLineBreak class or RunWithNoLineBreak class?
UPDATE
Actually, one issue I'm having is with a percent sign, where there isn't even a space:
<Paragraph>When I print and ½% I want the one-half and '%' symbols to not line break between them.</Paragraph>
The & #x00BD; is the unicode for a ½ symbol. I'm getting a line wrap between the 1/2 and the % even though there's no space between them.
The Unicode character "Word Joiner" (U+2060) is intended for just this purpose. It "does not normally produce any space but prohibits a line break on either side of it" (Wikipedia). You place it between U+00BD and '%' to prevent a line break between them.
Unfortunately, WPF (or perhaps the typical fonts supplied with Windows) don't support it properly, and instead render it as a square box. As an alternative, you could use U+FEFF; the use of this character as a zero-width non-breaking space is now deprecated (it's reserved for use as a byte-order mark), but it worked as a line-break-preventer for me.
Finally, there are some other characters that can also be used for this purpose: U+202F (narrow no-break space) also prevents breaking, but also renders as a very thin space. U+00A0 (no-break space) prevents breaking and displays as a normal space.
Try replacing the spaces with non-breaking spaces.
EDIT: Well there's always the backup plan of just putting in TextBlocks in your FlowDocument with TextWrapping=NoWrap, but I'd try to find a better way...