Hi,
I believe the problem is in the MyCanvas or CanvasItem classes. Maybe a "TemplateBinding HorizontalContentAlignment" is missing.
Using a sample like the following moves the Horizontal and Vertical Content of the CanvasItem (button) as expected :
I believe the problem is in the MyCanvas or CanvasItem classes. Maybe a "TemplateBinding HorizontalContentAlignment" is missing.
Using a sample like the following moves the Horizontal and Vertical Content of the CanvasItem (button) as expected :
<Window x:Class="WpfApplication37.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:local="clr-namespace:WpfApplication37"
Title="MainWindow" Height="350" Width="525">
<local:MyCanvas>
<local:CanvasItem x:Name="myButton" Content="My Button" Width="200" Height="25"/>
<xctk:PropertyGrid SelectedObject="{Binding ElementName=myButton}" Canvas.Top="27"/>
</local:MyCanvas>
</Window>
namespace WpfApplication37
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
public class MyCanvas : Canvas
{
}
public class CanvasItem : Button
{
}
}