wpf

Setting Binding Properties in a Template

Is there a way to template Binding.Converter and Binding.ValidationRules within a style? Eg: I have the following textbox: <TextBox x:Name="DepartTime" Height="23" HorizontalContentAlignment="Left" HorizontalAlignment="Left" Margin="3" Width="140" Style="{DynamicResource TimeOfDayTextBox}">...

How do I change the color of Cell in WPF DataGrid based on a property of the object in itemsource?

I have a very simple object called CellData. Is defined as: public sealed class CellData { internal string DisplayText { get; set; } public string Color { get; set; } public override string ToString() { return this.DisplayText; } } I can get it to display u...

Is there a generic way to set the DataContext of the ItemContainer underneath the mouse to a property of some other control?

When hovering over an item in a list, how can I set a property on another element to the DataContext of the list item? I'm trying to make an area where I can display a preview of the item currently underneath the mouse cursor. I'm able to do this using code-behind, but I'd like to find an alternative way which could use EventSetters/Bin...

WPF: how to store image in a serializable object with JpegBitmapEncoder and use it again with JpegBitmapDecoder ?

Hello, I have this code to decode a memory stream, but, its not woring, I get this error: "No imaging component suitable to complete this operation was found." MemoryStream stream = new MemoryStream(value, false); stream.Seek(0, SeekOrigin.Begin); JpegBitmapDecoder JpegBitmapDecoder = new JpegBitmapDeco...

Fluent Ribbon Control

How do I change the Content of the Fluent Ribbon UI filebutton which is – by default – "File"? ...

Bind gui controls within a UserControl to another UserControl and its containing controls in WPF

Hello I have UserControl1 which is a FormatButtonBar with format buttons AND I have UserControl2 which is a DataGrid with RichTextBoxes as cell editors. I want to reuse UserControl1 at different places of my application. This is what I want to achieve with pseudo code: <UserControl1> <ToggleButton Content="bold" IsChecked="{Binding I...

Images in a List in WPF MVVM

I have a question regarding how to best accomplish something in WPF MVVM. I have in my ViewModel a series of integers. For the sake of example, lets call them: public int Yellow { get;set; } public int Red { get;set; } public int Green { get;set; } I also have some small images that are very simple: A Red circle, a Yell...

C# WPF - Binding Dictionary to DataGrid

Scenario Lets say I use C# WPF, and bind a Dictionary() to a DataGrids datasource. When I update the dictionary will the DataGrid automatically update and refresh? Also, will the DataGrid lose focus whilst doing this? In the event that updating the dictionary does not update the datagrid, how would I go about implementing this? Help ...

DataGridColumn Binding in code

Does anyone know how I can do the equivalent XAML binding in code? <DataGrid ... > <DataGrid.Columns> <DataGridTextColumn Binding="{Binding Description}" <=== set in code ** /> </DataGrid.Columns> </DataGrid> Cheers, Berryl === UPDATE ==== It looks like the method I have been looking for is Da...

Displaying RowDetails Programmatically

I have a DataGrid (the official one) with SelectionUnit="Cell". When the user selects a cell, I'd like to show the row details for the corresponding row. This is apparently not the default behavior, and I can't seem to figure out how to accomplish this. Here's my XAML: <UserControl x:Class="View.Test" xmlns="http://schemas...

When to use DataTrigger and when to use Converter?

Any Assumption or rule is there, when we can use DataTrigger and when we can use Converter? ...

WPF - Loading image to show page loading status

Hi All, In my wpf application i am playing videos from the mms server. These video files takes few seconds to load. I want to display loading(waiting) image during that loading process. Can anyone guid me for this. Geetha ...

Use WPF in combination with Hardware Rendering instead of RenderTargetBitmap

Hi all, The WPF application I have build has a Viewport3D containg all kinds of UIElement3D objects. Now I would like to save a high resolution snapshot of a certain view to a file. I have tried RenderTargetBitmap in the past, but I do not like this approach because of the following downsides: Memory leakage (at least with .NET 3.5 S...

In WPF, how to set the style like fold paper tip to rectangle or any other control

I have managed to style a rectangle such that there is a fold paper tip image style in top right corner side. My requirement is I need to have style with multi-document view image. I can able to achive this below xaml. Now I need to set fold paper tip image style. Thanks in advance. RamaS <Window x:Class="ExpandTreeViewWPF.Window2" ...

wpf creating dynamic clickable "grid"

I'm not really sure how to go about my problem. Not looking for complete code just help with in which direction i should go. Since its MVVM I don't want any codebehind... if possible... From the db i get the size of the "grid" i should create, for example 2x3. Now i wish to place an "item" in this grid that takes up one or more spots. ...

What is the best approach to render charts in WPF?

What is the best approach to render charts and then save them on a hard drive for further distribution using WPF? I found a number of ways to accomplish this by using the following types: DrawingVisual - creating a object of this type and then rendering graphics on its context; Shape - deriving from the Shape class and then overriding ...

Haw Wpf RoutedCommand implicitly references a CommandTarget?

If we have a button as the commandSource of ,for example, The Applicationcommand.Paste, which is a RoutedCommand, this means that the RoutedCOmmand.Executed, CanExecuted, PreviewExecuted and PreviewCanExecuted events will raise when the command is invoked by the Button, it will raise on the CommandTarget (TextBox For example) and start B...

Displaying a large collection in a DataGrid

The amount of items in collection: ~100k The amount of field displayed in columns: 4-10 The problem itself - the collection is taken from a database using EntityFramework. It takes about 10-12s on dev computers to load and materialize all the required data. Yet another thing that comes up is that the same collection can be bound to seve...

Why are my WPF styles not shown in the designer?

I've created a WPF application using Visual Studio 2010, converted App.xaml to a Page and added a call to InitializeComponent in the constructor. I've then created a new window called "LoginWindow" and added the following to the App.xaml.cs: [STAThread] public static void Main() { var app = new App(); app.Run...

FolderBrowserDialog - Win32Exception occurred - The parameter is incorrect

I try to use the FolderBrowserDialog from WPF like this: public static bool BrowseFolder(out string folderName) { using (System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog()) { var result = dlg.ShowDialog(); folderName = dlg.SelectedPath; return result == System.Wind...