Reputation: 11
I am struggling to get the PathListBox control working in Blend for VS 2022. I have tried to follow a number of tutorials and try as I might I cannot get it to work. I am beginning to wonder if it does actually works at all.
I have created a simple UserControl and tried it and also just a simple Page and tried it but to no avail. The code below is the complete page. What I am expecting is the Labels to be evenly spaced around the ellipse. Longer term what I am trying to do is create a Dial Gauge using the Arc control with pipe signs as increments around the dial.
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DialGauge2"
xmlns:ec="http://schemas.microsoft.com/expression/2010/controls"
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:Collections="clr-namespace:System.Collections;assembly=mscorlib" x:Class="DialGauge2.UserControl1"
mc:Ignorable="d"
d:DesignHeight="400" d:DesignWidth="400">
<Viewbox>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Background="#FFD51E1E" Height="137" Width="136" >
<Ellipse x:Name="ellipse" HorizontalAlignment="Center" Height="100" Stroke="Black" VerticalAlignment="Center" Width="100" Fill="#FFF2EBEB"/>
<ec:PathListBox Foreground="#FFF1EBEB" Margin="0,0,70,58">
<ec:PathListBox.LayoutPaths>
<ec:LayoutPath SourceElement="{Binding ElementName=ellipse}" Distribution="Even" Orientation="OrientToPath" />
</ec:PathListBox.LayoutPaths>
<Label Content="Label"/>
<Label Content="Label"/>
<Label Content="Label"/>
</ec:PathListBox>
</Grid>
</Viewbox>
</UserControl>
Upvotes: 0
Views: 94
Reputation: 11
OK. I found the problem. Removing the made the labels appear. But why? So I added the Viewbox back and used the Blend Controls menu to do that and it all worked. What was the difference? What I had done is this. In following the tutorial I had manually added around the Grid by typing it into the XAML. The code looked all OK but "Objects and Timeline" pane didn't show the Viewbox control and I hadn't noticed this. Adding it via the Controls menu I now have the Viewbox control sitting immediately above the Grid. Cheers Andy
Upvotes: 0