首页 \ 问答 \ Stackpanels并排(Stackpanels side by side)

Stackpanels并排(Stackpanels side by side)

我想把stackPanels放在一起。 然后在每个堆栈面板中,有不同的控件。 现在第一个堆栈面板正在工作。 它有文本块和文本框。 现在我想在第二个堆栈面板上添加一个按钮,依此类推。 问题是第二个面板没有显示按钮的内容。 不知道为什么?

<StackPanel Orientation="Vertical">
    <StackPanel Orientation="Horizontal" Width="300" HorizontalAlignment="Left" Margin="10">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25"></RowDefinition>
                        <RowDefinition Height="25"></RowDefinition>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Column="0" Grid.Row="0" Text="Year" TextAlignment="Center"></TextBlock>
                    <TextBlock Grid.Column="1" Grid.Row="0" Text="Week" TextAlignment="Center"></TextBlock>
                    <TextBlock Grid.Column="2" Grid.Row="0" Text="File Location" TextAlignment="Center"></TextBlock>
                </Grid>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="0" Margin="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Button Grid.Column="0" Grid.Row="0">
                        <TextBlock Text="Get Informations" TextWrapping="Wrap" TextAlignment="Center"></TextBlock>
                    </Button>
                </Grid>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="0"></StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="1"></StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="1"></StackPanel>
        </Grid>

    </StackPanel>
</StackPanel>

I want to put stackPanels side by side. Then in each stack panel, there are different controls. Now the first stack panel is working. It has textblocks and text boxs. Now I want to add a button on the second stack panel and so on. The question is that the second panel doesn't show the button's content. Not sure why?

<StackPanel Orientation="Vertical">
    <StackPanel Orientation="Horizontal" Width="300" HorizontalAlignment="Left" Margin="10">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25"></RowDefinition>
                        <RowDefinition Height="25"></RowDefinition>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Column="0" Grid.Row="0" Text="Year" TextAlignment="Center"></TextBlock>
                    <TextBlock Grid.Column="1" Grid.Row="0" Text="Week" TextAlignment="Center"></TextBlock>
                    <TextBlock Grid.Column="2" Grid.Row="0" Text="File Location" TextAlignment="Center"></TextBlock>
                </Grid>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="0" Margin="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Button Grid.Column="0" Grid.Row="0">
                        <TextBlock Text="Get Informations" TextWrapping="Wrap" TextAlignment="Center"></TextBlock>
                    </Button>
                </Grid>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="0"></StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="1"></StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="1"></StackPanel>
        </Grid>

    </StackPanel>
</StackPanel>

原文:https://stackoverflow.com/questions/40983714
更新时间:2023-07-02 06:07

最满意答案

当一个进程(任何进程,而不仅仅是一个.Net进程)终止时, 没有 100%可靠的机制可以用来保存数据(或者做其他任何事情) - 大多数进程可以在任何时候使用“结束进程“选项,当发生这种情况时,进程立即被终止。 作为一个更极端的例子,电源线可以从机器背面拔出。

如果该数据对象不是100%必须保持最新状态,并且一旦进程被终止,那么AppDomain.UnhandledException事件就足够了。

如果这绝对是100%必要的,那么在流程运行时,您需要不断保存这些信息 - 绝对没有保证您有机会在以后这样做。 这就是数据库的运作方式,只有某些格式的记录(例如事务日志)以某种格式记录到磁盘后,才会有事务返回。 这就是D在ACID中所代表的意思。


There is no 100% reliable mechanism that you can use to save data (or do anything else for that matter) when a process (any process, not just a .Net process) terminates - most processes can be terminated at any point using the "End Process" option in the task manager, when this happens the process is immediately killed. As a more extreme example the power cord could be pulled out the back of the machine.

If its not 100% necessary that this data object be up-to-date and saved once the process is killed then the AppDomain.UnhandledException Event may suffice.

If its absolutely 100% necessary that this be the case then you need to be continuously saving this information as the process is running - there is absolutely no guarentee that you will get a chance to do it at a later date. This is how databases operate, no transaction returns until some record of the change has been recorded to disk in some format (e.g. a transaction log). This is what the D stands for in ACID.

相关问答

更多
  • 您可以使用Cordova“暂停”事件,该事件会在您的应用程序发送到后台时触发。 document.addEventListener("pause", yourCallbackFunction, false); http://docs.phonegap.com/en/2.9.0/cordova_events_events.md.html#pause 但是,您需要查看iOS怪癖以确保它们适合您的用例。 You can use the Cordova "pause" event, which is trigger ...
  • 如果您可以使用用户的凭据配置Windows服务(您知道用户的密码或可以要求用户配置服务),您可以使用用户的凭据安装Windows服务。 选择自动延迟启动( 在此处说明)。 即使用户尚未登录,也会使用他的凭据启动此服务。 您可以使用Startup文件夹 您可以使用注册表运行\ regedit 打开 [HKEY_CURRENT_USER \软件\微软\的Windows \ CurrentVersion \运行] 对于要启动的每个程序,使用描述性名称自动创建新的字符串值,并将字符串的值设置为程序可执行文件 If ...
  • 您需要确保所有类都是可序列化的 ,然后序列化它们并在退出应用程序时将它们保存到文件中。 再次启动应用程序时,可以反序列化对象 - 实际上是实例化所有对象并再次分配其以前的所有属性。 由于您的代码必须遵守一些规则,因此很难适应现有应用程序。 例如,您的类构造函数不能接受任何参数,并且您的对象必须具有公共属性,否则它们将不会被序列化。 本文可以帮助您快速了解as3中的对象序列化: http : //jacksondunstan.com/articles/1642 You need to make sure al ...
  • 你正在清理你的数据库连接,即using或try..finally ? 使用perfmon.exe在应用程序运行时查看性能计数器类别'.Net Data Provider for Sql Server'中的计数器,并检查您正在使用的连接数和池数。 如果这种情况持续增长,则表明您正在泄漏可能导致此错误的连接。 Are you cleaning up your database connections correctly, i.e. using using or try..finally? Have a look ...
  • 当一个进程(任何进程,而不仅仅是一个.Net进程)终止时, 没有 100%可靠的机制可以用来保存数据(或者做其他任何事情) - 大多数进程可以在任何时候使用“结束进程“选项,当发生这种情况时,进程立即被终止。 作为一个更极端的例子,电源线可以从机器背面拔出。 如果该数据对象不是100%必须保持最新状态,并且一旦进程被终止,那么AppDomain.UnhandledException事件就足够了。 如果这绝对是100%必要的,那么在流程运行时,您需要不断保存这些信息 - 绝对没有保证您有机会在以后这样做。 这 ...
  • 如果所有控件都通过数据集绑定到数据,那么您可以将基础数据集序列化和反序列化到XML文件或从XML文件反序列化,以创建某种“脱机数据文件存储”功能。 但是,在将此类功能引入应用程序之前,您应该考虑通过在应用程序客户端中保留此类已保存状态而可能创建的所有潜在数据库同步问题。 如果您真的只想保留窗口布局属性(例如窗口大小,网格列宽,排序列,拆分器位置等),则必须仅关注这些属性。 这是一个类似讨论的主题 If all the controls are bound to data through datasets y ...
  • 您不能使用Application.onTerminate()因为无法保证将调用它。 出于同样的原因,您也无法使用Activity onStop()或onDestroy() 。 因此,您必须在每个Activity中的onPause()方法中进行保存。 每个Activity都会调用您在Application创建的saveState() 。 由于这将被大量调用,因此您需要使其尽可能高效,理想情况下只需将更改的数据写入持久存储。 您还应注意, onSaveInstanceState()仅应用于存储Activity的 ...
  • void Main() { // Settings in a Text File string path1 = @"C:\\Dev\\settings.txt"; string setting1; string setting2; setting1 = "foo"; setting2 = "bar"; SaveSettingsToTextFile(path1, setting1, setting2); setting1 = ""; se ...
  • 我相信Android会自动执行此操作。 我们正在开发一款应用。 当我点击主页按钮然后他们回到应用程序时,它会从我离开的活动开始。 我们还没有编写任何代码来实现这一目标。 它似乎工作。 I believe Android does this automatically. We have an app that we are working on. When I click the home button and them come back to the app, it starts in the activ ...
  • CRASH(SIGABRT)的一些事情意味着你崩溃了,因为某些东西导致了中止。 崩溃的线程跟踪似乎是由未处理的语言异常引起的异常。 在线程5中,看起来这个异常是由于你的Util.swift文件调用Util.storePurchaseRecord(AnyObject!) - >()(Util.swift:535)引起的。 来自AppViewController。(validateReceipt(AppViewController) - >(() - >()) - >())。(闭包#1)(AppViewCont ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)