Issue
I am trying to underline the title for NSButton in Xamarin.MacOS. In the mutable attributed string, I use
attrString.AddAttribute(NSStringAttributeKey.UnderlineStyle, NSNumber.FromInt32((int)NSUnderlineStyle.Single), range);
It doesn't work. Suggestions in Swift is to use
let underlineAttribute = [NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue]
In Xamarin.MacOS, there is no NSUnderlineStyle.Single.RawValue. How do I get the RawValue of NSUnderlineStyle enum? Thanks.
Solution
I am adding underline like this:
str.AddAttribute(NSStringAttributeKey.UnderlineStyle, new NSNumber((int)NSUnderlineStyle.Single), new NSRange(0, str.Length));
I can confirm this works in both NSTextView and NSButton
Answered By - svn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.