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

有帮助吗?

解决方案

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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top