I have a tooltipservice set to an image, where I want to display a text.
Part of this text we wish to have in bold. Another part in cursive.
The text is obtained from the database and given to the tooltipservice via a binding (localization)
Example: "this is bold and this is cursive but this is normal style"
Is this possible?
I've found online that using the tags < Bold > and < /Bold > should work, but it doesn't seem to for me.
Only thing i can think of is in your tooltip service style, add something like
<TextBlock>
<Span FontWeight="Bold">Hello</Span>
<Span FontStyle="Italic">World</Span>
</TextBlock>
Not sure if this will work
Related
I have a scenario where I have added an aria-label to a parent <div> which contains some text. Ideally the aria-label provided to the parent <div> should be narrated first and then the child Text component. This works completely fine on MacOS Chrome with the VoiceOver screen reader, but on Windows Chrome with NVDA the parent <div> aria-label is not at all read.
Attaching a code snippet for reference:
<div aria-label="Parent div accessibility">
<Text> Some Text </Text>
</div>
Speech output on MacOS Chrome with VoiceOver:
Narrator - Parent div accessibility
Narrator - Some Text
Speech output on Windows Chrome with NVDA:
Narrator - Some Text
Screen readers are all over the map with respect to interpretting aria-label on non-interactive elements.
According to David MacDonald's tests, VoiceOver and TalkBack will read the aria-label text on static elements, but JAWS and NVDA will not unless the static content (like a <div>) has the role="navigation", role="search", role="main", or role="img".
By design, aria-label is meant to override the existing text of an element because it is what most screen readers will interpret as the element's label. So, the behaviour you're getting from VoiceOver is not necessarily standard behaviour. Some screen readers (like TalkBack) will ignore the inner text of your <div> if you use aria-label, because it interprets the aria-label as the label for that element and ignores any other text within the element. Other screen readers like JAWS will read both the aria-label text and the inner text of the <div> if you add a role like role="navigation" to your static element. It seems that NVDA 2018 did support using aria-label on static elements, but it was later removed because there's yet to be consensus on the aria-label debate.
Option 1
The fail-safe option would be to use text that is visibly hidden by CSS. This is fully supported by all browser/screen reader combinations.
Here is the example suggested by WebAIM:
<style>
.sr-only {
position:absolute;
left:-10000px;
top:auto;
width:1px;
height:1px;
overflow:hidden;
}
</style>
<div class="sr-only">This text is hidden.</div>
Option 2
Another option is to use the CSS content property to hide the text that you want spoken by the screen reader, as suggested by slugolicious in a similar question on SO:
<style>
div::before {content: "This text is hidden"; font-size: 0px;}
</style>
I tested his suggestion with JAWS and NVDA and it announced the "This text is hidden" text as well as the inner text of the <div>.
However, as QuentinC pointed out in the comments, the CSS content property isn't currently supported by all browser/screen reader combinations.
For reference:
Clarify use of aria-label on elements with no role #756
Woe-ARIA: The Surprisingly but Ridiculously Complicated World of aria-label/ledby
What happens with aria-labelledby, aria-label and aria-describedby on static HTML elements?
WebAIM: Invisible Content Just for Screen Reader Users
Update
I edited my original answer to include QuentinC's suggestion of using CSS to hide the text.
Hi I'm new to AvalonDock and currently I have to handle on a task on others code which implemented this Xceed.Wpf.AvalonDock. My goal is to make the UI become touch screen friendly and first thing I need to enlarge the "Search Tab Button", I'm not sure the actual name of that button, it is used to show all the existing tab which may hidden or be showing on the header. Just like the Google Chrome, there is a button which used to search the opened tab on the upper right corner. Google Chrome Search Tabs
Can anyone help to give some solution or advice on how to enlarge the "Search Tab Button" ?
search tab button
I was able to change the size of the Menu Item, but not the button size. Below is the code that I tried to change the size of the Menu Item.
<xcad:DockingManager.DocumentPaneMenuItemHeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Content.Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="10" FontSize="18"/>
</DataTemplate>
</xcad:DockingManager.DocumentPaneMenuItemHeaderTemplate>
Trial Result
The problem is I don't know how to change the button size.
I search through the web, and the only things I found is this Dirkster99/AvalonDock, unfortunately it is not used for Xceed.Wpf.AvalonDock. Help~ Thanks!
https://stackoverflow.com/a/35417749/14891562
Alright, struggling to find shorter solution from the entire web.
In the end, this is what I found, which help me to change the style of the DropDownButton. Thanks to the author!
To enlarge the button, I follow the instruction of the link above to create a resource dictionary for the entire DocumentPaneControlStyle. From there I change the "Width" and "Height" of the xcad:DropDownButton/
Conclusion, AvalonDock is tough! :'(
I have a WPF application where a button is defined through
<Button Command="{Binding ShowSomeDialog}">
<AccessText>_Push me</AccessText>
</Button>
The button does not show the "P" underlined when pressing the ALT-Key, but pressing ALT-P does invoke the command.
In the same application in another window the exact same tag behaves as expected, meaning: it underlines the P when ALT-Key is pressed.
In the context where the HotKey is not underlined, the button is nested deeply. Simplified the hierarchy may be sketched as
Window
syncfusion:TabControlExt
syncfusion:TabItemExt
UserControl
syncfusion:TabControlExt
syncfusion:TabItemExt
UserControl
Button
The HotKey will be underlined if a button is added to the '4. UserControl' and will not be underlined when added to '7. UserControl' or deeper.
I can't find any custom styles for the elements inbetween, especially none in which the RecognizesAccessKey is set to False.
Does anyone have an idea what or where to check?
Check if you have Button restyled somewhere - access key behavior can be easily broken with incorrect style.
And btw, you did try setting Content attribute to "_Push me" directly, without using AccessText, didn't you?
P.S. MSDN may be of help here.
Play with <AccessText ... Margin="0,0,0,X"/> where X is a double value and look if the underscore appears.
I have a number of buttons in my WPF window and I would like to have certain characters in the button contents underlined.
I have tried using the "_" like "My_Content" to underline the C, however this does not appear until the user hits the Alt key, or has their local settings changed. Using < Underline > within the Content property causes an error when I attempt to underline only part of the content like:
Content="My< Underline >C< /Underline >ontent".
I would prefer to set this in the XAML if possible. Any help would be appreciated.
Thank You!
You would have to do this explicitly like so:
<Button>
<Button.Content>
<TextBlock>
My <Underline>C</Underline>ontent
</TextBlock>
</Button.Content>
</Button>
This would remove the ability to click the button using Alt+Char though. For that an AccessText element is used. But that doesn't support the markup syntax of TextBlock.
I need a simple HTML renderer ( like HtmlTexBlock ) which also allows to intercept click on custom defined link ( like LinkLabel ) looking like hyperlink. Does anything like that exist as free software ?
I don't know of any but if you only want one link in your html text could you maybe template a button using the htmltextblock as the content and capture the click event and navigate to desired page. I know it will not work if you have multiple links in your html text however it is unclear what your exact requirment is.
eg.
<Button x:Name="btnhtml" Width="63" >
<htmltextblock Text="Hello World"></htmltextblock>
</Button>