开发者

Silverlight 4.0: GridSplitter is splitting incorrectly

Please help, the grid splitter in not splitting correctly to the right, the testing button content. Is there anything I've missed out in using grid splitter?

<local:LayoutTemplateSelector Content="{Binding}">
                    <local:LayoutTemplateSelector.VerticalLeftRight>
                        <D开发者_运维百科ataTemplate>
                            <Grid ShowGridLines="True" Background="Orange"  Height="{Binding Height}" 
                                  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width=".25*"/>
                                    <ColumnDefinition Width="10" />
                                    <ColumnDefinition Width=".70*"/>

                                </Grid.ColumnDefinitions>
                                <Button  Grid.Column="0" Content="Test"  Width="{Binding ChartWidth}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
                                <sdk:GridSplitter Grid.Column="1" ShowsPreview="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                                <Button Content="Testing"  Width="{Binding SectionWidth}"  Grid.Column="2"
                                    HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                    HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
                            </Grid>
                        </DataTemplate>
                    </local:LayoutTemplateSelector.VerticalLeftRight>
                </local:LayoutTemplateSelector>


You need to use fixed width for the first column and star for the remaining one.

<Grid.ColumnDefinitions>
             <ColumnDefinition Width="200" MinWidth="50" MaxWidth="250"/>
             <ColumnDefinition Width="10" />
             <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

It is usually a good idea (but not essential) to set min and max values for the first column to keep it looking sensible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜