Windows 7窗口自然有一个半透明的标题.我刚刚意识到谷歌Chrome TabBar与这种效果混合,好像TabBar背景和窗口标题是一样的!非常酷!
有没有办法在WPF中获得相同的结果?任何例子?
谢谢.
是否可以ListBoxItem在Windows Presentation Foundation中更改从Code-Behind中选择的内容?
这是一个很简单的任务真的,我有一个Next和Previous按钮,它们代表了下一个和上一个项目ListBox.但是,myListBox.items当然是我存储在内容中的对象表示ListBox.
那么,如何获取ListBoxItem设置IsSelected属性?
我想在上面创建非矩形窗口DropShadowEffect.我发现这篇文章是怎么做到的.但DropShadowEffect运行此代码时未显示.在屏幕截图中,您可以看到它DropShadowEffect存在,但它不适合我.
我怎么可以使用DropShadowEffect与AllowsTransparency设置为TRUE?
是否有任何情况下a的内容ContentPresenter将是某个对象而不是UIElement?鉴于该字段被声明为对象而不是a UIElement,似乎可能存在.但是,我想不出它会出现的任何情况,或者即使它是有效的.
ContentPresenter presenter = GetTemplateChild(PART_Presenter) as ContentPresenter;
UIElement myElement = (UIElement)presenter.Content;
myElement.SomeUIMethod(); // possible InvalidOperationException?
Run Code Online (Sandbox Code Playgroud) 我是新手C#程序员,在使用VS 2008在我的WPF(Windows)应用程序中播放音乐时遇到了麻烦.这是一个Web应用程序.我认为发生的myMediaElementExample变量是在用于执行文件中的Play方法时为空ExpenseReportPage.xaml.cs.
现在这个程序构建,但是在我运行之后,它遇到了一个异常myMediaElementExample.Play();.例外说:
An unhandled win32 exception occurred in the WpfApplication1.vhost.exe [948].
Run Code Online (Sandbox Code Playgroud)
你能不能给我一些关于我可能尝试的其他建议?我只包含了与此问题相关的代码:
ExpenseReportPage.xaml.cs文件:
namespace ExpenseIt
{
public partial class ExpenseReportPage : Page
{
... }
public partial class MediaElementExample : Page
{
MediaElement myMediaElementExample = new MediaElement();
public MediaElementExample()
{
}
public void OnMouseDownPlayMedia(object sender, RoutedEventArgs args) //MouseButtonEventArgs
{
// The Play method will begin the media if it is not currently active or
// resume media if it is paused. …Run Code Online (Sandbox Code Playgroud) 在Windows窗体中,我会去BackgroundImage,只需从comboBox中选择它.但这里没有这样的财产.
我该怎么做?
总是烦恼我C#想要为你做这个创业公司.所以现在我正在尝试制作自己的主要方法.它不起作用:
我提供了这个主要方法:
[System.STAThreadAttribute()]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static void Main()
{
Model model= new Model();
Controller controller = new Controller(model);
MainWindow window = new MainWindow(controller, model);
}
Run Code Online (Sandbox Code Playgroud)
这个方法运行,但我看不到任何视觉效果.我想我错过了以下正常主要代码:
Application.App app = new Application.App();
app.InitializeComponent();
app.Run();
Run Code Online (Sandbox Code Playgroud)
我尝试使用相同的代码覆盖OnStartUp,但是会引发异常.如果您有其他解决方案,我愿意听.我只是不明白为什么我的MainWindow必须先创建.
我有TreeView一些像TextBoxes和ComboBoxes 这样的其他控件.在TextBoxES绑定到所选的项目,TreeView就像这样:
Text="{Binding SelectedItem.Name, ElementName=groupTreeView}"
Run Code Online (Sandbox Code Playgroud)
如果我的所有元素TreeView都有一个Name属性,这可以正常工作.
我想知道是否有办法做某种条件绑定会说:
if SelectedItem is MyTreeType
then bind
else
disable the element
Run Code Online (Sandbox Code Playgroud)
可以这样做吗?现在我只是抛出绑定错误而且看起来有点脏.我TreeView是数据绑定,并且有几个不同类型的类,所以这就是为什么我正在寻找某种条件绑定.
谢谢,劳尔
我的ListView很简单:
<ListView ItemsSource="{Binding Path=ActiveCounters}">
<ListView.View>
<GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}" />
<GridViewColumn Header="Value" DisplayMemberBinding="{Binding Path=Value}" />
<GridViewColumn Header="As Of Date" DisplayMemberBinding="{Binding Path=AsOfDate}" />
<GridViewColumn Header="Duration" DisplayMemberBinding="{Binding Path=Duration}" />
<GridViewColumn Header="Last Modified Date" DisplayMemberBinding="{Binding Path=Timestamp}" />
</GridView>
</ListView.View>
</ListView>
Run Code Online (Sandbox Code Playgroud)
我想做的是:
我的XAML是
<TextBox Name="DutchName" HorizontalAlignment="Right" Text="{Binding customer,Path=DutchName }" />
Run Code Online (Sandbox Code Playgroud)
我的班级是
class customer
{
Name name;
}
class Name
{
string DutchName;
string EnglishName;
}
Run Code Online (Sandbox Code Playgroud)
将TextBox未绑定.任何人都可以纠正这个错误吗?
谢谢,
wpf ×10
c# ×7
.net ×3
styles ×3
data-binding ×2
.net-3.5 ×1
audio ×1
binding ×1
conditional ×1
dropshadow ×1
formatting ×1
forms ×1
listbox ×1
listboxitem ×1
listview ×1
mediaelement ×1
selecteditem ×1
textbox ×1
uielement ×1