English 中文(简体)
• 如何使集装箱部件自动化,以确保为可见问题提供矿藏?
原标题:How to autosize container elements to ensure min-height for visibility issues?

我有一件物品,想展示我的习俗。

就像

String A
String B
String C

范围 长期而言,A和B可以是多个方面,但C可起作用。 我想到的是Hala=“Auto”和一个DockPanel。 然而,A号楼的高度应该如此。 还与Sting B公司合作。

这是我迄今提出的:

<ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" Background="Black">
    <ItemsControl Name="ItemsControl1">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <Border BorderBrush="#FF126eb1" BorderThickness="1.5" CornerRadius="8,8,8,8" Background="#FF074e84" Width="350" Height="Auto">
                    <DockPanel Width="350" Margin="0,10,0,0" Height="Auto" Background="Transparent">
                        <Canvas DockPanel.Dock="Top" Height="Auto" Width="350" Margin="0,10,0,0">
                            <TextBlock Text="{Binding Headline}" Canvas.Left="5" Canvas.Top="5" Foreground="White" FontSize="15" FontWeight="Bold" MaxWidth="340" TextWrapping="Wrap" Height="Auto"/>
                        </Canvas>
                        <Canvas DockPanel.Dock="Top" Height="Auto" Width="350" Margin="0,10,0,0">
                            <TextBlock Text="{Binding Description}" Canvas.Left="5" Canvas.Top="20" Foreground="White" FontSize="13" MaxWidth="340" TextWrapping="Wrap" Height="Auto" />
                        </Canvas>
                        <Canvas DockPanel.Dock="Top" Width="350" Height="40" Margin="0,10,0,0" Background="Transparent">
                            <TextBlock Text="{Binding DeadlineOn, StringFormat= Deadline: {0} }" Canvas.Left="5" Canvas.Top="5" Foreground="White"/>
                             <!-- and other controls -->
                        </Canvas>
                    </DockPanel>
                </Border>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</ScrollViewer>

遗憾的是,只有微额资产在Sting A和B中处于高位。

如果每个项目的高度不为人所知,我如何能够做到这一点?

最佳回答

有许多布局要素,虽然这给你很多选择,但很难确定哪一个布局要素是在特定情况下使用的权利。

In general, a Canvas is useful for its convenient fixed positioning capabilities. It allows anything to be placed anywhere using the Canvas.Left and Canvas.Top attached properties. But because the size of a Canvas is fixed and doesn t depend on its children, it s difficult to use for variable-sized content. The parent of the Canvas is "insulated" from the size of the children of the Canvas, and this is actually useful in some situations.

相比之下,<代码>Grid迄今为止是灵活的布局要素,并且有助于排出有或无间隙的电网。 因此,在你创建新的<代码>Window或UserControl时,其缺席。 但是,与<条码>Canvas不同,在未指明且未延伸到现有空间时,<条码>Grid>/code>的大小是其所有子女的大小。

www.un.org/Depts/DGACM/index_spanish.htm 还有一些财产,如果它有数名儿童,而且他们被排入牢房或一栏,他们就相互取而代之的是overed,后来子女在Z-order中的比例更高。 这只是一个<条码>Canvas,但没有<条码>Canvas.Left和<条码>Canvas.Top,我们如何能够对子女的地位进行严格控制?

举一个例子。 此处为<条码>Canvas,两条斜体为平方,空间不多,<条码>。 做同样的事情:

<Grid>
    <StackPanel>
        <Canvas Height="120">
            <Rectangle Canvas.Left="10" Canvas.Top="10" Height="100" Width="100" Fill="Red"/>
            <Rectangle Canvas.Left="120" Canvas.Top="10" Height="100" Width="100" Fill="Green"/>
        </Canvas>
        <Grid HorizontalAlignment="Left">
            <Rectangle Margin="10,10,10,10" Height="100" Width="100" Fill="Red" HorizontalAlignment="Left"/>
            <Rectangle Margin="120,10,10,10" Height="100" Width="100" Fill="Green" HorizontalAlignment="Left"/>
        </Grid>
    </StackPanel>
</Grid>

在第一种情况下,我们必须具体说明<代码>Canvas的高度,因为它确实是自动的。 在第二种情况下,我们使用<代码>Margin至模拟绝对定位Grid的大小,以适应其内容。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签