我想在我的窗口中使用ContentTemplate属性。首先,我用标准的窗口类尝试了一下:
<Window.ContentTemplate>
<DataTemplate>
<DockPanel LastChildFill="true">
<TextBlock DockPanel.Dock="Top">Hello world</TextBlock>
<ContentPresenter Content="{Binding}" />
</DockPanel>
</DataTemplate>
</Window.ContentTemplate>
<Button>TestButton</Button>这是我想要的工作方式:

现在尝试用DXWindow (我使用的是DevExpress 10.2.4版本)做同样的事情:
<dx:DXWindow.ContentTemplate>
<DataTemplate>
<DockPanel LastChildFill="true">
<TextBlock DockPanel.Dock="Top">Hello world</TextBlock>
<ContentPresenter Content="{Binding}" />
</DockPanel>
</DataTemplate>
</dx:DXWindow.ContentTemplate>
<Button>TestButton</Button>但是这不起作用,看起来这个属性被忽略了

是否有可能修复此行为?
谢谢。
发布于 2011-03-12 01:50:37
我看到了这个xaml的问题(在最新版本(10.2.5)中,它失败并出现错误):
The DXWindow.ContentTemplate with the ContentPresenter raises exception
我们将在将来解决此问题。
您能解释一下为什么要使用ContentTemplate而不想直接将两个控件都添加到DXWindow中吗?
https://stackoverflow.com/questions/5273659
复制相似问题