Tag: xaml

如何使用样式(remix)更改MahApps.Metro对话框内容

这里已经问过这个问题的sA版本。 我认为答案清晰简洁,但我不太明白,我认为我不应该开始大量评论试图弄清楚(因为这里贴出了正确的礼仪) 我想在我的MahApps.Metro对话框中添加一个额外的按钮。 我需要一个Browse按钮,以便用户可以输入目录。 这个答案显示了如何做到这一点,但我不太明白,因为我是C#和WPF的新手。 我不明白的是我的xaml文件中应该放置部分。 如果我猜测它可以在我的之外的任何地方正确,那么我会收到我不理解的错误。 我当前的代码.xaml文件。 如果我在“网格”部分上方插入“样式”部分,则会出现错误The namespace “Dialog” is not defined 我认为xmlns xmlns:Dialogs=”clr-namespace:MahApps.Metro.Controls.Dialogs”应该添加了Dialogs? 一旦我能够获得样式集,我想我只需添加上一个答案的下面代码(使用我喜欢的按钮)。 我不明白的是什么? 提前致谢 注意 我没有添加我的.cs代码b / c我没有问题实际上得到标准的异步对话框显示。

将XAML WPF窗口转换为WinForm

是否有任何实用程序或转换器将XAML WPF窗口转换为.Net 2.0 Windows窗体表单?

SyleProblem:无法更改BackGround Of特定按钮?

我有一个==> UserControl 。 在UserControl里面==> One ItemsControl 。 现在ItemsControl根据ItemsSource生成Button’s 。 我为这些按钮提供了一些风格。 ==>按钮在Pages.xaml 。 ==>和DataPagerResourceDictionary.xaml Style。 我在Maindwindow.xaml使用了UserControl 。 但我无法根据Button的内容更改特定按钮的Background 。 您可以从 此处 下载完整代码 。 如果我没有为按钮提供样式,下面的代码工作正常。 for (int i = 0; i < displayPages.pageControl.Items.Count; i++) { var container = displayPages.pageControl.ItemContainerGenerator.ContainerFromIndex(i) as ContentPresenter; var button = container.ContentTemplate.FindName("pageNumberButton", container) as Button; if (button.Content == " 3 ") { button.Background = […]

无法将类型为“Windows.UI.Xaml.Controls.ItemsControl”的对象强制转换为“Windows.UI.Xaml.Controls.Image”

当我点击图像时,我在这个项目控件中放置了一个事件以查看图像,但是当我这样做时,我收到此错误,我该怎么做才能修复它。 我尝试更改为项目图像但不存在。 XAML代码: 码: private void inlineImage_Tapped(object sender, TappedRoutedEventArgs e) { Image temp = (Image)sender; if (temp.DataContext is MultimediaElement) { } else { Image ImageToGrid = (Image)sender; ImageContent myImage = new ImageContent(); myImage.ImgUri = ImageToGrid.Source.ToString(); ImageSource imgSource = ImageToGrid.Source; gridGallery.Visibility = Visibility.Visible; stckImageMenuGallery.Visibility = Visibility.Collapsed; ImageGalleryUri = (imgSource as BitmapImage).UriSource.OriginalString; imgPopup.Source = ImageToGrid.Source; } }

Wpf自定义datepicker用户控件

我想创建一个用户控件来获取用户的日期。 它应该有三个文本框,一个用于年,月和日。 我不知道如何创建它。 代码背后 public partial class ChooseDateControl : UserControl { public static readonly DependencyProperty ValueProperty; public static readonly DependencyProperty YearProperty; public static readonly DependencyProperty MonthProperty; public static readonly DependencyProperty DayProperty; static ChooseDateControl() { ValueProperty = DependencyProperty.Register( “Value”, typeof(DateTime), typeof(ChooseDateControl), new FrameworkPropertyMetadata(DateTime.MinValue)); ValueProperty = DependencyProperty.Register( “Year”, typeof(int), typeof(ChooseDateControl), new FrameworkPropertyMetadata((int)0)); ValueProperty = DependencyProperty.Register( “Month”, typeof(int), […]

如何将动态字节数组绑定到WPF中的按钮背景

我正在尝试创建一个具有一组特定值的自定义控件。 它还有一些自定义事件。 我一直在尝试将我从数据库中获取的字节数组(blob)转换为我的自定义控件背景(按钮)。 我的自定义控件: [JsonProperty(“consoleButton.id”)] public int id { get; set; } [JsonProperty(“consoleButton.parent_id”)] public int? parent_id { get; set; } [JsonProperty(“consoleButton.console_id”)] public int console_id { get; set; } [JsonProperty(“consoleButton.image_link”)] public byte[] image_link { get; set; } public string website_link { get; set; } [JsonProperty(“consoleButton.tag_name”)] public string tag_name { get; set; } [JsonProperty(“consoleButton.button_type”)] public Miscellaneous.Enums.buttontype button_type […]

像radiobutton这样的复选框wpf c#

我已经调查过这个问题,但这在设计视图和代码隐藏中得到了解决。 但我的问题没有什么区别:我尝试这样做只是代码隐藏,因为我的复选框是根据数据库数据动态创建的。换句话说,我的复选框的数量不稳定。 我想只检查一组复选框中的一个复选框。 当我点击一个复选框时,我希望其他复选框的缺失属性变为false.this是radiobuttons中的相同属性。 我从xaml端的stackpanel中取出复选框: 我的xaml.cs: using (var c = new RSPDbContext()) { var q = (from v in c.Companies select v).ToList(); foreach (var na in q) { CheckBox ch = new CheckBox(); ch.Content = na.Name; ch.Tag = na; companiesContainer.Children.Add(ch); } } foreach (object i in companiesContainer.Children) { CheckBox chk = (CheckBox)i; chk.SetBinding(ToggleButton.IsCheckedProperty, “DataItem.IsChecked”); } […]

将Interaction.Triggers设置为ListBoxItem

我已将Interaction.Triggers设置为ListBox,并在发生’SelectionChanged’事件时执行相应的TargetedTriggerAction,如下所示。 但我的要求是我需要将Interaction.Triggers设置为ListBoxItem的’PreviewMouseDown’事件(注意:ListBox通过ItemsSource填充)

在XAML页面之间传递值

我正在尝试使用VS 2012和C#构建我的第一个Windows 8 Metro应用程序。 它由一个简单的2页布局组成,第一个是演示和设置页面,第二个是游戏本身(测验)。 我在MainPage.xaml.cs中创建了一个Player实例,它存储了玩家名称,游戏模式(简单,中等,硬)和问题主题(最终)。 Player p = new Player(); 每当设置值时,我都会使用导航到MainGame.xaml this.Frame.Navigate(typeof(MainGame)); 问题是:我如何在页面之间传递这样的值,所以我可以设置一个文本块,说“正在播放名字”?

防止在全景项目或枢轴项目的最后一项上滚动wp7 c#

我有n个枢轴项。 如何停止从最后一个项目滚动到第一个项目。 任何帮助将不胜感激。