Catel即使将内容网格命名为“ __catelInnerWrapper”,也将用户控件内容包装在视图模型网格中

时间:2019-01-17 22:54:19

标签: catel

我在为Catel用户控件在Catel中手动创建视图模型网格时遇到问题。该文档暗示通过将内容网格命名为“ __catelInnerWrapper”,该内容将不会被ViewModelWrapperService用另一个网格包装,而将使用我的网格。我这样做是出于视觉状态管理的目的。使用Snoopwpf,我可以看到usercontrol仍然被包装。
https://i.imgur.com/teSu9La.png

我尝试使用.NET 4.6.1使用Catel 5.8.0和5.9.0 beta 0创建一个新的Catel项目模板,在主窗口中使用单个用户控件来测试简化的应用程序,并看到了相同的行为。

<catel:UserControl x:Class="CatelTest.Views.MyUserControl"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"           
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:catel="http://schemas.catelproject.com">

    <Grid x:Name="__catelInnerWrapper">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>      
        <Label Grid.Row="0" Content="{Binding Title}" />
        <Label Grid.Row="1" Content="My User Control" />
    </Grid> 
</catel:UserControl>    

单步执行ViewModelWrappingService.xaml.cs代码时,似乎usercontrol内容的Name属性始终解析为null,因此与InnerWrapperName不匹配。您知道为什么会这样吗?谢谢

1 个答案:

答案 0 :(得分:0)

查看源代码时,您在做正确的事情。如果您100%确定:

  1. 您使用的是正确的版本(例如完全重建的应用,而不是 配置错误)
  2. 窥探是正确的

然后,请在https://github.com/catel/catel/上报告一个问题(具有最小的再现性),我们将确保在Catel 5.9(当前为beta版,即将发布,但将等待它)中将其修复。< / p>

相关问题