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
最满意答案
当一个进程(任何进程,而不仅仅是一个.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启动后启动C#应用程序(How to ensure C# application starts after windows is booted compltely)[2022-12-12]
如果您可以使用用户的凭据配置Windows服务(您知道用户的密码或可以要求用户配置服务),您可以使用用户的凭据安装Windows服务。 选择自动延迟启动( 在此处说明)。 即使用户尚未登录,也会使用他的凭据启动此服务。 您可以使用Startup文件夹 您可以使用注册表运行\ regedit 打开 [HKEY_CURRENT_USER \软件\微软\的Windows \ CurrentVersion \运行] 对于要启动的每个程序,使用描述性名称自动创建新的字符串值,并将字符串的值设置为程序可执行文件 If ... -
保存应用程序状态AIR(Saving application state AIR)[2022-01-26]
您需要确保所有类都是可序列化的 ,然后序列化它们并在退出应用程序时将它们保存到文件中。 再次启动应用程序时,可以反序列化对象 - 实际上是实例化所有对象并再次分配其以前的所有属性。 由于您的代码必须遵守一些规则,因此很难适应现有应用程序。 例如,您的类构造函数不能接受任何参数,并且您的对象必须具有公共属性,否则它们将不会被序列化。 本文可以帮助您快速了解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%必要的,那么在流程运行时,您需要不断保存这些信息 - 绝对没有保证您有机会在以后这样做。 这 ...
-
C#应用程序保存(C# Application Saving)[2022-04-15]
如果所有控件都通过数据集绑定到数据,那么您可以将基础数据集序列化和反序列化到XML文件或从XML文件反序列化,以创建某种“脱机数据文件存储”功能。 但是,在将此类功能引入应用程序之前,您应该考虑通过在应用程序客户端中保留此类已保存状态而可能创建的所有潜在数据库同步问题。 如果您真的只想保留窗口布局属性(例如窗口大小,网格列宽,排序列,拆分器位置等),则必须仅关注这些属性。 这是一个类似讨论的主题 If all the controls are bound to data through datasets y ... -
保存应用程序状态(Saving Application state)[2022-10-17]
您不能使用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 ...
-
应用程序崩溃 - iOS(Crash on application - iOS)[2020-09-30]
CRASH(SIGABRT)的一些事情意味着你崩溃了,因为某些东西导致了中止。 崩溃的线程跟踪似乎是由未处理的语言异常引起的异常。 在线程5中,看起来这个异常是由于你的Util.swift文件调用Util.storePurchaseRecord(AnyObject!) - >()(Util.swift:535)引起的。 来自AppViewController。(validateReceipt(AppViewController) - >(() - >()) - >())。(闭包#1)(AppViewCont ...