Silverlight4中没有Grid.SharedSizeGroup。您如何解决此问题?
例如:我有一个用于ListBox.ItemTemplate的DataTemplate,其中包含一个包含两列的网格,我希望这两列的宽度相同,并且第一列需要具有自动宽度。
发布于 2011-10-13 16:38:16
SharedSize Grid with Silverlight -还没有测试过,但看起来很有用。
发布于 2011-02-04 23:34:51
请在此处投票支持此功能:
http://dotnet.uservoice.com/forums/4325-silverlight-feature-suggestions/suggestions/1454947-sharedsizegroup
还有这里:
http://connectppe.microsoft.com/VisualStudio/feedback/details/518461/sharedsizegroup-should-be-available-in-silverlight
发布于 2011-11-15 20:38:46
共享大小调整最好使用Silverlight中的元素属性绑定来实现。只需将所有共享大小的元素绑定到另一个元素的宽度/高度。
编辑:我给出了一个简单的例子来说明我的意思。当你在问题中说你想要自动调整大小时,我不确定你使用星形大小是什么意思-
<Grid Height="400"
Width="600"
Background="Gray">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button x:Name="parent"
Content="CHANGE ME TO ADJUST THE COLUMN SIZE"
Grid.Column="0"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Background="Red" />
<Button Width="{Binding ActualWidth, ElementName=parent}"
Grid.Column="1"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Background="Blue" />
<Button Width="{Binding ActualWidth, ElementName=parent}"
Grid.Column="2"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Background="Yellow" />
</Grid>HTH
https://stackoverflow.com/questions/4188679
复制相似问题