Enlarge and Styling for Xceed.Wpf.AvalonDock Drop Down Button - wpf

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! :'(

Related

Test Stack White not getting some WPF elements by automation id

I need to get the main menu items (PanelItem) within a DevComponents NavigationPane. I am using Test Stack White's Window.GetMultiple(SearchCriteria.ByAutomationId("xyz")) method which works fine for sub menu items (ButtonDropdown, see example below). I am also able to get the second test button ("TestButton2") but I don't get "TestButton1" and "PanelItem" (and "NavigationPane" neither). Does anyone have an idea why this is?
xmlns:dc="clr-namespace:DevComponents.WpfRibbon;assembly=DevComponents.WpfRibbon"
...
<dc:NavigationPane AutomationProperties.AutomationId="NavigationPane" Name="Test01">
<Button AutomationProperties.AutomationId="TestButton1">Test button 1</Button>
<dc:PaneItem AutomationProperties.AutomationId="PanelItem">
<StackPanel>
<Button AutomationProperties.AutomationId="TestButton2">Test button 2</Button>
<dc:ButtonDropDown AutomationProperties.AutomationId="ButtonDropDown"></dc:ButtonDropDown>
...
</dc:NavigationPane>
I understand now. :) The very good Stack White documentation recommends using the https://archive.codeplex.com/?p=uiautomationverify tool which lets you pick a running application and shows the visible elements of that application in a tree. So I realized that my first test button is not visible and the PaneItems are no clickable elements. I think I need to click the main menu items programmatically (not with Stack White).

WPF: Hotkey on Button does not appear underlined when pressing ALT-Key

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.

MouseDown doesnt work in Grid (only on buttons which in grids)

I have problem with MouseDown event. My app looks like that, I have grid in which im adding buttons in code behind
<Grid Grid.Column="1" Name="gridWithButtons" MouseDown="normalModeButtonsWP_MouseDown" >
<WrapPanel Name="normalModeButtonsWP" MouseDown="normalModeButtonsWP_MouseDown" ></WrapPanel>
</Grid>
But when im pressing mouse button in grid/wrappanel ( i mean in empty space between buttons for example) it doesnt work. Works only when im pressing button which is in wrap/grid. Anyone know how to handle it?
Setting IsHitTestVisible alone will not make it work.
Elements are not clickable if Background is set to None. To make it clickable (applies to grid, stackpanel, etc) set the Background to #00000000. This is a feature by design to prevent users clicking on ghost buttons. However, assigning it a color will make it clickable.
Try setting IsHitTestVisible = true on your grid

How can I underline a single character in the Content of a Button in WPF?

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.

Adding an image to a button in XAML

I'm trying to add an image to a button in my silverlight 3 application but cannot get the image to appear. I added a folder, named \images, to my Silverlight application folder and an using a relative path in the Source attribute of the Image. What am I doing wrong?
<Button Width="200"
Height="200">
<Image Source="images\document.png"></Image>
</Button>
The easiest way to find out what is going on is to add an event handler for the ImageFailed event to see what URL it is trying to use.
You should probably try using forward slashes instead of back slashes, but I'm not sure if that is the real issue.

Resources