wpf

How do I 'element property bind' the isEnabled property of buttons to a MediaElement (WPF)

How do I bind the isEnabled property of play, pause, rewind & forward buttons - for a MediaElement? I can do this in code of course on MediaOpened & MediaClosed, using a shared dependancy property, but I just wondered if I can bind all the buttons (maybe with a converter) directly to a property of the MediaElement? I thought HasVideo l...

WPF: How do I start styling a DataGrid that was built using MVVM?

I have a list of names that I'd like to have bound to a datagrid for editing/sorting/etc. But, I don't like how the DataGrid is displayed at all. Columns are placed in Alphabetical order when I really want a custom order (and I wish I could hide the ID column, or make that column not editable). I'm not sure how to start doing any of this...

How can I dynamically create a list of label and textboxes in WPF?

Hi, I am trying, and failing, to create a list of labels and text boxes in WPF. I am a ASP.NET developer and the XAML experience is slightly overwhelming me at the moment... I have Apress' Pro WPF 3.0 book infront of me and finding it zero use... At the end of my process I want users to complete some questions that will be dynamic to...

How to reference a static resource from the current component resources ?

Hello, here is a demonstration of the problem : from a simple window : <Window x:Class="TestWpfStaticResource.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <TextBlock Text="{StaticResource Tes...

Pixel fonts in Silverlight 4

Is there a way to render pixel fonts correctly in Silverlight 4? Without breaking text into paths or some sort of manual rendering because the text is dependent on data binding. Tweaks with UseLayoutRounding and .5px positioning shifting don't work. ...

How to use AlternationIndex in ItemsControls?

I have seen some articles that show how to use AlternationIndex with ListBoxes or ListViews, but I had spent a few hours trying to get alternating background colors on the base ItemsControl class and nothing seems to work. All ListBox samples I saw use ListBoxItem as the target type for the style that sets the background based on Alterna...

WPF: Running tasks without interfering with Animations Performance

Our group read the widely referenced article http://blog.quantumbitdesigns.com/2008/07/22/wpf-cross-thread-collection-binding-part-4-the-grand-solution/ and wondered if any of you could help with our problem: A team member has a WPF application that has an animation running. The problem is that performing background tasks even on differ...

WPF show dialog at startup

I have a flag if set I would like a connection Dialog window to showup on startup. In App.xaml.cs in the Application_Startup event handler I have the code to show the window. What is happening is the splash screen shows (a png set to splash screen), the dialog pops up for a second then closes and the main WPF window displays. I would ...

What is a good pattern to load data and perform various checks at application start? (desktop)

I have an application that needs to load data via web service calls and perform various permission and data checks. Fairly typical. I'm currently doing this in the background when the application starts, however it is a wizard type application and so the user can't do much until all of this has completed. If any issues come up when doing...

Print Visuals with custom paginator

I'm trying to implement my custom paginator to print listbox contents. I use a custom item template which can have different heights. I'm able to add the items on the pages but sometimes the item has to be splitted into two parts. Does anyone know a good splitting algorithm to avoid that text inside this item is splitted horizontally? ...

WPF: Cannot reuse window after it has been closed.

I am trying to keep one instance of a Window around and when needed call ShowDialog. This worked find in winforms, but in WPF I recieve this exeception: System.InvalidOperationException: Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed. Is there any way to do something li...

A question about WPF. Size in Viewport3D

<Window x:Class="Viewport2DVisual3DExample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Button on 3D" WindowStyle="None" Background="{x:Null}" Foreground="{x:Null}" AllowsTransparency="True" > <Viewport3D> <Viewp...

WPF WrapPanel will not orient items Vertically from within Xceed DataGrid.

Why does this NOT correctly wrap the TextBlock and WrapPanel vertically? <xcdg:DetailConfiguration.Headers> <DataTemplate> <WrapPanel Orientation="Vertical" Height="Auto"> <TextBlock Name="ecrDocs" FontSize="16" Foreground="SteelBlue" Text="{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:Da...

WPF - VisualBrush Binding

I have a simple control that I've created. In the control's template, there is a rectangle whose VisualBrush's Visual is bound to a dependency property in the control. I instantiate the control from within a UserControl in my app, and bind the dependency property to an element in my UserControl. The objective is to give a "preview" of...

How to declare Array of StringDictionary in XAML?

I know I can declare an array of string in XAML like this: <x:Array Type="{x:Type System:String}"> <System:String> first </System:String> <System:String> second </System:String> <System:String> third </System:String> </x:Array> How can I declare an array of System.Collections.Specialized.StringDictionary in XAML <x:Array Typ...

WPF: Can't drop filename in textbox

I'm trying to drop a file into a textbox on my WPF application but it won't work. I believe I have the XAML setup correctly to do this, and a PreviewDragOver event handler does work-- just not Drop or PreviewDrop. Here's the XAML in question: <Window x:Class="TableTagCount.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006...

WPF, read data from XmlDataProvider in C#

I want a TreeView with checkboxes and I'm trying to follow this tutorial. However, in it, he creates all his content for the TreeView at runtime. I have an XML file that I have accessible as an XmlDataProvider in my XAML: <XmlDataProvider Source="XmlData/Versions.xml" XPath="//*[count(*)=0]" x:Key="versionsXml" /> I...

Problem in example code

private void SetAlpha(string location) { //bmp is a bitmap source that I load from an image bmp = new BitmapImage(new Uri(location)); int[] pixels = new int[(int)bmp.Width * (int)bmp.Height]; //still not sure what 'stride' is. Got this part from a tutorial int stride = (bmp.PixelWidth * bmp.Format.BitsPerPixel + 7)/8...

collection snapshot for IsDirty comparison

What is a good (quick, efficient, etc.) way to store a snapshot of a collection for subsequent IsDirty checking? Cheers, Berryl ...

Is it possible to choose Datagrid grouping order in WPF?

Hi guys, I've just started to learn WPF/C# and I picked a project which would actually be useful to me instead of variations of Hello, World! programs. It's a small app that polls a game server for player information and binds it to a Datagrid. The data is grouped by team, which can be one of four values: Blue, Red, Spectator, or None....