wpf

NLTK in IronPython from WPF

Hi, I need some guidance on where to start on this issue, or to know if it is possible. I would like to use NLTK (Natural Language Toolkit) for Python using IronPython and call from an exisiting WPF/c# project. Is it possible to reference NLTK from within WPF in this way. For example to use Named Entity Recognition from NTLK? Any a...

WPF UI Thread Status

I have a wpf application that takes ~30 seconds to create a map/graphic. I have read there is no easy way to tie into the UI rendering thread to get a progress update. So I was going to use a counter on a value converter which colors my map but that is also on the UI Thread, so my question is has anyone found any slick methods of worki...

(WPF)how to raise Datatemplate's Context MenuItem event

Hi Experts, I have a listbox and its data template. Items of listbox are binded with a static source. In data template I have a button, and created context menu of it and some menu items. <ObjectDataProvider x:Key="GlobalUnits"/> <DataTemplate x:Key="listboxTemplate" DataType="UnitClass"> <StackPanel Margin="3" > <DockPa...

Performance of DrawingVisual vs Canvas.OnRender for lots of constantly changing shapes

I'm working on a game-like app which has up to a thousand shapes (ellipses and lines) that constantly change at 60fps. Having read an excellent article on rendering many moving shapes, I implemented this using a custom Canvas descendant that overrides OnRender to do the drawing via a DrawingContext. The performance is quite reasonable, a...

Use DataContext as CommandParameter in WPF

I want to pass the current DataContext (which is an instance of a ViewModel) as a CommandParameter on a WPF Button. What would be the syntax I should use? <Button x:Name="btnMain" Command="infra:ApplicationCommands.MyCommand" CommandParameter="{Binding ???}" /> ...

WPF Height/Width

In a custom WPF control I would like to set the width of the control to be a function of the Height. For example: Width = Height / 3 * x; What would be the best way to accomplish this so that the control resizes (and initially sizes) correctly and fluidly? Thanks, David ...

DataTemplated ListBox items not responsive to mouse clicks

I'm trying to create a ListBox in which the text of the items is bound to the regionName property of the objects in its ItemSource. This is displaying as it should be, but clicking on the text created by the binding does not change the ListBoxItem's state to "selected" (although clicking on the space after the text selects the item.) The...

How to bind a ComboBoxItem's IsEnabled property to the result of a Command's CanExecute method.

I've a custom SplitButton implementation in which contains a ComboBox with several ComboBoxItems bound to commands. I can bind to the Name, and Text properties of the command just fine but have no way of binding the ComboBoxItem's IsEnabled property to the result of a Command's CanExecute method because it is a method. Is there some synt...

From where to start a timer for a database polling?

I'm trying to understand a general flow of WPF application, it's not everything clear for me, so, please, help me to understand the following: If I want my database polling Timer in a WPF application was started not from a code behind file of my main window, but from another separate class, how I should implement this? Should this clas...

Unable to hide tool-bar grip

Hi! I am trying to create a ToolBar in my WPF application. I don't want the strip (as shown in the bellow figure) to show up, I just want all the items to be placed in the general area. I tried setting the ToolBar.OverflowMode to Never ut it doesn't help. ...

Image metadata Keywords not recognized by Windows XP

Hi, I am using WIC (Windows Imaging Component) in my WPF application to read/write image metadata. Everything works perfect except for keywords not being recognized by Windows XP in the Summary properties tab. Vista & 7 recognizes it properly in the Tags property. I would greatly appreciate any pointers.. Murugesh. ...

Find Control Point for QuadraticBezierSegment when given Start, End, and 1 Point lying along the bezier in C# - QuadraticBezier 3-point Interpolation

Hi Guys, This is Similar to a previous question I asked about the Cubic Bezier. I've got a start point, an endpoint, and a point that is meant to lie along a Quadratic Bezier. Given these three points I want to be able to draw a QuadraticBezierSegment in WPF, but I need the single ControlPoint value (in the QuadraticBezierSegment it's...

WPF ComboBox: ComboBoxItem background when using DataBinding

When I configure a ComboBox in XAML, I can configure the ComboBoxItems' background color like so: <ComboBoxItem x:Name="someName" IsSelected="True" Background="#454545"/> But how do I do it if the ComboBoxItems come from DataBinding? ...

How to destroy RowDetails control when visibility collapsed

I'm trying to figure out how to get the grid to completely destroy my RowDetails control when I collapse its' visibility. I use a cloned copy of the item in that control so I don't truly save it until my service completes. Since the grid is re-using that control it's using the cloned version of the item which is causing incorrect behavio...

Application.ProductName equivalent in WPF?

I have a class library that is nested two+ layers under a main GUI application, within that nested class library I want to be able to access the main applications name. Under .Net 3.5 you could call Application.ProductName to retrieve the value from the Assembly.cs file, but I cannot identify an equivalent in WPF. If I use reflection an...

How can the ViewModel drive a ControlTemplate?

I have the problem that parts of the TreeView Controltemplate need to change depending on the state of the bound (ItemsSource) ViewModels. For example the little expander icon needs to be exchanged with a different drawing based on each items ViewModel state. Additonally based on the state of each ViewModel the child items need to be arr...

How do I abort a Setup Project install from a WPF custom action dialog?

I have a WPF window that is shown as a custom action as part of my VS Setup Project installation. This works well, but I can't figure out how to inform the installer if the user presses the cancel button on the dialog that I'm popping up, so that it rolls back the install. Is there a way that my dialog can provide input to the installer...

Visual Studio 2008 Debug is launching my .NET WPF app with old source files

This started happening randomly yesterday. When I press F5 to test my project, an old build of the program (circa yesterday afternoon) launches. No changes (and I've tried in a few different files) are reflected in the project. However, and this is truly perplexing, if I go to Build --> Build from the Menu bar, the output .exe in the ...

Is there a way to display a image in WPF stored in memory ?

What I got is something like a screenshot making application. (managed to serialize, thank god!!!) When a button is clicked a screenshot is taken by accessing a handling classe's method. now the tricky part is that the class has another method for operating with the above said result, in such a manner than when the respective handling me...

How to change the opacity value of a 3D object

Hi All, I use VS 2008 C# Express. I want to change the opacity value of a 3D object in window that has a lot of 3D objects. Changing process will be done by a code-behind. Could you explain me how it is done. Thanks B.Joe ...