wpf-controls

Bind WPF DataGrid to LINQ Query (Entity Framework)

↘锁芯ラ 提交于 2019-12-12 03:35:26
问题 This must be very simple, but I seem to be missing something. I've searched around for a few hours without coming across anything that can resolve my problem. The issue is that although I can assign my LINQ query to a WPF DataGrid, when I try to edit one of the DataGrid's values I get the following error: System.InvalidOperationException was unhandled Message='EditItem' is not allowed for this view. Source=PresentationFramework StackTrace: at System.Windows.Controls.ItemCollection.System

Using WPF custom controls in Windows forms? [duplicate]

為{幸葍}努か 提交于 2019-12-12 03:08:25
问题 This question already has answers here : WPF control in windows forms? (2 answers) Closed 4 years ago . I made some custom controls in Expression Blend 4 using WPF. However, I need to use them in a Windows Forms application. Is this possible or am I out of luck? 回答1: You should be able to do:Hosting WPF Content in a Microsoft Win32 Window See also: How do I host a WPF control in a Windows Forms application? 来源: https://stackoverflow.com/questions/9472135/using-wpf-custom-controls-in-windows

WPF Custom control for receipt preview

扶醉桌前 提交于 2019-12-12 03:03:14
问题 Hi, I have a requirement to show receipt preview as part of WPF page. Sample of receipt is attached. Each line of text on the receipt can have different alignment(some center, some right or left) and color depending on configuration. Also, the number of lines can vary for each receipt type. I am wondering which controls to be used to effectively implement this. I can create labels dynamically in code behind depending on number of lines and align each one differently with different foreground

VisualBrush makes Visual blurred

天大地大妈咪最大 提交于 2019-12-12 02:58:07
问题 i have a problem with the WPF VisualBrush . Here you find two images from my application. The bigger on is a image which shows a control with text. The smaller one is a extract from the first on who i use a visual brush to make it. My problem is, that when the resolution of my Visual (the content for VisualBrush ) would be smaller then the visual brush looks more blurred. I don't no why. I use the following code to declare the visual brush. var blendBrush = new VisualBrush { Visual = Host

WPF: proportional resize of two buttons

蓝咒 提交于 2019-12-12 02:53:40
问题 I have a WPF form with two buttons in it. When the window is resized , each of the buttons should occupy half of the window's space at all times. I can not get it to work. How is it done? <Window x:Class="ExampleWin.MainWindow" 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" xmlns:local="clr

wpf listview gridview swaping item template

故事扮演 提交于 2019-12-12 02:17:28
问题 I have a list view that is displaying data using the gridview. This list is displaying data typical of grid views. Lots of data displayed in rows and columns. However, on some rows I do not have any data to display, in the columns. I would like to swap out the item template for that row and display another template for the entire row that would display something like "blank row" or "empty row" for the text and also style the whole row not the individual cells. I have been trying to use this

WPF - Combo Box with Items that include a Button

倖福魔咒の 提交于 2019-12-12 02:06:12
问题 I have a ComboBox control in a window. I am reading the items that comprise the ComboBox at runtime from an XML file. What I would like to do is to include a Button object with each item so that if the user clicks the button, I can take appropriate action based on the item associated with the button. It might look something like this when the user drops down the list: Item 1 [Button] Another Item [Button] Item 3 [Button] I don't have enough experience with WPF to know if this is possible, but

3x3 Grid containing a Path in the center fills the entire grid

血红的双手。 提交于 2019-12-12 02:01:19
问题 I have the following ControlTemplate that I am using in an ItemsControl. It is essentially a 3x3 Grid with a Path in the center and a Textbox/Textblock on top of it. When I use this, the Path takes up all of the space within the ItemsControl, and ignores the column/row definition constraints. Can anyone tell me why this is happening? I tried wrapping the Path in a Canvas but that didn't seem to help. Thanks! <controls:Toolbox x:Key="DrawingShapeTemplates" DefaultItemSize="60, 60"

How to get/specify info about a programmaticaly-added button in WPF? Or similarly, how to pass custom EventArgs to such a button click event?

你说的曾经没有我的故事 提交于 2019-12-12 01:45:16
问题 Say I added a series buttons to a WPF app progammatically, as part of a label, textbox, button section, and attached a single handler to the click event of all of these. How can I specify which button (pertaining to which section) is being clicked, so it can be handled accordingly? Attaching individuals handlers won't work since the user must be able to add as many of these 'lines' as needed. A possible alternative would be to pass information to the event handler, such as: ... var sender =

Quickest way to inherit a standard control in WPF?

穿精又带淫゛_ 提交于 2019-12-12 01:35:16
问题 I just want to wrap a standard control with some more additional properties (look stay the same, I don't want to do theming in first stage). Can I just inherit from this standard control instead of UserControl or Control ? In fact I read it is obligatoryb to use Custom Control Project Template and not UserControl ontrol Project Template. Why ? Update: I try with a Custom Control Project and inherit from the standard slider but I have nothing show up visually ! Now what should I do to have the