"Native type is not registered" when using Value converter
Posted: 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"
and BoolToStarLengthConverter always returns "1*".
When I remove the converter the error does not appear any more.
Am I doing something wrong?
Thanks
Ivan
When I use a value converter inside the Width of a GridColumn i get "InvalidOperationException: Native type is not registered"
Code: Select all
<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>
When I remove the converter the error does not appear any more.
Am I doing something wrong?
Thanks
Ivan