wpf-controls

Binding a Style Setter Value properly

丶灬走出姿态 提交于 2019-12-09 23:50:31
问题 I have the following scenario: <UserControl.Resources> <Style x:Key="NormalFontStyle"> <Setter Property="Control.FontFamily" Value="{Binding MyFont}"></Setter> </Style> <Style x:Key="BigFontStyle"> <Setter Property="Control.FontFamily" Value="{Binding MyFont}"></Setter> <Setter Property="Control.FontSize" Value="{Binding MyBigFontSize}"></Setter> </Style> </UserControl.Resources> <Grid Style="{StaticResource NormalFontStyle}"> <!-- Grid Contents --> </Grid> The DataContext of the Grid is the

WPF WrapPanel with some items having a height of *

六眼飞鱼酱① 提交于 2019-12-09 18:44:08
问题 How do I make a WrapPanel with some items having a Height of *? A deceptively simple question that I have been trying to solve. I want a control (or some XAML layout magickry) that behaves similar to a Grid that has some rows with a Height of *, but supports wrapping of columns. Hell; call it a WrapGrid. :) Here's a mockup to visualize this. Imagine a grid defined as such: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx

Intellisense supported TextBox in WPf

感情迁移 提交于 2019-12-09 17:41:00
问题 I started with wpf 4.0. I have a textBox where i shall enter linq expressions. So i want to enable intellisense support in the textEditor. All i do now is bringing a popUp which has the list of items. Do i have anyother way to do this in WPF. Thanks. 回答1: No, none of the built-in controls provide Intellisense functionality. It's a feature provided by code editors, and I doubt Microsoft intends for you to re-implement Visual Studio. You'll have to write it yourself. See here for a sample:

Capture coloured console output into WPF application

老子叫甜甜 提交于 2019-12-09 16:45:47
问题 Similar to this question, except the console program being wrapped up in the WPF application produces coloured output, so it would be nice if I could capture the colour as well as the text. This is my first WPF program and I'm not sure how to go about finding/modifying the right control, currently I'm just using a TextBox which works but only captures plain text. Update: I tried using RichTextBox: richTextBox.Document.Blocks.Clear(); richTextBox.Document.Blocks.Add(new Paragraph(new Run

How to open a child windows under parent window on menu item click in WPF?

假如想象 提交于 2019-12-09 15:44:02
问题 I am developing an application in C#. I'm using .Net under WPF. I want to open a new child window (like a dialog) and it should open within the main window, just below the menu bar. However, the newly opened windows is simply showing an OS task bar. How can I open the various new windows(like a dialog box) under the main window? 回答1: Try this. MyChildWindow cw = new MyChildWindow(); cw.ShowInTaskbar = false; cw.Owner = Application.Current.MainWindow; cw.Show(); 来源: https://stackoverflow.com

WPF Style for base window not applied in App.xaml, but is in Themes/Generic.xaml

孤街浪徒 提交于 2019-12-09 15:12:21
问题 I am in the process of creating a base window class for most of my windows to derive from. Obviously the best solution for this was a separate class, and a style that applies to it. The issue is that the <Style ../> I have is not being applied when it is in App.Resources . That is, if it's defined in an external ResourceDictionary , and merged into App.xaml 's resources, or a local dictionary and merged, or placed inline into App.Resources . The <Style ../> is, however, applied when it is

How to make WPF XBAP work in Cefsharp (chrome)

假装没事ソ 提交于 2019-12-09 13:53:08
问题 I am working on WPF XBAP application. It works in IE. It is not working in firefox and chrome. I searched and put a bunch of dlls inside google/chrome/Application path. still it didn't work. I put npwpf.dll in c:/programfiles(x86)/MozillaFirefox/plugins folder, still it didn't worked in firefox. When opening the firefox plugins page in browser, I can't able to see WPF plugin there. I tried reinstalling .net 3.5, still plugin didn't show up. To briew, could someone help me to know how I can

Multiple Data Contexts in View

混江龙づ霸主 提交于 2019-12-09 13:37:03
问题 I have tried a few times to find an answer in the posts but not found yet (at least in what I understand since fairly new to WPF). I define a Data Context in the view constructor: this.DataContext = viewModel; I would like to use multiple data contexts in a single view if possible? I have heard multiple inconsistent answers to this from others. The goal is that I need access to properties in multiple view models. For example my view XAML is used in cases like that shown below: <MultiBinding

How to make <UIElement> interactable or click-able in WPF UI

孤者浪人 提交于 2019-12-09 13:03:27
问题 This is my first day to design UI using WPF. I have looked up MSDN official document of Flow Document and found that I can place an UI control inside a RichTextBox . I did put a button in but found it's not interactable - I cannot click on it as it's grey. And I also tried other controls and they all displayed fine but just don't support interaction. Even a hyperlink doesn't work. I have searched over internet, the closest question ever asked is about how to make an inside hyperlink click

WPF Browser is there, but invisible

一世执手 提交于 2019-12-09 08:10:37
问题 I am attempting to use the Browser control in a very simple WPF application, and it appears that while the browser is loading the page that I requested (I can mouseover images and see the ALT tags), I can't actually see anything else: Here is the XAML for the app: <Window x:Class="SmokeyBox2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="SmokeyBox" Height="120" Width="510" ShowInTaskbar="False"