wpf

WPF 2d Graphics and 'group' transform in c#

Hi, I'm writing an application that creates a graphical 'dial', like a clock. Each element in the dial is created and then added to the dial in a clockwise fashion - imagine creating a single element with the hour 1 that includes the minute strokes, the number '1' and other embelishments, drawing it, then repeting for the hour 2, etc. ...

WPF Format DateTime in TextBlock?

I have a TextBlock thats bound to a DateTime property how do i configurate the format of the date? ...

How can I avoid the overflow when wheel scolling WPF DataGrid

When I use the mouse wheel to scroll the WPF Toolkit DataGrid on a Vista 64 Machine I get a cryptic low level error: at System.IntPtr.op_Explicit(IntPtr value) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSour...

XAML bind to indexed element in property of binding

Given this object class Contact { public IEnumerable<Person> People { get; } public string PhoneNumber { get; } } class Person { public string MobileNumber { get; } } And the following layout <Contact> <PhoneNumber/> <SinglePerson.MobileNumber/> <People> <MobileNumber /> </People> <Contact> W...

How to set property of a control based on the other control's property in wpf

I have a scenario where based on the textbox's text value I have to disable and enable the button say, for TextBox.Text="abc" or "cdf" the button should be disabled and for other values it should be enabled. this has to be written only in Xaml. Thanks In Advance ...

How to combine imported and local resources in WPF user control

Hi I'm writing several WPF user controls that need both shared and individual resources. I have figured out the syntax for loading resources from a separate resource file: <UserControl.Resources> <ResourceDictionary Source="ViewResources.xaml" /> </UserControl.Resources> However, when I do this, I cannot also add resources local...

Value Converter Without Binding On Image Source

Hi, I need to get the path of an image through a value converter. However I can't find any examples of using a value converter without binding. I would be looking to do something along these lines: <Image source="{Value=Image1, Converter={ImageConverter}}" /> The image converter will then go check an image folder and return the corr...

LDAP (AD) integration for WPF Application.

I was demonstrating my WPF application to a customer and he asked me if I have LDAP or can integrated with Active Directory (AD). My application has its own in-build user security and data access security. I use my security framework to authenticate and give rights on screen and data access. The client asked me if I could add or integra...

Should the MVVM ViewModel perform type conversion/validation?

Hi We're just getting into MVVM in WPF. We have implemented our ViewModels with 'strongly typed' properties (int, double? etc.) that we bind to in the view. Type conversion works OK, mostly, and so entering data is simple enough. But we run into problems with validation. If, say, a non-numeric value is entered in a text box bound to ...

WPF WriteableBitmap Memory Leak?

Hello, everyone! I'm trying to figure out how to release a WriteableBitmap memory. In the next section of code I fill the backbuffer of a WriteableBitmap with a really large amount of data from "BigImage" (3600 * 4800 px, just for testing) If I comment the lines where bitmap and image are equaled to null, the memory it´s not release an...

How to bind to a "x:static" resource in code-behind in WPF

Hi, For some user controls, I have this binding: AppLanguage="{Binding Path=ApplicationLanguage, Source={x:Static Application.Current}}" This works for controls that are declared/instantiated in XAML. However, I have a control that is only instantiated dynamically (it won't be used regularly, so I don't want an instance ...

wpf Mouseclick on textbox

how to set the command and command parameter on mouseclick on textbox in xaml? ...

Need help to convert XAML into C# code.

Hi, this is a piece of XAML script that draw a Bezier code. What I need is a pure C# code behind that achieve the same result but not using XAML. Can anybody help convert it into C# code? Thanks in advance! Mike <Path Stroke="Black" StrokeThickness="1"> <Path.Data> <PathGeometry> <PathGeometry.Figures> <PathFigure...

Finding width of characters to do wordwrap

I'm writing a custom textedtior using WPF and am using a stack of TextBlock's to render the lines. That leads me to the problem to find when to wordwrap from one line to the next. What is the best way to do this? Is there a way to find the width of each characther/glyph (other than creating a FormatedText class for each character)? ...

Get a WPF ListBox item from MouseLeftButtonDown

I want to run some code when the user single clicks on any given ListBox item. My setup is a ListBox with a custom ItemsPanelTemplate (Pavan's ElementFlow). Based on the position data that comes in to MouseLeftButtonDown is there a way to tell which item is was clicked? This is made a bit more difficult (or more confusing) by the cust...

How to show traffic on Bing maps 3D control (WPF)

I'm using Infostrat's WPF wrapper for the Bing maps 3d control (blog here http://blogs.msdn.com/virtualearth3d/ ) and was wondering how to show traffic. I can see this is possible when I hit the 3d button in the browser and click on traffic. The solution is probably to use the AddLayer function which takes a string, but I can't figure ...

How can I make sure only one WPF Window is open at a time?

I have a WPF window that I am launching from inside of a winform app. I only want to allow once instance of that WPF window to be open at a time, and not warn that user if they try to open it again. I am having a problem however trying to search for that WPF window being open because the window is being launched from a winform. What I n...

Is Databinding a good way to connect a view to a model

I am thinking about the design of a WPF or Silverlight application. I am planning to use MVC (or another such design pattern) Witch ever of the design patterns I choose, I need to connect to view to the model (or presenter) – is databinding a good way of doing this? (In the past with WinForms applications I have found that Databinding...

Pack Notation in WPF

Hello, I have a question about pack notation. I'm trying to access a png image file within a XAML page from another resource assembly. Let's say the Resource Assembly (which is outside of the local assembly that my xaml file is in), is ResourceAssembly.Common.Resources and that my image is in ResourceAssembly.Common.Resources/Images/im...

How do I do the equivalent of a Graphics.DrawString() in WPF?

I'm creating a WPF application (in C#) and I need to be able to draw strings using the C# code, not the XAML. The strings will be changing rapidly, so whatever method I use should be able to reflect that. I like the graphics.drawstring method in windows forms. Is there anything similar I can use in WPF? Edit: Creating FormattedText see...