wpf

Populate datagrid using Datacontext in C# WPF

I'm trying to get data from file. The file first has three lines of text that describes the file, then there is a header for the data below. I've managed to extract that. What I'm having problems is getting the data below the header line. The data below the header line can look like "1 2 3 4 5 6 7 8 9 abc". DataGrid d...

WPF Textbox persist visible caret

Is there a way to make the caret in a textbox visible even when the textbox has lost focus? ...

MVVM,WPF: How to set a item as selected in a combobox

It seems nobody has yet found a way to set the comboboxitem as selected with a SelectedItem="Binding Property". Is the solution to use a IsSelected Property in the ViewModel object within the combobox itemssource ? ...

What is the correct way to bind a textbox to an object.

Could somebody please take some time to show me a quick example on how to bind a text box to the property of an object from c# code? (I've tried to do it on my own, but i can't seem to get it right.) Thank you guys. I just spent an hour before i realized how stupid i am ( i was setting the wrong object as the biding source). Thank you ...

WPF: How to dynamically find a usercontrol or datatemplate

I have a bunch of datatemplates I use to display various sql-views in an ItemsControl. I don't know which datatemplate i'm going to use until run-time. (every view has different columns) Next to that, I made a generic dynamic datatemplate for all those views that don't need anything special. When I display the view I want to first look ...

WPF DataContext syntax - Convert from C# to VB

Currently working through a Teach Yourself WPF tutorial. Usually I can mentally convert from C# to VB without any problem but this C# syntax is unfamiliar. How is it written in VB? Private void Button_Click(object sender, RoutedEventArgs e) { ((Person)DataContext).FirstName = "blah blah" } My usual fave online converters are choki...

M-V-VM best practices

I found two ways to use M-V-VM pattern in WPF: allocate the ViewModel into the View's code behind (setting it as the DataContext); allocate the ViewModel into a XAML file and create the corresponding view using a DataTemplate. The Model can be allocated into the ViewModel's constructor. What do you think about this way of using M-V-...

WPF Memory Leak

I have an WPF form that I myself did not create, so I am not very good at WPF. It is leaking badly though, up to 400 MB and closing the form does not help. The problem lies in my application loading all the pictures at once. I would like to only load the ones visible at the moment. It is about 300 pictures and they are a bit large so my...

How to create function which lets you choose one of 3 parameters values?

So I have string returnType which a developer can choose to = to JSON , XML or PRINT_R. How to limit his choice and make VS 2008 or later suggest him what value (from that 3) string returnType can be? (.net 3.5) ...

Coordinate system problem with the grid control

In my WPF application im trying to visualize some temperature data. I have a list of temperatures for the 7 past days and want to make a point to point line diagram. My problem is with the different koordinatesystems and adjusting data to the grid. XAML: <Grid Height="167" HorizontalAlignment="Left" Margin="6,6,0,0" Name="grid1" Vertic...

WPF application with MS Access database as a data source

I have a Microsoft Access 2010 database(*). Now, using Visual Studio 2010, I want to create a WPF application and add the database as a data source. The app will have a window with a frame that provides navigation through pages. No problem so far. But: -What is the right way to set up the database in this scenario? Tables only? Or must ...

How to open a WPF Content Stream?

Here's the code snippet String str= ??????? // I want to assign c:/my/test.html to this string Uri uri= new Uri (str); Stream src = Application.GetContentStream(uri).Stream; What's the correct way to do this? I'm getting "URI not relative" Exception thrown ...

XAML resources aren't loaded when calling from different project

I have a WPF project with some styles in XAML in Application.Resources. This works perfectly fine. But when I open a window from this project from another one (this one is a console application), the resources from XAML aren't loaded. When I first tried it, I got a XamlParseException on StaticResource calls in XAML, so I changed it to Dy...

customized StringFormat in WPF DataGrid

What would be the most efficient way to set customized formatting of the column in DataGrid? I can't use the following StringFormat, as my sophisticated formatting also depends on some other property of this ViewModel. (e.g Price formatting has some complicated formatting logic based on different markets.) Binding ="{Binding Price, Stri...

WPF: Real time timeline control needed

I need to reflect progress of execution of numerous tasks in real time. I wondering is it any WPF\Silverlight control which do this. Here what I found, but this controls don't meet my needs: http://blogs.msdn.com/llobo/archive/2010/04/30/sl-timeline-control-for-sharepoint.aspx http://timeline.codeplex.com/ http://timelinecontrol.co...

WPF Resource Dictionary XSLT

To use images in wpf you can define: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <BitmapImage x:Key="ImageFunTime" UriSource="../Resources/Images/ImageFunTime.png" /> ... Then in app somewhere you can: var img = (Im...

.NET Framework 4 in WPF not showing bitmap effect

I am having a problem using VS2010 and framework version 4 with bitmap effects. If I have the code below and run it in a WPF application using the .NET Framework 4 Client Profile, the bitmap effect does not appear. If I set the framework version to .NET Framework 3.5 Client Profile (and change no code), it runs as expected. At first, I t...

secondary y axis on WPF toolkit chart

I want to plot two line series in a WPF toolkit chart. (http://wpf.codeplex.com/) Can I set Y-axis of one data series as a secondary y-axis? ...

Microsoft Surface: "Read" the tag value of an IdentityTag

Hi, is it possible to read the value of an IdentityTag if you place it on the TagVisualizer, without having initalized it before? I would like to use the tags for registering a new object on the Surface but having all the "free" IdentityTags in a Collection for initalizing them all... There must be a better way to do in I think. But t...

WPF printing in different languages not locale.

I'm usisng a simple WPF FixedDocument for WPF printing. How can I use ResourceManager with resx files or something like that to print in different languages? The locale for the GUI remains the same, but every report can be printed in different languages. thanks. ...