我的WPF UserControl包含两个堆栈面板,每个面板包含标签,文本框和单选按钮.
我想使用尽可能少的代码将VerticalAlignment属性设置为Center我的UserControl中的所有控件.
现在我有以下解决方案:
VerticalAlignment="Center"每个控制FrameworkElement并直接应用它这三个解决方案需要太多代码.
有没有其他方法可以写这个?
我希望定义样式FrameworkElement会自动将属性设置为所有控件,但它不起作用.
这是我当前XAML的片段(我省略了第二个,非常相似的堆栈面板):
<UserControl.Resources>
<Style x:Key="BaseStyle" TargetType="FrameworkElement">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</UserControl.Resources>
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource BaseStyle}" Text="Value:" />
<RadioButton Style="{StaticResource BaseStyle}">Standard</RadioButton>
<RadioButton Style="{StaticResource BaseStyle}">Other</RadioButton>
<TextBox Style="{StaticResource BaseStyle}" Width="40"/>
</StackPanel>
</Grid>
Run Code Online (Sandbox Code Playgroud)
编辑:
Re Will的评论:我真的很讨厌在代码隐藏中编写控件格式代码的想法.XAML应该足以实现这种非常简单的用户控制.
Re Muad'Dib的评论:我在用户控件中使用的控件来源于FrameworkElement,所以这不是问题.
我正在尝试为我的drupal网站添加额外的安全性.我删除了登录块,但也可以通过http://mydrupalsite.com/user访问
它仍然需要允许管理员帐户,但有没有办法用htaccess或比drupal开箱即用的更强大的东西来保护这个单页?
我一直在阅读有关此事的帖子,但仍无法找到答案.有没有人想出如何预加载字体以停止闪烁/延迟?
干杯.埃里克
我试图使用jQuery UI框架重新排序动态创建的CKEditors列表,但我遇到了编辑器释放的问题.当我刚刚使用a时<textarea>,它工作得很好,但现在,在拖动操作完成后,它不会让用户写任何文本.
这是Javascript代码:
$(function() {
$("#list").sortable({
placeholder: 'ui-state-highlight'
});
$("#list").disableSelection();
for (i=0;i<10;i++)
{
addEditor();
}
});
function addEditor()
{
alert("Hello");
var editor_fields = document.editors.elements["editor[]"];
var editorAmount = 0;
if (editor_fields.length)
{
editorAmount = editor_fields.length;
}
else
{
editorAmount = 1;
}
var newElem = $('#editor_container' + editorAmount).clone().attr('id', 'editor_container' + (editorAmount + 1));
newElem.html("<textarea class='editor' name='editor[]' id='editor" + (editorAmount + 1) + "' rows='4' cols='30'></textarea>");
$("#editor_container" + editorAmount).after(newElem);
$("#editor" + (editorAmount + 1)).ckeditor();
}
Run Code Online (Sandbox Code Playgroud)
这是HTML代码:
<form name="editors">
<ul id="list"> …Run Code Online (Sandbox Code Playgroud) 我需要安装一些文件C:\Documents and Settings\currentUser\SomeFolder.我找不到一些buildin函数/变量.
有人可以帮我/告诉我<DirectoryRef Id="TARGETDIR">我的问题的结构或解决方案吗?
谢谢.
有人可以帮助将此代码转换为纯JS:
$(document).ready(function() {
$("textarea").bind("keydown", function(event) {
var textarea = $(this).get(0);
//further will need only textarea and event vars
}
});
Run Code Online (Sandbox Code Playgroud)
我不关心跨浏览器兼容性,只要它适用于当前的FF和Chrome.
在我的应用程序中,我创建了TList类型列表,用于存储整数或双精度:
TKList<T> = class
private
FItems: TList<T>;
function GetItem(Index: Integer): T;
procedure SetItem(Index: Integer; const Value: T);
function GetMaxValue(): T;
function GetMinValue(): T;
public
constructor Create; overload;
constructor Create(const AKList: TKList<T>); overload;
destructor Destroy; override;
procedure Assign(const AKList: TKList<T>);
function Add(const AValue: T): Integer;
procedure Clear;
function Count: Integer;
procedure Invert;
function ToString: string; override;
function Info: string;
property Values[Index: Integer]: T read GetItem write SetItem; default;
end;
Run Code Online (Sandbox Code Playgroud)
如何实现Invert()过程来反转泛型List中的值?
提前致谢.
我正在尝试做一个简单的字符串操作.输入是"谋杀",我想得到"谋杀".
我试过这个
String str = "murder";
StringBuffer buf = new StringBuffer(str);
// buf is now "murder", so i append the reverse which is "redrum"
buf.append(buf.reverse());
System.out.println(buf);
Run Code Online (Sandbox Code Playgroud)
但现在我得到"redrumredrum"而不是"murderredrum".
谁能解释我的程序有什么问题?谢谢.
我可以在登录Drupal时将用户发送回上一页吗?
他可以从我网站的不同页面登录.不仅有一个登录节点.我想把他送回他所在的页面.
谢谢