wpf

How to paste metafile from Microsoft Word at expected size

I'm having an issue in a WPF application using the RichTextBox where content being pasted in from Microsoft Word is mangled. To work around the issue, I found that Word includes a metafile on the clipboard, and I can get the metafile from the clipboard using interop (WPF wouldn't properly import the metafile either). My problem, though...

reading text from multiple WPF textbox controls from a different thread

In my WPF application I need to read text from several textboxes. Because the code is running in a different thread to the UI, I need to use Dispatcher.invoke. At the moment I’m working with one textbox which works fine, but now I need all the texts, do I need to write a Dispatcher.invoke for each textbox or is there a way to write a fun...

UiElement based on another class

I placed a control into a grid. let's say the control is derived from public class 'ButBase' which is derived in its turn from System.Windows.Controls.Button. The code normally compiles and app works just fine. But there's something really annoying. When you try to switch to xaml-design tab it will say 'The document root element is not ...

Can ListViewItem style property be reset from ListView

Can something like this be done through attributes or templates (pseudo xaml :)) <ListView ListViewItem.Style={x:Null}> </ListView> This question is not just about ListView, it's about all ItemsControl's classes, is there a way to set or reset style for item's from container. ...

Make part of an image transparent

I want to put an image on a button, but I want part of the image to be transparent. How do I do this? ...

WPF Custom Control TemplateBinding

How do i define a TemplateBinding for my custom control? ...

WPF - How do I use the UserControl with a dependency property and view model?

Hello, My goal is to have a user select a year and a month. Translate the selection into a date and have the user control send the date back to my view model. That part works for me....However, I cannot get the ViewModel's initial date to set those drop downs. public static readonly DependencyProperty Date = DependencyPropert...

Binding WPF DataGrid to DataTable using TemplateColumns

I have tried everything and got nowhere so I'm hoping someone can give me the aha moment. I simply cannot get the binding to pull the data in the datagrid successfully. I have a DataTable that contains multiple columns with of MyDataType} public class MyData { string nameData {get;set;} boolean showData {get;set;} } MyDataTyp...

WindowStartupLocation.CenterScreen is opening my window on the wrong display

According to the documentation, CenterScreen should open the window in the center of the screen that contains the mouse cursor, however this is not happening. I have a dual monitor setup, with my secondary monitor appearing to the left of my primary monitor (the one with the task bar). When the user clicks a link in my interface on the ...

Does XAML work with file links in Visual Studio?

I'm adding a new WPF project to an existing Visual Studio solution and would like to reuse a bunch of code (C# and xaml) from an existing project within the solution. I've created the new project and added existing files as follows: Right click project Add -> Add Existing Item Find the file to reuse, use the arrow next to "Add" and "A...

WPF style problem with custom control and textbox-derived class

I had the following situation: main application has app.xaml, which sets the style for TextBox controls a custom control is implemented in a separate DLL, and uses several TextBox controls The main application's TextBox style is applied to the custom control's TextBox controls. Cool! My problem comes in because I need to use a cl...

how can I show progressbar in WPF for DB actions?

I want to show my application user a progressbar for following actions: when they provide login information in WPF and hit submit/OK whatever. when they request any information from DB (select command execution). Thank You ...

Multiple exports with MEF does some really heinous stuff -- why, and why is it allowed?

I have an interesting situation where I need to do something like this: [Export[typeof(ICandy1)] [Export[typeof(ICandy2)] public class Candy : ICandy2 { ... } where public interface ICandy1 { ... } public interface ICandy2 : ICandy1 { ... } I couldn't find any posts anywhere regarding using multiple [Export] attributes, so I figur...

Binding Events that are Unknown

I have a WPF Listbox filled with children that fire events. Now, I am dynamically loading each of the children but I want to hook up the events to a handler. Basically, each time one of the children give me a notificationEvent(Notification n), I want to add the Notification (n) to an observable collection. How would I do this so that n...

Generate Report using SSRS

Hi I am new in SSRS reporting service.. So please guide me how can i develope report ? also tell me which tool required and what are the pre-requists ? i want to develope report using linq datasource and to use it in my wpf application.. please guide me... i need help.. ...

Linq and WPF databinding with an association database

I have 5 tables in my database with the following fields: Customer: ID (int), Name (string) Project: ID (int), Name (string) Task: ID (int), Name(string) Customer_Project: ID (int), CustomerID (int) ProjectID (int) Project_Task: ID (int), ProjectID(int), TaskID(int) The last two tables create associations so any number of Customers...

How can I print from a particular printer in WPF?

I have two printers installed, but I want my application to print from the billing printer not from the Deskjet. How can I programmatically achieve that? Setting a default printer is not a good option for me. ...

Binding ListBox to List (Collection) in XAML

Hello, I'm learning WPF, so I'm kind of n00b in this. I saw some examples about how to do what I want to do, but nothing exactly... The question: I want to bind List to ListBox. I want to do it in XAML, w/o coding in code behind. How can I achieve that? Right now I do it that way: <!-- XAML --> <ListBox x:Name="FileList"> <ListB...

WPF / Silverlight - Mapping API

I am about to start on a project where I need to display maps with cross streets and possibly directions. I know there are a lot of API for the web, but I was wondering what the best solution is for a desktop application. I know of Bing Maps and I believe there are some Google Maps solutions out there as well. Any help or information...

What is the scope of StaticResource within a WPF ResourceDictionary?

I have a WPF ResourceDictionary with the following TextBlock: <TextBlock Visibility="{Binding Converter={StaticResource MyBoolProp ResourceKey=BoolToVis}}"> </TextBlock> The ResourceDictionary is included in App.xaml under MergedDictionaries: <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionar...