ivan_b
Topic Author
Posts: 87
Joined: 22 Jul 2015, 12:57

"Native type is not registered" when using Value converter

30 Nov 2015, 10:22

Hi

When I use a value converter inside the Width of a GridColumn i get "InvalidOperationException: Native type is not registered"
<Page
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        Title="ResourceSample" >
        <Page.Resources>
          <BoolToStarLengthConverter x:Key="BoolToStarLengthConverter" />
        </Page.Resources>
        <Grid >
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="1*"></ColumnDefinition>
              <ColumnDefinition Width="{Binding ElementName=HideColumn, Path=IsChecked, Converter={StaticResource BoolToStarLengthConverter}}"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Button Grid.Column="0" Background="Blue">Button 1</Button>
            <Button Grid.Column="1" Background="Red">Button 1</Button>
          </Grid>
          <Button Content="Right-click me!" x:Name="Button" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Green">
                  <Button.ContextMenu>
                      <ContextMenu>
                          <MenuItem >
                            <CheckBox x:Name="HideColumn" IsChecked="True">Hide column</CheckBox>
                          </MenuItem>
                      </ContextMenu>
                  </Button.ContextMenu>
              </Button>            
        </Grid>
</Page>
and BoolToStarLengthConverter always returns "1*".
When I remove the converter the error does not appear any more.
Am I doing something wrong?

Thanks
Ivan
 
User avatar
sfernandez
Site Admin
Posts: 1915
Joined: 22 Dec 2011, 19:20

Re: "Native type is not registered" when using Value convert

30 Nov 2015, 11:57

Hi,

There is nothing wrong in your side, it is a known bug in our C# API, that doesn't expose the GridLength type correctly. As you can see in our Trello board: https://trello.com/c/mvAxcWoI, this issue is going to be fixed for the following release.

Sorry for the inconvinience.

Who is online

Users browsing this forum: No registered users and 1 guest