I tried to make a USS variable as following:
.ds-node__text
{
background-color:#FF0000;
align-content:stretch;
}
and apply it to a label by
Laabel label = new Label()
{
text = Name
};
titleContainer.AddToClassList("ds-node__text");
titleContainer.Insert(0, label);
But the style did not applied to it.
When I change .ds-node__text. to Label, it works fine but applied to "all labels".
I went on Google and see if USS variables are applied differently, I see in the official document that it uses background instead.
But when I try it, the console told me Unknown property 'background' (did you mean 'background-color'?).
If I add > .unity-label after the variable name, it will work but add an extra empty label after the assigned label, which I don't know how to get rid of:
Why!? Where did I do wrong?
Thank you very much for your help.
I had tried:
background from USS Custom Properties
-unity-background-image-tint-color from USS Property Reference
What I'm expecting to resolve:
Successfully apply style with the variable.
Related
I'm creating a Word Document using OpenXML. During the creation of the document, I need to create some custom styles.
Now I've one problem left: I want to put my custom styles inside the Quick Style Gallery, but I wasn't able to do that. The way that I'm following is explained in the following code:
var info = new LatentStyleExceptionInfo
{
Name = styleid,
PrimaryStyle = true,
UnhideWhenUsed = false,
SemiHidden = false,
UiPriority = 1
};
styleDefinitionsPart.Styles.OfType<LatentStyles>().First().Append(info);
Because I've found a link that tells that is the "PrimaryStyle" attribute responsible for put a Style inside the Quick Gallery.
Another thing: opening the styles.xml file, I've noticed that all the other styles has "1" or "0" for the OnOffValue, whereas the custom styles created with that piece of code has "true" or "false".
How can I solve it?
Thanks.
The XML tag that influences appearance of the style in the quick gallery is <w:qFormat/>. The API property that corresponds is Style.QuickStyle. The Interop name is also QuickStyle (boolean).
Btw, I don't think adding a latent style is going to help you. You'll want to add a real, actual, fully-fledged style if you want it to appear in the UI and be operative.
I have a site that is using the aspdotnetstorefront platform, although this should pertain to any C# site. There is a custom control in a dll named Account. This has several elements including text boxes for customers to enter name, phone number etc.
I have checked the source code with DotPeek and verified I am using the correct naming conventions.
I am attempting to use the javascript onChange event to copy the first name, last name and phone number to lower boxes when a check box (account information same as billing) is checked. So that if customers select that the information is the same it will be automatically copied as they move from one box to the next.
The odd thing is, this works with some of the text boxes but not others. To make things simple I have removed the JS that copies the contents and replaced it with a pop up box for testing.
This works, when I change the text I get a "Hello World" pop up box:
ctrlAccount.txtFirstName.Attributes.Add("onchange", "alert('hello,world')");
But this does not:
ctrlAccount.txtPhone.Attributes.Add("onchange", "alert('hello,world')");
The error I get is:
CS1061: 'AspDotNetStorefrontControls.Account' does not contain a definition for 'txtPhone' and no extension method 'txtPhone'
accepting a first argument of type
'AspDotNetStorefrontControls.Account' could be found
So it looks like the compiler cannot recognize the phone text box. When I look at the rendered page code (When the error has been removed of course) the box is there and the ID is correct.
Reading the source code with DotPeek I see:
public Account()
{
this._txtFirstName = new TextBox();
this._txtLastName = new TextBox();
this._txtEmail = new TextBox();
this._txtPassword = new TextBox();
this._txtPasswordConfirm = new TextBox();
this._txtPhone = new TextBox();
}
private void AssignClientReferenceID()
{
this._txtFirstName.ID = "txtFirstName";
this._txtLastName.ID = "txtLastName";
this._txtEmail.ID = "txtEmail";
this._txtPassword.ID = "txtPassword";
this._txtPasswordConfirm.ID = "txtPasswordConfirm";
this._txtPhone.ID = "txtPhone";
}
(I've removed a bunch of other fields in the interest of readability). But that certainly looks to me like text box for the phone number should have the idea of "txtPhone" and "txtFirstName" and "txtLastName" work just fine, so why would this fail on only the Phone box?
The code you've added to the question show only assignment of IDs and nothing else. I can't see the entire source code of Account control but usually fields with leading underscore are protected or private and, to expose these fields, public properties are used so please check if it's present a public property named txtPhone.
EDIT
ctrlAccount.txtFirstName.Attributes.Add("onchange", "alert('hello,world')");
ctrlAccount.txtPhone.Attributes.Add("onchange", "alert('hello,world')");
Try to press F12 with the caret over txtFirstName or txtPhone on the lines above to see where these property are defined.
P.S.:
Do not confuse the names of id and public properties of a class
It's VS bug, simple restart should help you.
Right-click the txtFirstName part and choose "Go to definition". Ensure that the txtPhone property is defined nearby and is accessible.
If you open your project on visual studio, you can right click on txtPhone or txtFirstName and click on "Go to definition". It will take you to the place where it is defined. Maybe txtFirstName is being read from somewhere else where txtPhone does't exist.
I get these kind of warning(not an error) on my application sometimes in compiler however on run time, it recognise the definition and no problem is caused.
Starting with this BHO article in C#. Tried setting the styles but it doesn't set (I don't see any change in the HTML or noticeable changes).
Tried in the OnBeforeNavigate and in the OnDocumentComplete. Is there another place I should be making these type of changes?
foreach (IHTMLElementtempElement tempElement in document.getElementsByTagName("INPUT"))
{
IHTMLInputElementinput input=(IHTMLInputElement) tempElement;
if(input.type.ToLower().Contains("password"))
{
System.Windows.Forms.MessageBox.Show("OnBeforeNavigate:"+input.value);
tempElement.setAttribute("style", "(some styles here);",0);
}
}
The IHTMLElement interface has a style property, which gives you an IHTMLStyle interface, which in turn has many properties, like color or font.
I am making a pascal code editor in Mono in MonoDevelop. I am using Mono.TextEditor as a code editor widget. However, I cannot find how to highlight a line in the widget.
After compilation, I collect line numbers where errors occur, and so I want to highlight them in red. I found
Mono.TextEditor.LineBackgroundMarker
which seems to relate to what I want to do, but I cannot find where and how to use it.
Another option I was looking into was ViBuilder, but I don't even know how to use that. I can think of two ways to solve this problem:
Simply make highlight
Mark a line as error, as default style includes:
{ "name": "Underline(Error)", "color":"invalid-red" }
which also seems to be a possible solution.
You can highlight lines in the text editor by adding markers to the underlying document. Use the TextDocument.AddMarker method, as follows:
TextEditor textEditor;
var marker = new Mono.TextEditor.LineBackgroundMarker();
int lineNumber = ...;
textEditor.Document.AddMarker(lineNumber, marker);
textEditor.QueueDraw();
Also have a look at the Mono.TextEditor.StyleTextMarker class. This class has already the properties "BackgroundColor" / "Color" that you are looking for. Underlining may have to be done manually (for example by inheriting from StyleTextMarker and overriding the Draw method).
Hi I want to set the Xaml property of my silverlight richtext box.
this.Dispatcher.BeginInvoke(() =>
{
richTextBox1.Xaml = "<Paragraph>Blah</Paragraph>";
});
However I get the following exception..
System.ArgumentException: value
at System.Windows.Controls.RichTextBox.set_Xaml(String value)
Can anybody explain this ?
Maybe I am not in the
You actually want to add an XML namespace to the string, so that the Paragraph object can be resolved. Like:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
As you really only want a single xmlns entry, surround it with a Section block. Your complete working string will be this:
richTextBox1.Xaml = "<Section xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"><Paragraph>Blah</Paragraph></Section>";
To work this out, I entered text into a RichTextBox (e.g. "Blah") and then viewed the textbox1.Xaml property (always investigate using working methods first to see what comes out of it).