Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将XAML中的定位值设置为左、右、上、下_C#_Wpf_Winforms_Anchor - Fatal编程技术网

C# 将XAML中的定位值设置为左、右、上、下

C# 将XAML中的定位值设置为左、右、上、下,c#,wpf,winforms,anchor,C#,Wpf,Winforms,Anchor,我想在我的WPF项目中使用WinForms DateTimePicker 这适用于下面的xaml <WindowsFormsHost HorizontalAlignment="Left" Height="34" Margin="10,10,0,-44" VerticalAlignment="Top" Width="280"> <wf:DateTimePicker Name="DateTimePickerBox" Dock="Fill" Anchor="Right" /&

我想在我的WPF项目中使用WinForms DateTimePicker

这适用于下面的xaml

<WindowsFormsHost HorizontalAlignment="Left" Height="34" Margin="10,10,0,-44" VerticalAlignment="Top" Width="280">
    <wf:DateTimePicker Name="DateTimePickerBox" Dock="Fill" Anchor="Right" />
</WindowsFormsHost>
如何在XAML中执行此操作,因为锚定值只允许我分配一个。

使用逗号

<WindowsFormsHost HorizontalAlignment="Left" Height="34" Margin="10,10,0,-44" VerticalAlignment="Top" Width="280">
      <wf:DateTimePicker Name="DateTimePickerBox" Dock="Fill" Anchor="Right,Left,Bottom,Top" />
</WindowsFormsHost>

而不是
Anchor=“Right”
只需编写
Anchor=“Top,Bottom,Left,Right”

<WindowsFormsHost HorizontalAlignment="Left" Height="34" Margin="10,10,0,-44" VerticalAlignment="Top" Width="280">
      <wf:DateTimePicker Name="DateTimePickerBox" Dock="Fill" Anchor="Right,Left,Bottom,Top" />
</WindowsFormsHost>