Multiple lines of tab in Avalon Dock - wpf

I'm using AvalonDock 2.0 as a tab control manager, however i have not come across a way to allow multiple lines of tabs (when needed), or a way to show that there are hidden tabs in the background.
Can the multiple lines of tab be accomplished through a template or style? or am i missing out on some basic properties that i didn't know?

The answer can be found at the Xceed forum here: https://xceed.com/forums/topic/display-multiple-lines-of-tabs-in-avalondock-dockmanager/
The idea is to override the template of LayoutDocumentPaneControl and provide an alternative implementation, then assign this new template to the DockingManager via its DocumentPaneControlStyle property.

Related

Displaying dynamic text with hyperlinks in Silverlight

I have an application that should work a bit like a message board: text gets parsed, hyperlinks are made "live" and displayed. Only it's in Silverlight. Because of that, I can't use TextBlock like they do here WPF - Making hyperlinks clickable, somehow it's different in Silverlight and it's not possible to do a Hyperlink with a Run inside it.
I've tried the RichTextBlock, as it says here Wrapping Text and Hyperlinks in Silverlight, but couldn't for the life of me figure out how to create the paragraphs and hyperlinks from code, since I need to populate it dynamically.
Then I thought I'd settle for a less elegant solution involving TextBlocks and HyperlinkButtons in a WrapPanel. I added a namespace reference, like it says here WrapPanel in Silverlight 4 toolkit, but when I reference it in XAML, there's no WrapPanel in it, only DataField, DataForm and VisualStateManager.
This Text areas and hyperlinks? doesn't work either, the Silverlight RichTextBox is different and LinkLabel is missing.
Maybe there's another solution that I don't know? I'm keeping an open mind. Any help appreciated.

Remove datagrid possible WPF?

I have the main.xaml where I have a ribbon with some tabs on it. Basically I have an Articles Tab, Categories Tab, Keywords Tab etc. What I would like to be able to do is, once I click on the Articles tab, I load the datagrid with the Articles, once I click on the Categories Tab, I load the datagrid with the Categories, and the Keywords the same thing. I was thinking of creating 3 datagrids, and once a tab is clicked I hide/remove the other 2. Is this the correct way to do it, and if it is how can I achieve this?
Thanks for your help and time
ok solved
I only needed this
dgCategories.Visibility = Visibility.Collapsed;
I haven't used a ribbon, but in a normal tab control you can set the SelectedContentTemplateSelector property to a DataTemplateSelector. This will provide a given template to the content that you have currently selected. This means that you don't have to worry about adding / removing controls as this will be handled by WPF.
In general when you are faced with changing display of content then I would recommend using a template selector.

How to make the selected TabItem look attached to the rest of the document

I have a WPF app with a few Tabs. I'm now messing around with styling and have for example changed the ControlTemplate so I now have to define everything about the TabItem.
Now the TabItem that is selected seems detached from the document below because of some thin line around that content (there is no border). I'm not sure what technique to use to make it look attached again.
My guess would be that the Header-template is responsible for the problem. You can style that too tho - see this example for details: http://www.switchonthecode.com/tutorials/the-wpf-tab-control-inside-and-out

Encapsulating and customizing a third party WPF control

I'm interested in customizing a 3rd party control, such as Telerik's RadGridView, as a standalone control, for example adding New Row and Delete Row buttons above the grid, yet still supporting XAML manipulation of the internals of the control by the window upon which my control exists (i.e. for the window to add its own style to a column of the grid).
Is there a way to add the buttons, etc. with templates? Styles?
My current "solution" is to inherit from the RadGridView, but I'm stuck on how to add the features I need.
Thanks!
My suggestion is to use composition over inheritance.
You can create your own control (UserControl should do the work). Then you can define the layout (may be in Grid panel): buttons on the top, RadGridView bellow them, etc. For custom column styling you can use DynamicResource trick. Set the styles of the columns you want to modified with DynamicResource. This way when the control is added to the logical(visual) tree; WPF will walk up the control tree and find appropriate resource. This way in each window/page resources you can define the different resource.
Another idea that come to my mind is that you can extract the buttons as a separate control. The only reference that they will need will be RadGridView and you can use binding with element name to provide it.
I would go the custom UserControl route instead of inheritance route. Styling and theming work strangely when you're dealing w/sub-classes. Unless you're planning on duplicating and modifying Telerik's ControlTemplates and DataTemplates, it can get pretty hairy.

Can I make WPF grid controls opaque at design time?

So I'm just starting out with WPF, and I'm really annoyed by the fact that if I lay two Grids on top of one another, the top Grid isn't opaque. It makes designing extremely annoying. Can this be turned off somehow?
I'm just building your standard Winforms STYLE application, but in WPF. I'm just trying to start bridging the gap here. In Winforms(and VB) you'd always have group boxes or something on your form, and then depending on some user context, one of those group boxes would be on top. Its how I've designed forms since time immemorial. One of two things must be true here:
A) This is not the recommended way to design Windows going forward with WPF, but I don't understand what you're supposed to do
B) There is some property to make the Grids opaque so I can build the Window in the style that I'm used to.
I'm fine with answers that solve either A or B. If I'm not doing things the right way because they've changed, then please enlighten me.
Update: So it turns out, I can make the grid opque by setting the background color, but now it seems like I'm locked into a White background as opposed to sticking with the system colors.
You could use SystemColors to make the control background colour match (rather than being white).
I don't understand why you want to put one grid on top of another though. In WPF you generally use a single grid to stack multiple visual elements within one region. Can you explain why you want to hide things in the background with foreground elements?
It sounds a little like you're implementing a tab control -- switching between pages of controls depending on focus. Have you experimented with the new TabControl?
I'm moving from WinForms to WPF development wherever possible and have found that in doing so it's taken some readjustment. WPF has a completely different way of laying things out and now that I'm more comfortable with it, I think it's superior. I'm guessing you just need to ride the learning curve a little longer.
Hope that helps.
EDIT: In response to your comment, I imagine you can have a tab control without tabs, though I haven't tried it myself (might be worthy of another question on SO). Tab controls are headered controls, meaning that they have a header item and a content item. In this case, the header is the tab button, the content is the page item. You can specify a ControlTemplate that details how these items should be displayed relative to one another.
Interestingly, many other types of common GUI element are also headered controls:
Menu items - The menu item text/icon is the header, and the optional submenu is the content
Tree view - Each node is the header, and optional children are within the content
Group box - The header is, well, the header and the content is, well, the content :)
Note that in the case of menu items and tree views, the type may recursively nest within itself. This is quite elegant and can give some wildly different presentation options over the same logical model with only changes to the control template.
For more information read about HeaderedContentControl and HeaderedItemsControl
You could use the following:
<Grid Background="{DynamicResource {x:Static SystemColors.WindowBrush}}">
<!-- content -->
</Grid>
This will respond to changes in the system colors on the fly (the DynamicResource does this).

Resources