Tag: xaml

如何消除WPF输出窗口中的绑定“信息” – 无法使用绑定检索值

我正在编写一个WPF应用程序,性能有点慢,所以我试图解决它。 当我跑步时,我会收到大量这些类型的消息: System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=(0); DataItem=null; target element is ‘Control’ (Name=”); target property is ‘Visibility’ (type ‘Visibility’) System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=AreRowDetailsFrozen; DataItem=null; […]

XAML应用程序工作流程是什么样的

我一直试图找到使用XAML编写的GUI的应用程序的生命周期如何。 这篇博文真让我困惑。 报价单: 要充分了解改善启动时间的机会领域,了解启动应用程序的工作流程非常重要。 1. The App constructor is called in App.xaml.cs. 2. XAML in App.xaml is parsed. 3. Application_Launching is called in App.xaml.cs. 4. The Page constructor of your MainPage is called. 5. XAML in your MainPage is parsed. 6. OnNavigatedTo is called in your MainPage. 我虽然XAML被编译为BAML并嵌入到dll中。 运行时只是将BAML转换为.Net对象。 WP7 Silverlight有什么不同? Runtime是否像浏览器一样解析它? 从XAML生成的C#文件有什么意义? (例如Main.xaml.g.cs)C ++和XAML应用程序有什么不同?

允许鼠标事件通过半透明弹出窗口

我正在尝试从Popup的控件执行拖放操作。 被拖动的内容将被放置在拖放的位置,因此当拖动开始时,我想让Popup半透明以允许放置在它下面。 但到目前为止,我没有让鼠标事件通过我的半透明Popup 。 以下xaml工作正常,当使用鼠标hoverRectangle时, Button仍然可以单击 但是当鼠标hover在Popup的Rectangle时,以下xaml无法允许鼠标事件通过。 我试图获取Rectangle的PopupRoot顶级父级,并为可视树中的每个元素显式设置IsHitTestVisible和Opacity ,但它仍然不起作用。 我可以让它工作的唯一方法是将Background / Fill设置为Transparent但它看起来很奇怪并且hover非Transparent的部分仍然失败。 我已经阅读了以下链接,但据我所知,这只适用于Window而不是Popup 。 如何在WPF中创建一个允许鼠标事件通过的半透明窗口 有没有人有任何解决方案或建议? 🙂

WPF UserControls; 触发并更改其他控件

我创建了一个包含Button和ComboBox的WPF UserControl。 我想改变两者的风格,取决于鼠标的位置,因此鼠标hover的UIElement颜色为黑色,另一个颜色为红色。 如果两者都未设置样式,则将应用默认样式。 别担心,这种噩梦般的配色方案只是为了说明这个概念! 在此先感谢您的帮助。 XAML <!– –> Test 代码隐藏 : namespace WpfUserControlSample { public partial class ToolbarButtonCombo : UserControl, INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } public ToolbarButtonCombo() { InitializeComponent(); btn.MouseEnter += new MouseEventHandler(btn_MouseChanged); btn.MouseLeave += new MouseEventHandler(btn_MouseChanged); } void btn_MouseChanged(object […]

试图让Windows Phone 8 ListPicker工作

ListPicker函数,我可以单击它并出现一个全屏弹出窗口,但有一些选项可供选择。 我的xaml: 它背后的C#包括: String[] moduleNumber = { “AA1”, “AA2”, “AA3” }; 和 public MainPage() { InitializeComponent(); this.modulePicker.ItemsSource = moduleNumber; } 那么我需要做些什么来使moduleNumber中列出的字符串显示在ListPicker上? 如果您需要了解更多,请询问。

如何获取ListPicker的选定项目

我想确定当前在ListPicker中选择的项目的名称。 我不确定在SelectionChanged事件中要做什么来获取项目的名称。 XAML XAML.CS protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); themeList = new List(); themeList.Add(new Theme() { Name = “light” }); themeList.Add(new Theme() { Name = “dark” }); ThemeListPicker.ItemsSource = themeList; } private void ThemeListPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { //get the name of the current item in the listpicker? }

WPF DataGridTemplateColumncombobox更新所有行

我有这个XAML从combobox中选择ItemSource是Enum的值。 我使用的教程是: http://www.c-sharpcorner.com/uploadfile/dpatra/combobox-in-datagrid-in-wpf/ <DataGrid x:Name="dgProductItem" ItemsSource="{Binding ProductVersion.ProductItems}" 但是,当我从一行更改值时, 它将更新所有行 。 有人知道为什么吗? 编辑: 如果我只更改一行,它只会更新该行,但是当我更改另一行时,我刚刚更改的那行也将更改前一行。 干杯

在Windows 8中重用动画

我正在构建Windowsapp store应用程序(Winrt,Metro,Windows 8应用程序)。 我尝试在gridview动画中提供图像:从web加载图像并打开后,它会填充其单元格。 我有故事板: 我有这样的C#代码来处理加载和打开图像的事件: private void Image_ImageOpened(object sender, RoutedEventArgs e) { Storyboard.SetTarget(PopupImageStoryboard, sender as Image); PopupImageStoryboard.Begin(); } 它不起作用,我无法更改目标并在运行时重新运行相同的故事板。 但是我希望同时运行这个动画的多个图像。 你能推荐任何动画重用的解决方案吗?

整个ToolTip的Backgroundcolor

有谁知道一个简单的XAML解决方案来改变ToolTip的整个背景? 我做了以下事情: 但结果看起来像这样: 有什么建议?

无法绑定到属于C#/ XAML应用程序中的WindowsFormsHost子对象的属性的解决方法?

我有一个C#WPF 4.51应用程序。 据我所知,您不能绑定属于作为WPF WindowsFormsHost控件的子对象的属性。 (如果我在这个假设中错了,请告诉我该怎么做): 与WindowsFormsHost绑定 在我的例子中,我有一个包含WindowsFormsHost控件的页面,其Child对象是ScintillaNET编辑器控件: https://github.com/jacobslusser/ScintillaNET 子控件工作正常。 如果它是一个普通的WPF控件,我会将Scintilla编辑器控件的Text属性绑定到我的ViewModel中的某个字符串属性,这样我只需更新Scintilla编辑器控件的内容即可更新该字符串属性。 但由于我无法绑定属于WindowsFormsHost子对象的属性,我正在寻找一种不完全笨拙或笨拙的策略/解决方案。 有没有人以前遇到过这种情况,并且有一个合理的策略来解决我的绑定/更新问题?