wpf

Is there a best way to manage WPF UI when using Asynchronous execution commands?

Hi guys is there a best way to manage a form in WPF application which has asynchronous execution commands? 1) Suppose you have a form where user enters all his data and clicks on Ok button to save changes. 2) Your WPF app starts an asynchronous method to record those data. 3) Now suppose the database server is do...

C#/WPF: Bind ComboBox to two Elements?

Hello, I've following objects public int PersonAge { get; set; } public List<PersonGroup> PersonList { get; set; } public class PersonGroup() { public string Name { get; set; } public string DefaultAge { get; set; } } My ComboBox is bound to PersonList, while I also have a TextBox which is bound to PersonAge. If a user ente...

wpf 2d high performance graphics

Basically, I want GDI-type functionality in WPF, where I can write pixels to a bitmap and update and display that bitmap through WPF. Note, I need to be able to animate the bitmap on the fly by updating pixels in response to mouse movements. I've read that InteropBitmap is perfect for this, as you can write to pixels in memory and copy...

Did I just find a bug in WPF?

Paste this into Cider. <Grid x:Name="Grid"> <Grid.ColumnDefinitions> <ColumnDefinition x:Name="ColumnDefinition"/> </Grid.ColumnDefinitions> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock Text="{Binding ActualWidth, ElementName=Grid}"/> <TextBlock Text="{Binding Actual...

WPF Validating unbound textbox

Hello, is it possible to use validation without the Binding part? The thing is my textbox is not bound to any object, but I still want to validate it's content. The only way I've found so far is this: <TextBox Grid.Row="0" Grid.Column="1" MaxLength="50" x:Name="textBoxTubeName" Margin="5,5,0,5"> <TextBox.Text> <Binding Path="Name"...

DataTrigger on Enums as the trigger value on a WPF Style

So here's what I'm trying to do in a little nutshell, I'm just gonna start with code and it will most likely make sense. <bl:InnerGlowBorder x:Name="glow" InnerGlowColor="Teal"> <bl:InnerGlowBorder.Style> <Style TargetType="bl:InnerGlowBorder"> <Style.Triggers> <Da...

WPF - bind a listbox to a list<string> - what am I doing wrong?

I'm trying to do something very basic here, something I wouldn't have expected to give me this many problems. I have a public property on my main Window class called ItemList which is of type List<string>. I add to this list throughout the life of the program, and would like the ListBox control I have on my form to automatically update w...

How can I speed up adding controls to a WPF grid?

For a personal project, I need to dynamically populate a grid, based on the contents of an array of variable size. I use code along the lines of what is below to do that, and it works well, except that when the array grows large (as in 200 x 200 or more) it becomes slow (20+ secs to populate). It looks like instantiating the buttons is f...

Add rectangle to WPF Listbox and make alternate the fill color of that rectangle

I have listbox with a TextBlock bound to a field, and the I have set the AlternationCount="2" this works great for changing the background color of the items control; however, I cannot get the effect I want with my rectangle... I'm trying to have a rounded corners effect on each listbox item. edit: the xaml <DataTemplate x:Key="TaskLis...

Jp2 in WPF project

How do I display a .jp2 (JPEG 2000) in a WPF project? ...

WPF: Bind ListView with Multiple Sources

Calling all WPF experts! I'm converting an application I made to create characters for a particular RPG from Window Forms to WPF. For the most part, the program is much simpler in its WPF form; however, I can't seem to figure this part out for the life of me. I have a database that contains a list of skills that the character can take....

xaml injection (modify) from code behind file means dynamically

hi, I am working on NHibernate with wpf. I want to inject (insert) XAML from code behind file. for example I have a xaml grid at user interface level. Now i want to enter xaml string in xaml grid tag from code behind file. How can i achieve that? I want dynamically insert/remove xaml from .cs file. please help. ...

WPF Performance: Displaying thousands of Paths / Shapes on a Canvas

I'm currently developing a visualization tool that draws WPF shapes such as paths, ellipses etc. on a Canvas. I've already implemented a virtualized approach where Shapes are being destroyed and created on the fly depending on their visibility. However, even with only like 600 ellipses visible, the application seems to struggle. What a...

Temporarily see-through wpf application - à la Visual Studio Ctrl for tooltips

Context: I'm working on a WPF application where the user often has to transcribe bits of data manually from other programs. Not having dual monitors, this involves a lot of Alt-tabbing. I figured that it would be quite nice to have the same functionality as in Visual Studio for tooltips - where you can hit Ctrl to render them slightly t...

Bind a view model property to an image

I have a user permissions screen and I would like to have a number of images that represent each permission for the user i.e. a tick for enabled and a cross for disabled. The permissions will be shown in a grid with View, Add, Edit and Delete along the top and the category along the left-hand side. View | Add | Edit | Delete...

WPF FlowDocument Table - AutoFit option?

I want a table to logically size the columns according to the contents. Is this possible in WPF? Here is the code I'm working with: <Window x:Class="FlowDocument.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Wi...

Reloading an image in wpf

I'm trying to reload an image (System.Windows.Controls.Image) I display in WPF. I set the source like this: ScreenAtco01Image.Source = new BitmapImage(new Uri(@"Y:/screenshots/naratco08-0-0-screenshot.png", UriKind.RelativeOrAbsolute)); I made a button, which should force a reload of this image (it changes on disk every second). I h...

Text vertical alignment in WPF TextBlock

How to make vertical center alignment to the text inside a TextBlock? I found TextAlignment property. But it is for horizontal text alignment. How to do it for vertical text alignment. ...

Bound Property always returns false but WPF bound CheckBox is still checked.

I have a checkbox in a UserControl: <CheckBox Content="Existing" IsChecked="{Binding Path=IsExistingTemplate, Mode=TwoWay}"/> It is bound to a DataContext with Property IsExistingTemplate which always returns False. (In my real application, it doesn't always return False!). DataContext implements INotifyPropertyChanged. ...

Overriding styles defined in generic.xaml

I have a custom controls library, in which I defined a control template, that uses some custom styles. My control template is located in the Generic.xaml file, and the styles it uses are also located there, and accessed by the control template with the StaticResource markup extension. In some cases, when I use this controls library, I wa...