AvalonDock LayoutPanel not displaying in Visual Studio Design mode - avalondock

I am using Dirkster99's AvalonDock (version 4.60.1) and the docking layout disappears in Design mode:
When running the application, it shows up fine:
XAML:
<Window x:Class="DockingTestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonDock="clr-namespace:AvalonDock;assembly=AvalonDock"
xmlns:avalonDockLayout="clr-namespace:AvalonDock.Layout;assembly=AvalonDock"
mc:Ignorable="d">
<Grid x:Name="MainGrid">
<!--#region Docking Manager -->
<avalonDock:DockingManager x:Name="dockingManager"
AllowMixedOrientation="True">
<avalonDockLayout:LayoutRoot x:Name="layoutRoot">
<avalonDockLayout:LayoutPanel x:Name="mainLayoutPanel"
Orientation="Horizontal">
<!--#region Main Left Column -->
<avalonDockLayout:LayoutPanel x:Name="leftPanel"
Orientation="Vertical"
DockWidth="4*">
<avalonDockLayout:LayoutPanel Orientation="Horizontal"
x:Name="left1"
DockHeight="3*">
<avalonDockLayout:LayoutAnchorablePane DockWidth="4*"
Name="left11">
<avalonDockLayout:LayoutAnchorable Title="A"
ContentId="A"
x:Name="A">
<Border Background="Red" />
</avalonDockLayout:LayoutAnchorable>
</avalonDockLayout:LayoutAnchorablePane>
</avalonDockLayout:LayoutPanel>
<avalonDockLayout:LayoutPanel Orientation="Horizontal"
x:Name="left2"
DockHeight="12*">
<avalonDockLayout:LayoutPanel x:Name="left21"
Orientation="Vertical"
DockWidth="5*">
<avalonDockLayout:LayoutAnchorablePane DockHeight="8*"
x:Name="left211">
<avalonDockLayout:LayoutAnchorable Title="C"
ContentId="c"
x:Name="c">
<Border Background="Orange" />
</avalonDockLayout:LayoutAnchorable>
</avalonDockLayout:LayoutAnchorablePane>
</avalonDockLayout:LayoutPanel>
<avalonDockLayout:LayoutPanel x:Name="left3"
Orientation="Vertical"
DockWidth="4*">
<avalonDockLayout:LayoutAnchorablePane DockHeight="3*"
x:Name="left31">
<avalonDockLayout:LayoutAnchorable Title="F"
ContentId="F"
x:Name="F">
<Border Background="Yellow" />
</avalonDockLayout:LayoutAnchorable>
</avalonDockLayout:LayoutAnchorablePane>
</avalonDockLayout:LayoutPanel>
</avalonDockLayout:LayoutPanel>
</avalonDockLayout:LayoutPanel>
<!--#endregion-->
<!--#region Main Right Column -->
<avalonDockLayout:LayoutPanel x:Name="rightPanel"
Orientation="Vertical"
DockWidth="3*">
<avalonDockLayout:LayoutAnchorablePane x:Name="right1">
<avalonDockLayout:LayoutAnchorable Title="K"
x:Name="K"
ContentId="K">
<Border Background="DodgerBlue" />
</avalonDockLayout:LayoutAnchorable>
</avalonDockLayout:LayoutAnchorablePane>
</avalonDockLayout:LayoutPanel>
<!--#endregion-->
</avalonDockLayout:LayoutPanel>
<!--#endregion-->
</avalonDockLayout:LayoutRoot>
</avalonDock:DockingManager>
</Grid>
</Window>
The behavior in Design mode is pretty erratic and was hoping someone has experienced this before and found a solution.
I have simplified the layout as much as possible in the above XAML and the problem still occurs.

I have the same issue with Dirkster99's AvalonDock (version 4.70.1) but with Visual Studio 2022 (Version 17.1.1) only. With VS 2019, it works OK.

Related

Swap scroll bar and X axis labels

I am using trial version of SciChart and doing some tests.
I need to bring scroll bar on top of X axis.
After some research and parsing visual tree, I am planning to change style of SciChartSurface and replace axis and scroll bar, which are placed inside stack panel.
Is this right solution? If AxisAlignment is Top, visual tree may differ.
If this is right way to go, where can I find style of surface?
Bland does not recognize chart and I can't use it.
I was playing around with this and it is possible to achieve a scrollbar above an XAxis by templating the axis control itself.
Here is the default control template for the AxisBase control (SciChart v4)
<ControlTemplate TargetType="axes:AxisBase">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ap:Device.SnapsToDevicePixels="True">
<StackPanel x:Name="PART_AxisContainer"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Orientation="{Binding AxisAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay, Converter={StaticResource AxisAlignmentToAxisOrientationConverter}, ConverterParameter=Inverse}"
ap:Device.SnapsToDevicePixels="True"
apc:AxisLayoutHelper.AxisAlignment="{Binding AxisAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}">
<Grid HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Canvas.ZIndex="1"
ap:Device.SnapsToDevicePixels="True"
apc:AxisLayoutHelper.IsInsideItem="True">
<themes:AxisPanel x:Name="PART_AxisCanvas"
AxisAlignment="{TemplateBinding AxisAlignment}"
Background="Transparent"
DrawLabels="{TemplateBinding DrawLabels}"
DrawMajorTicks="{TemplateBinding DrawMajorTicks}"
DrawMinorTicks="{TemplateBinding DrawMinorTicks}"
IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}"
MajorTickLineStyle="{TemplateBinding MajorTickLineStyle}"
MinorTickLineStyle="{TemplateBinding MinorTickLineStyle}"
ap:Device.SnapsToDevicePixels="True">
<Image x:Name="PART_AxisBitmapImage"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Stretch="Fill"
ap:Device.SnapsToDevicePixels="True" />
<Grid x:Name="PART_LabelsCanvas" Margin="{Binding LabelToTickIndent, RelativeSource={RelativeSource FindAncestor, AncestorType=themes:AxisPanel}, Mode=OneWay}">
<themes:TickLabelAxisCanvas AutoFitMarginalLabels="{TemplateBinding AutoFitMarginalLabels}"
Background="Transparent"
ClipToBounds="False"
IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}"
ap:Device.SnapsToDevicePixels="True" />
<themes:TickLabelAxisCanvas AutoFitMarginalLabels="{TemplateBinding AutoFitMarginalLabels}"
Background="Transparent"
ClipToBounds="False"
IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}"
Visibility="Collapsed"
ap:Device.SnapsToDevicePixels="True" />
</Grid>
<labelProviders:AxisTitle Orientation="{TemplateBinding Orientation}"
Style="{TemplateBinding TitleStyle}"
Visibility="{Binding Content, RelativeSource={RelativeSource Self}, Converter={StaticResource CollapseIfNullOrEmptyStringConverter}}" />
</themes:AxisPanel>
<themes:ModifierAxisCanvas x:Name="PART_ModifierAxisCanvas"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ap:Device.SnapsToDevicePixels="True" />
</Grid>
<ContentPresenter Content="{TemplateBinding Scrollbar}" apc:AxisLayoutHelper.IsOutsideItem="True" />
</StackPanel>
</Border>
</ControlTemplate>
Here is the modified template (including converters)
<s:DateTimeAxis AxisAlignment="Bottom"
AxisTitle="Top Axis"
BorderThickness="0,0,0,1"
Id="TopAxisId">
<s:DateTimeAxis.Resources>
<s:AxisAlignmentToAxisOrientationConverter x:Key="AxisAlignmentToAxisOrientationConverter" />
<s:CollapseIfNullOrEmptyStringConverter x:Key="CollapseIfNullOrEmptyStringConverter" />
</s:DateTimeAxis.Resources>
<s:DateTimeAxis.Template>
<ControlTemplate TargetType="s:AxisBase">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
s:Device.SnapsToDevicePixels="True">
<StackPanel x:Name="PART_AxisContainer"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Orientation="{Binding AxisAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay, Converter={StaticResource AxisAlignmentToAxisOrientationConverter}, ConverterParameter=Inverse}"
s:Device.SnapsToDevicePixels="True"
s:AxisLayoutHelper.AxisAlignment="{Binding AxisAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}">
<ContentPresenter Content="{TemplateBinding Scrollbar}" />
<Grid HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Canvas.ZIndex="1"
s:Device.SnapsToDevicePixels="True"
>
<s:AxisPanel x:Name="PART_AxisCanvas"
AxisAlignment="{TemplateBinding AxisAlignment}"
Background="Transparent"
DrawLabels="{TemplateBinding DrawLabels}"
DrawMajorTicks="{TemplateBinding DrawMajorTicks}"
DrawMinorTicks="{TemplateBinding DrawMinorTicks}"
IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}"
MajorTickLineStyle="{TemplateBinding MajorTickLineStyle}"
MinorTickLineStyle="{TemplateBinding MinorTickLineStyle}"
s:Device.SnapsToDevicePixels="True">
<Image x:Name="PART_AxisBitmapImage"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Stretch="Fill"
s:Device.SnapsToDevicePixels="True" />
<Grid x:Name="PART_LabelsCanvas" Margin="{Binding LabelToTickIndent, RelativeSource={RelativeSource FindAncestor, AncestorType=s:AxisPanel}, Mode=OneWay}">
<s:TickLabelAxisCanvas AutoFitMarginalLabels="{TemplateBinding AutoFitMarginalLabels}"
Background="Transparent"
ClipToBounds="False"
IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}"
s:Device.SnapsToDevicePixels="True" />
<s:TickLabelAxisCanvas AutoFitMarginalLabels="{TemplateBinding AutoFitMarginalLabels}"
Background="Transparent"
ClipToBounds="False"
IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}"
Visibility="Collapsed"
s:Device.SnapsToDevicePixels="True" />
</Grid>
<s:AxisTitle Orientation="{TemplateBinding Orientation}"
Style="{TemplateBinding TitleStyle}"
Visibility="{Binding Content, RelativeSource={RelativeSource Self}, Converter={StaticResource CollapseIfNullOrEmptyStringConverter}}" />
</s:AxisPanel>
<s:ModifierAxisCanvas x:Name="PART_ModifierAxisCanvas"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
s:Device.SnapsToDevicePixels="True" />
</Grid>
</StackPanel>
</Border>
</ControlTemplate>
</s:DateTimeAxis.Template>
<s:DateTimeAxis.Scrollbar>
<s:SciChartScrollbar Margin="0 3 0 0" />
</s:DateTimeAxis.Scrollbar>
</s:DateTimeAxis>
This code includes the default control template of the AxisBase in SciChart but removes two critical attached properties: AxisLayoutHelper.IsOutsideItem / IsInsideItem. These properties are used to adjust the order of Axis vs, Scrollbar depending on alignment of the axis. Removing them, you can place the ContentPresenter for the scrollbar anywhere and it will stay put.
This is tested as working in v4 of SciChart WPF

WebView in FlipViewItem - WebView does not accept any gestures

I've put a WebView inside of a FlipViewItem. The problem seems to be that in WP 8.1, the WebView does not get the gestures (presumably because they're absorbed by the FlipView). The desired result is to be able to scroll vertically and tap in the WebView but also to be able scroll horizontally for the FlipView (even if just in a limited area on the horizontal edges). Is there any solution or workaround for this?
<StackPanel>
<StackPanel Name="postTitle" Background="Transparent">
<TextBlock Name="ContentArea" Text="" FontSize="18" Margin="10, 5, 10, 0" TextWrapping="WrapWholeWords" FontWeight="Bold" Foreground="White"/>
<TextBlock Name="SubArea" Text="" FontSize="16" Margin="10, 0, 10, 10" TextWrapping="WrapWholeWords" Foreground="White"/>
</StackPanel>
<FlipView Name="swipeArea" Height="460" Margin="0" Padding="0" SelectedIndex="1" SelectionChanged="swipeArea_SelectionChanged">
<FlipViewItem Name="oneItem">
</FlipViewItem>
<FlipViewItem Name="mainFlipViewItem">
<Grid>
<ProgressRing Name="progRing" Foreground="White" Margin="0,25,0,0" Background="Transparent" Visibility="Collapsed" VerticalAlignment="Top"/>
<WebView Name="InterWindow" Height="460" Visibility="Collapsed" DefaultBackgroundColor="#5E5E5E"></WebView>
<ScrollViewer Name="Scrollster" ZoomMode="Enabled" MinZoomFactor="1" MaxZoomFactor="8" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<Image Name="WebWindow" Height="420" HorizontalAlignment="Center" VerticalAlignment="Top">
</Image>
</ScrollViewer>
</Grid>
</FlipViewItem>
<FlipViewItem Name="threeItem">
</FlipViewItem>
</FlipView>
</StackPanel>
I believe I just found one workaround. I've added this to the WebView control:
Canvas.ZIndex="1000"
I can then set the width of the WebView control to something just slimmer than the FlipView itself, and then I should be good.

AppBarUtils in Windows Phone bug

I have problem with AppBarUtils, Eariler I have command in my appBar and when it run. However something broke. My Main.xaml
<phone:PhoneApplicationPage
x:Class="OsiÄ…gnijCelPhoneApp.Views.Main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:appBarUtils="clr-namespace:AppBarUtils;assembly=AppBarUtils"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
DataContext="{Binding Source={StaticResource Locator}, Path=Main}"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="login"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
<!--<i:Interaction.Behaviors>
<appBarUtils:AppBarItemCommand Id="login" Command="{Binding LoginIn,Mode=TwoWay}"/>
</i:Interaction.Behaviors>-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Button Margin="25,0,0,355" Content="Zaloguj" Command="{Binding LoginIn,Mode=TwoWay}" />
</Grid>
</Grid>
</phone:PhoneApplicationPage>
I use Telerik, MVVM light, and AppBarUtils. I preinstalled AppBarUtils.
When I deploy my on phone, that I got
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.ni.dll Additional information: Unknown parser error: Scanner 2148474880. [Line: 25 Position: 29]
I think that it is problem with System.Windows.Interactive, because if I comment it, rest run.I debug on arm.
You havent set the interaction triggers. See this example http://allenlooplee.wordpress.com/2011/08/26/how-to-do-command-binding-for-application-bar-with-appbarutils-in-xaml/

How do i only action at UserControl?

I have a UserControl:
<UserControl x:Class="WP8.Progress"
..................................
d:DesignHeight="800" d:DesignWidth="480">
<Grid x:Name="LayoutRoot" Background="Transparent">
<Rectangle Stretch="Fill" Opacity="0.75" Fill="DarkGray"/>
<StackPanel x:Name="stackPanel" Orientation="Vertical" VerticalAlignment="Center">
<ProgressBar Foreground="Blue" IsIndeterminate="True"/>
</StackPanel>
</Grid>
</UserControl>
I call UserControl in MainPage:
<phone:PhoneApplicationPage
x:Class="WP8.MainPage"
..................................
mc:Ignorable="d"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<Grid x:Name="LayoutRoot" Background="Black">
<Grid>
<Button Name="btnButton" Content="OK" Click="btnButton_Click"/>
</Grid>
<Grid>
<uc:Progress />
</Grid>
</Grid>
</phone:PhoneApplicationPage>
When i run app, i see UserControl upper MainPage but i still pressed button at MainPage.
How do i only action at UserControl?
I got your question i have done the same thing in my App when you are opening the UserControl set your LayoutRoot.IsHitTestVisible="False" and after then the user has done on the usercontrol or usercontrol is closed then set it as true. And you can also do some opacity or visibility changes if you want with the grid.

WP8 Progress Bar Not Rendering

I have placed a Progress Bar control within my MainPage.xaml. The application type is Pivot.
For some reason, the Progress Bar and a TextBlock which I have placed within a PivotItem and below a Grid are not showing. There is a LongListSelector directly beneath these two controls. Are these two controls not showing because of that? I used the UI to drag the LongListSelector beneath then anyway, so I'm not sure why it's not showing.
This is the XAML:
<phone:Pivot Title="Title" Background="White" Foreground="Black">
<!--Pivot item one-->
<phone:PivotItem Header="Header" Foreground="Black">
<Grid>
<ProgressBar Name="progressBar" Value="0" IsIndeterminate="True" Margin="0,0,0,579"/>
<TextBlock Name="txtLastUpdated" FontWeight="Black" FontStyle="Italic" Foreground="Black" Margin="0,24,0,541" />
<phone:LongListSelector Name="llsLocations" ItemsSource="{Binding}" SelectionChanged="LongListSelector_OnSelectionChanged" Margin="0,62,0,0">
<phone:LongListSelector.ItemTemplate>
...
...
...
As you can see, there is a ProgressBar and a TextBlock above the LongListSelector who are also inside the Grid control.
Any ideas why these two controls are not showing?
I think you have something wrong with Margin or item positioning. I've tested code below and it works:
<phone:Pivot Title="Title" Background="White" Foreground="Black">
<!--Pivot item one-->
<phone:PivotItem Header="Header" Foreground="Black">
<Grid>
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<ProgressBar Name="progressBar" Value="0" IsIndeterminate="True" VerticalAlignment="Center" Margin="0"/>
<TextBlock Name="txtLastUpdated" FontWeight="Black" FontStyle="Italic" Foreground="Black"
HorizontalAlignment="Center" Text="Something"/>
</StackPanel>
<phone:LongListSelector Name="llsLocations" ItemsSource="{Binding}" SelectionChanged="LongListSelector_OnSelectionChanged" Margin="0,62,0,0"/>
</Grid>
</phone:PivotItem>
</phone:Pivot>
Remove margin of all child element of StackPanel. This will defiantly helps you.
<phone:Pivot Title="Title" Background="White" Foreground="Black">
<!--Pivot item one-->
<phone:PivotItem Header="Header" Foreground="Black">
<Grid>
<StackPanel>
<ProgressBar Name="progressBar" Value="0" IsIndeterminate="True"/>
<TextBlock Name="txtLastUpdated" FontWeight="Black" FontStyle="Italic" Foreground="Black" />
<phone:LongListSelector Name="llsLocations" ItemsSource="{Binding}" SelectionChanged="LongListSelector_OnSelectionChanged" >
<phone:LongListSelector.ItemTemplate>
</StackPanel>
</Grid>
</phone:PivotItem>
</<phone:Pivot>
Hardcoding control's position (especially by dragging controls in designer) is not a good practice. Try to define rows for your Grid, then specify Grid.Row for controls inside the Grid. With that you can arrange Grid content more neatly. Check this link for more sample and explanation about layouting controls inside Grid. Following is an example for your situation :
<phone:PivotItem Header="Header" Foreground="Black">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<ProgressBar Name="progressBar" Value="0" IsIndeterminate="True" />
<TextBlock Name="txtLastUpdated" FontWeight="Black" FontStyle="Italic" Foreground="Black" />
</StackPanel>
<phone:LongListSelector Grid.Row="1" Name="llsLocations" ItemsSource="{Binding}" SelectionChanged="LongListSelector_OnSelectionChanged" >
<phone:LongListSelector.ItemTemplate>
...
...