wpf

WPF UserControl Memory leak

Hi I have a UserControl in an application where I am constantly swapping the Content property with other UIElements. However I noticed in Task Manage after a while the memory goes up after a number of swaps... Using AntProfiler I noticed for some reason there ToolBarAutomationPeer that the UserControl references.... To fix this Memo...

WPF TextBlock custom wrapping : on the left and after a "."

Hello everybody, I'm trying to display a text that would be wrapped on the left and only after special characters in the string. I Hope the first part could be done in XAML, and I'm pretty sure the second part cannot. The aim is to wrap a text this way : - Original text : "Object1.Object2.Object3.Property1" - Wrapped text could be (d...

WPF Prism Master Details form

Hi, I am creating an application using WPF which is using Prism framework. I have created Shell form and defined regions in that for Toolbar, Menubar and Workspace. In the workspace area, i am able to load the modules, but I got one requirement where I have to load Employee Master form showing all the employee list in grid. On double cl...

Problem with RenderTargetBitmap and Viewport3D

Hi I use Viewport3d and display my 3D Elements with inherited UIElement3D classes... Now I want to make different images of my viewport (different views). That means I have to make a new viewport3d at runtime and apply my specific view for the image on it.. see the following code: ' Start creating Image Dim bitmap As New RenderTargetB...

WPF Prism Entity Frameword repository

Hi., I am a bit lost. Im building a WPF application using the PRISM guidance, I want to use the Entity Framework 4 for a data repository. I have previously developed a Silverlight app. using Prism and WCF RIA Services which worked great as all my components is decoupled. So what is the best way of getting data in my WPF application in...

Datagrid Set focus on newly added row

Hi, I have a datagrid bound to an observable collection. When the user press the "add button" it adds a new row and I do this by adding a new element to the observablecollection. I cannot figure out how to make the newly added row with the first cell in focus as if we were editing. I am using a MVVM pattern. Any ideas or suggestions? ...

Unable to cast object of type 'System.String' to "..Controls.SurfaceListBoxItem' exception

All that i'm trying to do is to compare, for each value in a listbox, its value with a chosen one and then set the match index as selected. For some reason the exception in the title is raised. I don't understand why though. Code: foreach(SurfaceListBoxItem n in BackgroundsList.Items) { if (n.ToString(...

How to define and use resources in xaml so they can be used in C#

Hi ! Theoretically, I think that I can define Brushes and Colors etc. in an xaml file and assign that to a button.background in c#. But how do I do that? Where do I put my lineargradientbrush definition like this: <LinearGradientBrush x:Key="BlaBrush"> <GradientStop Offset="0" Color="Red"/> <GradientStop...

Attached property problem

Hi, I have a attached property which name is "Translate". I set the property like this: <Label Target="{Binding ElementName=UserName}" Content="User Name" Extensions.Translate="true"/> I get the Target value in the property changed event handler and it is null. But I set it in the XAML. Why is it null? Thanks. ...

Looking for a pattern / keep a property of several objects in sync

[Sorry for the title, I really didn't find a good one, if anyone has an idea, please edit, thanks!] Hello, I'm looking for a pattern / best practice for the following situation (just an example). Imagine an editor for rectangles (just e.g. adding, resizing, removing rectangles). All rectangles shall have the same color, however this g...

Databinding to the value of a multiBinding

Maybe I am not quite grasping multibindings. I have a property on my viewmodel called OfficeDisplayName that is written to the database. This is a concatenated field based on a person's FirstName, Lastname, and office location. So I have a multibinding on a textBlock...no biggie...works beautifully...but how do I bind the full value ...

WPF Menu on Winforms

Is it possible to show WPF Context menu on WinForms? If yes, how could we do that? ...

What are the advantages to doing WPF in Expression Blend?

Hi, I've been learning WPF and checking out Expression Blend. As far as I can tell, Visual Studio can do everything it can and more. Why do people use Expression Blend? Can it do anything VS cannot? They say its geared for "designers." What tools does it have for designers that VS doesn't? Couldn't designers just use VS? ...

How do I convert a Color to a Brush in XAML?

I want to convert a System.Windows.Media.Color value to a System.Windows.Media.Brush. The color value is databound to a Rectangle object's Fill property. The Fill property takes a Brush object, so I need an IValueConverter object to perform the conversion. Is there a built-in converter in WPF or do I need to create my own? How do I go a...

Show window in Application_Startup. Wpf.

I have this small piece of code. private void Application_Startup(object sender, StartupEventArgs e) { WndAbout ab = new WndAbout(); ab.Show(); } And want to show window or dialog at application startup, before other modules will be loaded. But! When I close the showed window, the main window, ...

"path" not a valid property for Image.source

I'm trying to change the background image set by xaml this way: <s:SurfaceWindow.Resources> <ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/img/bg/Default.jpg"/> </s:SurfaceWindow.Resources> by using the following code in a method: sessionWindow.Se...

WPF Datatrigger for DataGrid only changing the entire row

Hi, I've got a datagrid with a datatrigger set. When it's value is "UP" I'd like the trigger to only change the background in the 'directionColumn' datagridcolumn only. What i've got so far updates the entire row. I also tried placing 'targetname' in the setter element but that just gives an error. Please help Thanks the xaml: <...

Retrieving a list of hyperlinks/bookmarks from an XPS Document?

I have a .docx file with a bunch of bookmarks and hyperlinks. I can navigate through these in documentviewer just fine. What I would like is if it was possible to generate a list of all of the hyperlinks contained in the file. From there, I can create a TreeView on the documentviewer and call the links by name (using the list) instead of...

Need advice about using on the use of technology (WCF, Web services, etc..)

I have an WPF application. The problem: need program(daemon, service) that send signals by network to my wpf application and fires some events in real time. Need recomendations how to write this service. ...

How can I get the effect of colored vertices in WPF 3D?

Those in the know know that the D3DRS_COLORVERTEX Render State, present in every version of Direct3D since at least version 5, is not found in WPF 3D. The question is: How can you approximate colored vertex data, with gouraud shading, using WPF 3D? Optimally, I just want to be able to assign an RGBA color to a vertex. And presumably, I'...