【发布时间】:2016-02-15 21:40:51
【问题描述】:
我正在使用嵌套网格。在主网格中我有两个单选按钮,而在第二个中我有两个额外的单选按钮和其他控件..
我希望总网格为 3 行 3 列。
相关代码为:
<xctk:WizardPage Name="Page3" PageType="Interior"
Title="Stages"
Background="#FF27E0E0">
<xctk:WizardPage.CanSelectNextPage>
<MultiBinding Converter="{StaticResource NextFromPage3}">
<Binding ElementName="HR" Path="IsChecked" Mode="OneWay"/>
<Binding ElementName="LR" Path="IsChecked" Mode="OneWay"/>
<Binding ElementName="yes" Path="IsChecked" Mode="OneWay"/>
<Binding ElementName="no" Path="IsChecked" Mode="OneWay"/>
</MultiBinding>
</xctk:WizardPage.CanSelectNextPage>
<Grid ShowGridLines="True" Margin="-5 -10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label x:Name="qual" Content="Select Quality:" FontSize="13.333" Margin="5 10" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<RadioButton x:Name="HR" Content="High-Resolution" FontSize="13.333" Grid.Column="1" Margin="5 10" VerticalAlignment="Top"/>
<RadioButton x:Name="LR" FontSize="13.333" Content="Low-Resolution" Grid.Column="2" Margin="5 10" VerticalAlignment="Top"/>
<Grid Grid.Row="1">
<Grid.Visibility>
<MultiBinding Converter="{StaticResource FilterConverter}">
<Binding ElementName ="HR" Path="IsChecked" Mode="OneWay"/>
<Binding ElementName ="LR" Path="IsChecked" Mode="OneWay"/>
</MultiBinding>
</Grid.Visibility>
<Label x:Name="symbol" Content="Select Symbol:" Grid.Row ="1" Grid.Column="0" FontSize="13.333" Margin="5 10" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<ComboBox x:Name="symbolsCmbBox" FontSize="13.333" Grid.Row="1" Grid.Column="1" Margin="5 10" VerticalAlignment="Top" HorizontalAlignment="Left" ItemTemplate="{StaticResource cmbTemplate}" IsSynchronizedWithCurrentItem="True" SelectedIndex="0">
<ComboBox.ItemsSource>
<MultiBinding Converter="{StaticResource SymbolComboboxItemsFilter}">
<Binding ElementName ="HR" Path="IsChecked" Mode="OneWay"/>
<Binding ElementName ="LR" Path="IsChecked" Mode="OneWay"/>
</MultiBinding>
</ComboBox.ItemsSource>
</ComboBox>
<Label x:Name="isExists" Content="Select Yes if process will perform:" Grid.Row ="2" FontSize="13.333" Margin="5 10" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<RadioButton x:Name="yes" Content="Yes" FontSize="13.333" Grid.Row="2" Grid.Column="1" Margin="5 10" VerticalAlignment="Top"/>
<RadioButton x:Name="no" Content="No" FontSize="13.333" Grid.Row="2" Grid.Column="2" Margin="5 10" VerticalAlignment="Top"/>
</Grid>
</Grid>
以上代码是 WPF 工具包中存在的向导的一部分。 我与上面那个控件的嵌套网格问题没有按预期定位。 虽然我只使用了一个主网格,但这个问题并没有发生,但我出于其他原因需要嵌套网格..
编辑-第一个答案: 我希望主网格是第一行(3 列),内部网格将从第二行开始,总共包含两行(3 列),那么如何指定呢?
编辑-第二个答案:
第一行(主网格)与第二行和第三行(内网格)不直 - 似乎主网格的两个单选按钮都仅位于 column=2 上,即使它看起来不是xml代码。我的代码现在就像出现在下面的第二个答案中一样。
感谢您的建议!
【问题讨论】:
标签: c# wpf grid nested wpftoolkit