1

I'm having a problem creating a viewmodel grid manually in Catel for a Catel usercontrol. The documentation implies that by naming the content grid "__catelInnerWrapper" that the content will not be wrapped with another grid by the ViewModelWrapperService and will use my grid instead. I'd like to do so for visual state management purposes. Using Snoopwpf I can see that the usercontrol is still being wrapped.
(https://i.stack.imgur.com/J6F4k.png)

I tried creating a new Catel project template using Catel 5.8.0 and also 5.9.0 beta 0 using .NET 4.6.1 with a single usercontrol in the mainwindow to test a simplified application and saw the same behavior.

<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>    

In stepping through ViewModelWrappingService.xaml.cs code it seems the usercontrol content Name property is always resolving to null and thus isn't matched with the InnerWrapperName. Do you know why this might be happening? Thank you

BCona
  • 13
  • 3

1 Answers1

0

When looking at the source, you are doing the correct thing. If you are 100% sure that:

  1. You are using a correct build (e.g. fully rebuilt app, not a wrong configuration)
  2. Snoop is correct

Then please report an issue (with minimal repro) at https://github.com/catel/catel/ and we will make sure it will be fixed in Catel 5.9 (currently in beta, about to be released but we will wait for this one).

Geert van Horrik
  • 5,689
  • 1
  • 18
  • 32