wpf

How to read an .RTF file using .NET 4.0

I have seen samples using Word 9.0 object library. But I have Office 2010 Beta and .NET 4.0 in VS2010. Any tips on how to go with the new Word Dlls? So I just wanted to get the functionality of RTF to TEXT with .NET3.5 or later. ...

Importance of unit testing my Views when using the MVVM pattern?

When using the MVVM pattern to structure your WPF application you should get all your business logic out of the View and code-behind files. Doing it properly the View itself will be a simple facade with Data Bindings and Command Bindings to the ViewModel classes - which is where the magic happens. One key benefit from structuring your a...

How to create treeview from XML file using WPF?

This is XML file <Root> <RootNode name="CurrentDbName" value="DeltaTest Backup" DesiPath="E:\BuildBackups"> <ChildNode name="Application" value="App"> <LeafNode name="Source" value="Source" SourcePath="E:\Alertv2" /> <LeafNode name="Publish" value="Publish" SourcePath="C:\Alert_Source" /> </ChildNode> <ChildNode name="Databa...

Best practice for dynamically adding controls through copying existent controls in WPF

Hello! I have a TabControl. While clicking a button I want to add a new TabItems to the TabControl. Among various techniques I've chosen to create UserControl inside of a DockPanel. Everything works fine, except for the location of control on a new TabItem is not 0 and it is not expanded on the main form resize. Everything is quite simp...

WPF Animation of border width

I've got a dockpanel on my ui as follows; <DockPanel> <Border DockPanel.Dock="Top">Header</Border> <Border DockPanel.Dock="Bottom">My footer</Border> <Border DockPanel.Dock="Left">Menu</Border> <Border>Content</Border> </DockPanel> What I want to do is to have a storyboard animation to show / hide the Menu on the lef...

How to make autosize text block in Expression Blend 3?

I'm trying to make a textblock control with a fixed size (height and width) in a window using Expression Blend, but the content of the textblock will be changed programatically, so I want the text to be viewed by the largest possible font size without going outside the size of the rectangle. How to do that? ...

Are there any builtin IMultiValueConverts in WPF?

I'm writing a MultiBinding containing two bindings - each returning a bool. Using MultiBindings you need to specify an IMultiValueConverter. In my case this converter should take two bools and return the AND of them. This is really simple to write, but do I have to? This feels like the most basic MultiValueConverter, and I don't want to ...

WPF Updating styles at runtime

I would like to update the default Window style dynamically at runtime so I can change the FontSize and FontFamily dynamically at runtime. I found that Styles in your resource dictionary are sealed at runtime and cannot be changed, so I used the following method of updating the style: <Style TargetType="{x:Type Window}"> <Setter Pro...

How to draw a drop-shadow on a transparent rectangle?

When I add a dropshadow bitmap effect to a rectangle, the dropshadow takes into account the transparency of the rectangle (makes sense). Is there a way to render a dropshadow on a transparent rectangle 'as if' the rectangle were opaque? ie what would appear is a rectangle-shaped 'hole', with a dropshadow. Here is the XAML for a transpar...

List the items in listview according to groups, the data is taken from observable collection

i hav one class which stores file information with namelist as itz observableCollection Imports System.Collections.ObjectModel Public Class NameList Inherits ObservableCollection(Of FileInfo) ' Methods Public Sub New() MyBase.Add(New FileInfo("Willa", "Cather", "warning", "err 1")) MyBase.Add(New FileInfo("Isak", "Dinesen"...

Is WPF a safe choice for my application?

I'm maintaing a Windows Forms application which draws map data with overlays. I've been considering a move to WPF for the drawing layer, to take advantage of the graphics card rendering. In the last couple of weeks, however, I've started to have some doubts: The new release of Evernote uses WPF, and doesn't run on Nvidia Quadro cards. ...

video capture in wpf

Hello What is the best way to capture video in a wpf application? I am looking for a way to detect the video devices, and then capture video from the selected one. Thanks ...

Windows 7 Desktop Manager

when we drag a window to the side of the screen we get like a ripple effect, can we change that programaticaly? ...

WPF Binding - Notify Change to ToString value

I have a textblock that is bound to an object. This object I have overridden ToString to return a combination of 2 other properties. How can I notify that the ToString value has been changed when one of the property values is updated? Unfortunately I cannot change the binding to the ToString value as this is within a 3rd party control s...

2 quick WPF (Windows presentation foundation ) questions on tabs and combo boxes.

Hi, I am a very novice WPF programmer, so need help in some simple tasks. 1- As the image shows, I want the (+) tab(it's a tab created with TabItem as of now or should it be button or something else? :-/) to create a tab left to it, say (A1), pressing again, should create (A2), sort of like in tabbed browsers......... And if possible,...

Wpf binding to Foreground with GridViewColumn

Hi all, I'm doing : <ListView Margin="34,42,42,25" Name="listView1"> <ListView.View> <GridView> <GridViewColumn Width="550" Header="Value" DisplayMemberBinding="{Binding Path=MyValue}"/> </GridView> </ListView.View> <ListView.Resources> <Style TargetType="{x:Type TextBlock}"> <Setter Property="Foreground" ...

WPF Seperate Error and Warning Styles

How can we show user Warnings in a similar way to Errors. The only difference is that the control e.g. TextBox needs to have a different error template and similar to Validation.HasError there needs to be a Validation.HasWarning. In other words not all validation issues are "errors" (in our application at least). We want to visually ind...

unit test an attached behavior wpf

I am still grokking attached behaviors in general, and am at a loss to see how to write a unit test for one. I pasted some code below from Sacha Barber's Cinch framework that allows a window to be closed via attached behavior. Can somewone show me an example unit test for it? Thanks! Berryl #region Close /// <summary>Dependen...

Stackpanel add item animation

Hello, I've been struggling a while with marquee-style image scrolling control. At a moment, I stuck up with templated ItemsControl: <Window.Resources> <DataTemplate x:Key="itemsTemplate"> <Image Source="{Binding AbsolutePath}"></Image> </DataTemplate> </Window.Resources> <ItemsControl ItemTemplate="{StaticResource item...

xaml designer viewer doesn't load

Hi! When I add a resource on my main application (Application.xaml) then my pages doesn't load its design viewer because it tells me there is an error in one resource (DesignerItem.xaml). Otherwise in run time it works perfectly. Application.xaml: <Application xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ...