我只想在左边流动文本,在右边有一个帮助框.
帮助框应该一直延伸到底部.
如果您取出下面的外部StackPanel,它的效果很好.
但由于布局的原因(我正在动态插入UserControl),我需要包装StackPanel.
如何让GroupBox扩展到StackPanel的底部,你可以看到我已经尝试过:
XAML:
<Window x:Class="TestDynamic033.Test3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test3" Height="300" Width="600">
<StackPanel
VerticalAlignment="Stretch"
Height="Auto">
<DockPanel
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Height="Auto"
Margin="10">
<GroupBox
DockPanel.Dock="Right"
Header="Help"
Width="100"
Background="Beige"
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch"
Height="Auto">
<TextBlock Text="This is the help that is available on the news screen." TextWrapping="Wrap" />
</GroupBox>
<StackPanel DockPanel.Dock="Left" Margin="10" Width="Auto" HorizontalAlignment="Stretch">
<TextBlock Text="Here is the news that should wrap around." TextWrapping="Wrap"/>
</StackPanel>
</DockPanel>
</StackPanel>
</Window>
Run Code Online (Sandbox Code Playgroud)
谢谢Mark,使用DockPanel而不是StackPanel清理它.一般来说,我发现自己现在越来越多地使用DockPanel进行WPF布局,这里是固定的XAML:
<Window x:Class="TestDynamic033.Test3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test3" Height="300" Width="600" MinWidth="500" …Run Code Online (Sandbox Code Playgroud) public struct Char
{
public const char MaxValue = (char)0xffff;
public const char MinValue = '\0';
}
Run Code Online (Sandbox Code Playgroud)
为什么不将这些字段设为静态?什么为它总是为每个char分配额外的内存,而这两个值是永久的?
编辑:我不知道怎么会忘记静态的静态!
我正在观察std :: map :: clear()的奇怪行为.这个方法应该在调用时调用元素的析构函数,但是在调用clear()之后仍然可以访问内存.
例如:
struct A
{
~A() { x = 0; }
int x;
};
int main( void )
{
std::map< int, A * > my_map;
A *a = new A();
a->x = 5;
my_map.insert( std::make_pair< int, *A >( 0, a ) );
// addresses will be the same, will print 5
std::cout << a << " " << my_map[0] << " " << my_map[0]->x << std::endl;
my_map.clear();
// will be 0
std::cout << a->x << std::endl; …Run Code Online (Sandbox Code Playgroud) 我有两个应用程序,一个是控制台应用程序,另一个是ASP.NET应用程序.他们都需要知道相同的appSettings和connectionStrings.理想情况下,我想使用app.config/web.config文件的configSource属性将其指向一个中心位置.例如
<connectionStrings configSource="D:\connectionStrings.config"/>
<appSettings configSource="D:\appSettings.config"/>
Run Code Online (Sandbox Code Playgroud)
然而,这失败了一个错误:
configSource属性无效:configSource'D:\ appSettings.config'无效.它必须引用与配置文件相同的目录或子目录中的文件.
无论如何仍然使用配置管理器appSettings/connectionStrings并从外部位置获取值?
我很高兴不得不添加代码来完成它,但我不想替换整个配置管理器系统.
我遇到了在.NET中序列化大量对象的问题.对象图非常大,使用了一些新的数据集,所以我得到:
System.Runtime.Serialization.SerializationException
"The internal array cannot expand to greater than Int32.MaxValue elements."
Run Code Online (Sandbox Code Playgroud)
还有其他人达到这个限制吗?你是怎么解决的?
如果可能的话我仍然可以使用内置的序列化机制会很好,但似乎只需要自己滚动(并保持与现有数据文件的向后兼容性)
对象都是POCO,并且正在使用它们进行序列化BinaryFormatter.被序列化的每个对象实现ISerializable选择性地序列化其成员(其中一些在加载期间重新计算).
对于MS来说,这看起来像是一个未解决的问题(详情请参见此处),但它已被解决为Wont Fix.细节是(来自链接):
对于具有超过~1320万个对象的对象图,二进制序列化失败.尝试这样做会导致ObjectIDGenerator.Rehash中出现异常,并引用一个引用Int32.MaxValue的误导性错误消息.
在检查SSCLI源代码中的ObjectIDGenerator.cs后,似乎可以通过在sizes数组中添加其他条目来处理更大的对象图.请参阅以下行:
Run Code Online (Sandbox Code Playgroud)// Table of prime numbers to use as hash table sizes. Each entry is the // smallest prime number larger than twice the previous entry. private static readonly int[] sizes = {5, 11, 29, 47, 97, 197, 397, 797, 1597, 3203, 6421, 12853, 25717, 51437, 102877, 205759, 411527, 823117, 1646237, 3292489, 6584983};但是,如果序列化适用于任何合理大小的对象图,那将是很好的.
我们编写了一个创建PDF文件的软件.我们如何检查生成的pdf文件是否是PDF/A兼容性?有没有可用的测试套件?
如果知道Open-Office等其他产品是否能生成PDF/A兼容性文件,也会很高兴.
如何从URL字符串中获取域名?
+----------------------+------------+
| input | output |
+----------------------+------------+
| www.google.com | google |
| www.mail.yahoo.com | mail.yahoo |
| www.mail.yahoo.co.in | mail.yahoo |
| www.abc.au.uk | abc |
+----------------------+------------+
Run Code Online (Sandbox Code Playgroud)
有关:
我是DataBinding的新手,只是阅读它.我想做的是以下内容:
我有一个包含许多子控件的StackPanel:
<StackPanel Orientation="Horizontal">
<TextBox x:Name="textbox1" Width="100">1</TextBox>
<TextBox x:Name="textbox2" Width="100">2</TextBox>
<TextBox x:Name="textbox3" Width="100">3</TextBox>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)
可以通过代码更改文本框的可见性属性.现在,如果所有TextBox都设置为Visibility = Collapsed,我还希望StackPanel.Visibility设置为Collapsed,但如果显示一个或多个TextBox(Visibility = Visible),则StackPanel.Visibility也应设置为Visible.
这可以通过简单的DataBinding实现,还是必须在C#代码中实现此功能?
是否有可能在vsjitdebugger显示的调试器列表中包含WinDbg,当后者被配置为HKLM中的默认debuuger时......\AeDebug?
理想情况下,我希望能够在vsjitdebugger中的选项列表中包含更多命令行,这些命令行在进程遇到未处理的异常时可用:使用DrWatson或使用WinDbg保存minidump以供以后检查.
我需要按字段名称映射ObjectV1和ObjectV2之间的所有字段值和子集合.ObjectV2与ObjectV1位于不同的namspace中.
模板ClassV1和ClassV2之间的继承已被打折扣,因为这两个类需要独立发展.我已经考虑过使用反射(慢速)和二进制序列化(也很慢)来执行公共属性的映射.
有首选方法吗?还有其他选择吗?
.net ×4
c# ×2
wpf ×2
xaml ×2
autolayout ×1
autoresize ×1
c++ ×1
char ×1
data-binding ×1
debugging ×1
dockpanel ×1
pdf ×1
pdfa ×1
reflection ×1
regex ×1
stdmap ×1
test-suite ×1
url ×1
windows ×1