Tag: xaml

在Windows 8应用程序中扩展启动后无法导航到页面

我已经按照Microsoft提供的指南创建了扩展的启动画面。 屏幕显示关闭,数据加载,但随后应用程序无法导航到登录页面。 这怎么可能? ExtendedSplash.xaml.cs public sealed partial class ExtendedSplash { public ExtendedSplash(SplashScreen splash) { this.InitializeComponent(); // Position the extended splash screen image in the same location as the splash screen image. this.extendedSplashImage.SetValue(Canvas.LeftProperty, splash.ImageLocation.X); this.extendedSplashImage.SetValue(Canvas.TopProperty, splash.ImageLocation.Y); this.extendedSplashImage.Height = splash.ImageLocation.Height; this.extendedSplashImage.Width = splash.ImageLocation.Width; // Position the extended splash screen’s progress ring. this.ProgressRing.SetValue(Canvas.TopProperty, splash.ImageLocation.Y + splash.ImageLocation.Height + 32); […]

PSD到WPF XAML:导入搞砸了

我有一个设计师在Photoshop中提出了一些元素,然后我计划用它在Visual Studio中构建一个应用程序。 当我尝试将PSD文件导入Blend时,虽然这是一场噩梦。 使用剪贴蒙版制作大多数元素后,我可以合并它们并使它在XAML中看起来相同,但是我失去了所有的编辑选项,因为它只是一个大块。 如果我不合并图层,我导入的元素没有剪切蒙版,看起来很糟糕。 我知道导入实际上不支持剪切蒙版(严重的……?),那么这里最好的方法是什么? 我确定我不是第一个遇到这个问题的人,但我似乎无法在网上找到关于解决方案的任何内容。 PSD应该改变还是在导入过程中改变某种东西的方法? 非常感谢,克里斯

扩展器支持所有方向的动画

我的目标:在扩展时创建一个带动画的自定义扩展器,并且应该支持所有方向。 我尝试了什么:我已经借助于此实现了一个解决方案。 我修改了它,并根据我的需要使它工作。 我的解决方案将与Up配合使用,即使使用Down方向,我也能够使其工作。 我现在的问题是什么:我不能让它适用于所有方向。 我试过将ExpanderDirection设置为Left和Right 。 这是我的解决方案: 扩展器模板: 0.0 MultiplyConverter.cs(模板所需) public class MultiplyConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { double result = 1.0; for (int i = 0; i < values.Length; i++) { if (values[i] is double) result *= (double)values[i]; } return result; } public object[] […]

使用ICollectionView过滤ObservableCollection

我有一个绑定到dataGrid ObservableCollection现在我想过滤所呈现的数据我看到我需要使用ICollectionView但我不知道如何使用我的MVVM模式添加ICollectionView 。 我简化的代码如下: public class MainViewModel : ViewModelBase , IBarcodeHandler { public ObservableCollection TraceItemCollectionViewSource { get; set; } } 我的XAML <Window xmlns:controls="clr-namespace:Mentor.Valor.vManage.RepairStation.Controls" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 我如何在这里添加ICollectionView以便对视图应用过滤?

如何在Metro应用程序中打印TextBox的TextFile OR内容?

我的Metro应用程序中有一个TextBox控件,需要能够简单地打印其内容。 自从Windows 8 Dev Preview出现以来,我已经完成了我的研究,我仍然无法弄明白。 我已经尝试过样本,阅读其他答案并阅读文档 – 一遍又一遍,一遍又一遍。 这似乎不太可能。 那么,2年之后呢? 我希望有人可以帮助我,我会提供我所有的声誉(嗯,尽可能多的允许)。

如何在通用应用程序中设置窗口的大小?

我使用C#和XAML,我的主页开头如下: (…) 但是当我启动应用程序时,窗口总是最大化。 只有网格尊重XAML中提到的大小。 我在这个论坛上读到了一些答案,但是当我写作时出现编译错误: ResizeMode=”NoResize” 在XAML代码中,或 Application.Current.MainWindow.Height = 754; 在C#代码中(因为Application.Current是已知的,但不是Application.Current.MainWindow)。 我无法弄清楚为什么这些解决方案对我不起作用。 我也能看到这个: WindowState=”Maximized” ResizeMode=”NoResize” WindowStyle=”None” 它也不起作用:“它在上下文中不存在”。 怎么了 ?

将自定义字体添加到Windows Phone 8应用程序

我读过这样的文章,例如这31天的Windows Phone第24天嵌入字体和这个Windows 8 xaml提示自定义字体 ,解释非常清楚,简单如何做到这一点。 但由于某些原因我无法弄清楚,我的自定义字体不会显示在我的应用程序上,无论是在设计器视图中还是在我运行它时。 为了确保我没有离开任何一步,我正在展示我在这里所做的任何有关我的问题的建议: 1.首先,这是我的xaml文本块代码 2.我在项目中创建了一个名为“Fonts”的文件夹,这是我复制字体文件的地方。 3.我将字体文件的Build Action更改为Content 。 我首先将Copy To Output Directory属性保留为None ,然后将其更改为Copy If Newer 。 没有成功。 我做错了什么或者我遗漏了什么?

如何将附加行为添加到CollectionViewSource?

我正在尝试向CollectionViewSource添加附加行为,以便我可以在XAML中的视图模型上提供filterPredicate属性。 XAML如下所示: 但是,我收到一个错误: A ‘Binding’ cannot be set on the ‘SetItemFilter’ property of type ‘CollectionViewSource’. A ‘Binding’ can only be set on a DependencyProperty of a DependencyObject. CollectionViewSource似乎是DependencyObject。 我不确定我做错了什么。 以下是行为代码: public static class CollectionViewSourceItemFilter { /// /// Gets the property value. /// public static Predicate GetItemFilter(CollectionViewSource collectionViewSource) { return (Predicate)collectionViewSource.GetValue(ItemFilter); } /// /// Sets the […]

WPF中的可拖动控件?

虽然我有一些Forms的经验,但我还是WPF的新手,我决定最终尝试弄清楚如何使用WPF。 所以,当我得到可拖动的控件时,这就是我想出的代码(我试图改变它以使用WPF,但控件只是抽搐到处): private void rectangle1_MouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { double x = this.Left + (double)e.GetPosition(this).X – (double)rectangle1.Margin.Left; double y = this.Top + (double)e.GetPosition(this).Y – (double)rectangle1.Margin.Top; rectangle1.Margin = new Thickness(x, y, rectangle1.Margin.Right, rectangle1.Margin.Bottom); } }

如何访问控件样式中父项的属性

我的Listview具有datatemplated为标签的项目。 我正在为该标签设计一个样式,我不知道如何访问父类(ListViewItem)IsSelected属性。 编辑 – 尝试下面的建议,但仍然得到一个例外,这是我的完整代码: