XAML for floating window in AvalonDock - xaml

Can someone provide me with an AvalonDock XAML code piece that when run opens the app with a floating window instead of being always docked inside the dock pane? I've seen programmatic ways to do it, but I thought there must be a way to specify it in XAML. Thanks...

I know this is a bit late, but hopefully it will help someone with the same issue in the future...
To create a floating document, add a LayoutDocumentFloatingWindow as a child of LayoutDocumentFloatingWindow, and then add your LayoutDocument as a child of the LayoutDocumentFloatingWindow, as below:
<xcad:DockingManager>
<xcad:LayoutRoot>
<xcad:LayoutRoot.FloatingWindows>
<xcad:LayoutDocumentFloatingWindow>
<xcad:LayoutDocument Title="My Document">
<!--Add document content here-->
</xcad:LayoutDocument>
</xcad:LayoutDocumentFloatingWindow>
</xcad:LayoutRoot.FloatingWindows>
</xcad:LayoutRoot>
</xcad:DockingManager>
Similarly you can add anchorables like so:
<xcad:DockingManager>
<xcad:LayoutRoot>
<xcad:LayoutRoot.FloatingWindows>
<xcad:LayoutAnchorableFloatingWindow>
<xcad:LayoutAnchorablePaneGroup>
<xcad:LayoutAnchorablePane>
<xcad:LayoutAnchorable Title="My anchorable">
<!--Add anchorable content here-->
</xcad:LayoutAnchorable>
</xcad:LayoutAnchorablePane>
</xcad:LayoutAnchorablePaneGroup>
</xcad:LayoutAnchorableFloatingWindow>
</xcad:LayoutRoot.FloatingWindows>
</xcad:LayoutRoot>
Note that unlike LayoutDocuments, for anchorables you need to add a group pane rather than just a single LayoutAnchorable, because floating anchorables are designed to be able to be grouped in a single window but LayoutDocuments are not.
As a more general guide, an example of how to set up varioius layout elements in a DockingManager can be found here: https://xceed.com/wp-content/documentation/xceed-toolkit-plus-for-wpf/AvalonDock.html

Related

How to loop for each record in One2Many field in form view to create dynamic elements?

I have a customized One2Many field that contains several records for this current data.
I am working on a form view.
I need to construct something like this: (I don't want a tree)
<for every record in one2many_field>
<button something...>
</for>
I only want the result as to create 1 button per record in the one2many_field and be able to get the data in some fields from the model of the one2many_field too.
Is there any way to achieve it? I have searched for some time but found nothing even remotely close to this requirement.
You won't be able to achieve that in a Form View. Views in Odoo are kind of strict but it's mostly to avoid bad stuff to happen.
Anyway, you could think about re-creating the full view by yourself using QWeb View (doc for v14 here)
If you want to keep your Form View, you'll have to use a tree inside the form.
Know that you can totally add buttons in Tree views like adding on a sale.order.line something like <button class="btn btn-primary" type="object" name="product_id_change" string="Force Product Id Change"/> (useless, just for the example)
Check example image here
And play with some attrs to change the visibility of fields...
Hope it helped :)

Aligning XAML ToolBarPanels

I have to create a control which aligns some of its button on the left and some others on the right in one row.
I've immediatly thinked to WPF Toolbar so I've typed:
...
<ToolBarTray DockPanel.Dock="Top">
<ToolBar ToolBarTray.Locked="True" Width="{Binding ElementName=Tray, Path=ActualWidth}">
<DockPanel>
<ToolBarPanel DockPanel.Dock="Left">
<Button ...>
</ToolBarPanel>
<ToolBarPanel DockPanel.Dock="Right">
<Button ...>
</ToolBarPanel>
</DockPanel>
</ToolBar>
</ToolBarTray>
...
but this didn't work: the buttons with dockpanel.dock = right are just attached on the right of the first ToolBarPanel and, if I've understood something about xaml, this is absolutely correct, that's why I tried forcing the width of the toolbar.
If I use a Grid with a spacing column, the right ToolBarPanel moves correctly to the right, but my control needs to be resized and I guess there's no easy way to assign the correct width to the column.
Is there some easier way to achive my task?

A question about Vue.js source code in function _createElement()

In _createElement, I want to ask whether data.is is same to the v-bind:is?
https://github.com/vuejs/vue/blob/0baa129d4cad44cf1847b0eaf07e95d4c71ab494/src/core/vdom/create-element.js#L64
Why tag = data.is?
Thanks for every respondent!
As the comment in the code suggests, that line is specifically to handle the case where is is included inside an object v-bind. e.g.:
<component v-bind="{ is: 'button' }">Button</component>
You can see this for yourself by setting a breakpoint in your browser on that line. I'm using Webpack and Chrome and the relevant file appears under webpack:///./node_modules/vue/dist/vue.esm.js in the Sources tab. Quick search for _createElement and click in the margin to set a breakpoint.
In the example above the is value is intended to be used as the tag, whereas component is just a dummy tag that can be discarded.
The syntax above is equivalent to:
<component is="button">Button</component>
or:
<button>Button</button>
However, neither of these two examples will go into the relevant if section. In these other two cases the tag is already resolved correctly prior to this point.

Using multiple string resources from .resw file into ContentDialog

I would like to set the PrimaryButtonText, SecondaryButtonText and Title attributes of a ContentDialog with strings from my .resw file. Unfortunately Ι can do this only for one attribute using x:Uid, since setting x:Uid two times inside ContentDialog can not be accepted. I even tried to do something like that:
<ContentDialog>
<ContentDialog.PrimaryButtonText x:Uid="DialogConfirm" />
<ContentDialog.SecondaryButtonText x:Uid="DialogCancel" />
</ContentDialog>
But I got an exception
XBF generation error code 0x09c8
Is there any way to accomplish this?
Set x:Uid only for ContentDialog then in resources file set apropriate properties (take a look at MSDN):
<ContentDialog x:Uid="myDialog">
<!--your dialog-->
</ContentDialog>
In Resources.resw set:
myDialog.PrimaryButtonText -> text for primary button
myDialog.SecondaryButtonText -> text for secondary button
As for more guidelines and help, see MSDN.

Reporting Services Error?

When running a report in preview I get the following error The definition of the report is invalid , the tablix 'Tablix11' contains an invalid TablixMember. The sort Expressions element is not allowed if Group is omitted.
I have never come across this error before and cant understand what is causing it.
The error can be replicated by creating a simple Tablix and looking at the underlying XML.
When you create a Tablix with a group, the underlying RDL XML will include something like this:
<TablixRowHierarchy>
<TablixMembers>
<TablixMember />
<TablixMember>
<Group Name="Group1">
<GroupExpressions>
<GroupExpression>=Fields!val.Value</GroupExpression>
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!val.Value</Value>
</SortExpression>
</SortExpressions>
<TablixMembers>
<TablixMember>
<Group Name="Details3" />
</TablixMember>
</TablixMembers>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
If you remove the entire Group element, this will give the same error you're seeing:
If you also remove the SortExpressions element this will allow the report to render without error.
However - it's impossible for me to say how your RDL file got in this state in the first place. Given that hacking XML to get things running is seldom a good idea, my recommendation would be to start the tablix from scratch instead of hacking things to a working state - you might just be introducing more problems.
But at least hopefully now you can see why the error might be occurring.
I found that the Tablix header had a textbox property containing interactive sort. This text box is in the header, and not part of the detail. When I deleted the field from the detail of the tablix, the interactive sort remained on the textbox in the header.
Changing it on the header by right clicking on the header textbox of the tablix, then selecting textbox properties, then selecting "interactive sorting", and then correcting the "sort by" value to the correct field name did the trick.