Question

<Style x:Key="GridColumnDefaultStyle">
    <Setter Property="ColumnDefinition.Width" Value="1*"/>
</Style>

The code above is in a generic.xaml file to be used throughout my application by grids on pages. This gives a design-time "exception" in generic.xaml that states:

'1*' String cannot be converted to length.

But even worse, my pages don't format correctly in the WPF designer and the designer is disabled (although the visual designer, not the xaml designer). It's very annoying in designing the pages...

Anybody experiences this same behaviour? And have any solutions / workarounds?

BTW: run-time -> no problems, behaves as desired / expected...

Était-ce utile?

La solution

This may helps you:

<Grid>
    <Grid.Resources>
        <Style x:Key="GridColumnDefaultStyle" TargetType="ColumnDefinition">
            <Setter Property="Width" Value="1*"/>
        </Style>
    </Grid.Resources>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Style="{StaticResource GridColumnDefaultStyle}"/>
        <ColumnDefinition Width="2*"/>
    </Grid.ColumnDefinitions>
</Grid>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top