简单的问题.如何更改关闭,最小化,最大化按钮的图标.我可以在Winforms和WPF中执行此操作吗?
我对下面的标记有两个问题:
<Popup>
<Button x:Name="button"/>
</Popup>
Run Code Online (Sandbox Code Playgroud)
VisualTreeHelper.GetParent(button)返回null?Popup的UIElement?我有一个Dictionary<string, FieldDefinition>依赖属性,当我将它绑定到WPF列表框时,我希望它只打印字符串(而不是FieldDefinition).
有没有办法做到这一点?
我在.xaml中使用此代码,因为我创建了一个用户定义的控件(TextBox)NumericTextbox:
<local:NumericTextBox Grid.Column="1"
local:NumericTextBox.Mask="Decimal"
local:NumericTextBox.MaximumValue="55"
local:NumericTextBox.MinimumValue="0"
Name="abc"
Grid.Row="0"
Text="{Binding Path=IPAddressProperty}" />
Run Code Online (Sandbox Code Playgroud)
我想NumericTextbox在.xaml.cs中访问它,我必须在.xaml.cs文件中给出最小值和最大值,
有人可以帮帮我吗?
我只是遇到了AttachedPropertyBrowsableWhenAttributePresentAttribute,但是想不出它什么时候会有用.任何理想?
我对WPF很新.我经常发现自己正在努力获得一堆子控件组合宽度以匹配给定的父容器.如下所示:
<ListBox x:Name="BrugereListBox" Grid.Column="0" Grid.Row="3" DataContext="{DynamicResource Brugere}"
ItemsSource="{Binding}"
PreviewMouseLeftButtonDown="BrugereListBox_MouseLeftButtonDown"
PreviewMouseMove="BrugereListBox_PreviewMouseMove"
>
<ListBox.ItemTemplate >
<DataTemplate >
<Border BorderBrush="Black" BorderThickness="1" Margin="2">
<StackPanel Orientation="Vertical" IsEnabled="True"
PreviewMouseLeftButtonDown="StackPanel_PreviewMouseLeftButtonDown">
<StackPanel Orientation="Horizontal" >
<Label>Navn</Label>
<TextBox Text="{Binding Name}"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label>Password</Label>
<TextBox Text="{Binding Password}"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label>Email</Label>
<TextBox Text="{Binding Email}"></TextBox>
</StackPanel>
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我有兴趣获得stackpanel的子节点的宽度:
<StackPanel Orientation="Horizontal" >
<Label>Navn</Label>
<TextBox Text="{Binding Name}"></TextBox>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)
匹配的宽度
<ListBox x:Name="BrugereListBox"
Run Code Online (Sandbox Code Playgroud)
像这样的场景的任何通用解决方案?
有没有办法限制在项目控件中显示的行数。?
我有一个绑定到 Items 控件的可观察字符串集合。我想将要显示的行数限制为一。集合可以有多个。
谢谢,
在我们的wpf应用程序中,我们在窗口的构造函数中添加事件,如下所示:
AddHandler(Keyboard.KeyUpEvent, (KeyEventHandler)HandleKeyDownEvent);
this.Closing += new System.ComponentModel.CancelEventHandler(WindowF_Closing);
this.Loaded += new RoutedEventHandler(WindowF_Loaded);
Run Code Online (Sandbox Code Playgroud)
在关闭事件中删除这些事件以便放置窗口是一个好主意:
RemoveHandler(Keyboard.KeyUpEvent, (KeyEventHandler)HandleKeyDownEvent);
this.Closing -= new System.ComponentModel.CancelEventHandler(WindowF_Closing);
this.Loaded -= new RoutedEventHandler(WindowF_Loaded);
Run Code Online (Sandbox Code Playgroud) 我正在开发我在Windows上的第一个GUI应用程序.
我有一个WPF GUI到一个复制文件的小型C#实用程序.单击按钮进行复制时,我显然不希望GUI挂起.因此,我启动一个新线程来运行复制文件的方法.我认为到目前为止我已经走上正轨,并且在C#中没有"更好"的方式吗?
现在,我有一个ProgressBar我希望在线程完成时显示的内容.(现在它运行良好,不确定).如何检查复制何时完成?
所以,到目前为止,我有:
Thread t = new Thread(delegate()
{
po.Organise(inputPath, outputPath, recursive);
});
t.Start();
PBar.IsIndeterminate = true;
Run Code Online (Sandbox Code Playgroud)
之后我想要的东西就像:
if (t.Done)
{
PBar.Value = 100;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试将带有文本的任务栏图标叠加添加到windows7应用程序图标,我确实设法添加小叠加但无法添加文本.
有没有人知道如何添加动态文本作为任务栏图标叠加?
使用:WPF和C#
wpf ×9
c# ×5
controls ×2
icons ×2
window ×2
.net ×1
binding ×1
dictionary ×1
itemscontrol ×1
parent ×1
popup ×1
progress-bar ×1
silverlight ×1
taskbar ×1
textbox ×1
tostring ×1
uielement ×1
width ×1
windows-7 ×1
winforms ×1
wpf-controls ×1
xaml ×1