wpf

Hide WPF elements in Visual Studio designer

I have a WPF form which basically looks like this: <Window ...> <Grid> <DockPanel> [content shown during normal operation] </DockPanel> <Grid Background="#CCCC" Visibility="Hidden"> [overlay grid which is only shown during special circumstances] </Grid> </Grid> </Window> The overlay grid hides everythi...

MVVM with TreeView - add nodes

I am new to WPF, and I am trying to implement MVVM with TreeView according to an example. However, in addition to the functionality in the example I would like to be able to add nodes to the tree (i.e. add new child to a specific node in the tree during runtime). My question is, should the new nodes be added to (a) the model or to (b) t...

WPF ControlTemplate with foreach?

I currently try to create classes for a paint-like WPF application. I have to base classes LineMovement (line from StartPoint to EndPoint) and PathMovement (line going through all points specified in a property Points of type PointCollection). These classes inherit from Control and get their looks through a ControlTemplate. Now I want t...

How to stretch the controls as per the page size in wpf

Hi, I have a listview of width set to Auto. When I run the windows app, it opens in normal size(not maximized). But when I maximize the window, the listview's width will be same and the space to its right is empty. normal size |_____________________| Maximized |_____________________|........... even though the window is now in full sc...

[WPF] RelativeSource FindAncestor issue

Here is the code: <GridViewColumn DisplayMemberBinding="{Binding Path=BookId}" Width="100"> <GridViewColumn.Header> <Border BorderBrush="Black"> <TextBlock Width="{Binding RelativeSource...

Can I make a dependency property that's read-only?

I need this dependency property to be accessible for read operations only. Outside objects should not be able to assign values to it. ...

Forcing a repaint of a WPF control

I currently try to create classes for a paint-like WPF application. I have to base classes LineMovement (line from StartPoint to EndPoint) and PathMovement (line going through all points specified in a property Points of type PointCollection). These classes inherit from Control and get their looks through a ControlTemplate. The ControlT...

Cannot read True Type Font FIle in my WPF APplication!

Hi, i'm developing a project in Wpf with Vista Sp1 on my laptop ,in this project i add some True Type Font that Windows Xp did not get and when i debug my project on Windows XP i cannot see the True Font File,so i wish add in my project those fonts as resources but i cannot work out this step. I followed all advices of MSDN but not luck...

Bind page title to a text block in a style

OK, I have defined a style for Navigation Window. I have successfully styled Navigation buttons and even added page breadcrumbs to the Navigation menu. What I want is to add Page title next to the breadcrumbs: Style x:Key="{x:Type NavigationWindow}" TargetType="NavigationWindow"> <Setter Property="SnapsToDevicePixels" Value="true"/>...

What is the best reference material on WPF custom controls

I currently do all development work in VB.NET 2008, winforms; but within 18 months will be switching to WPF (for better or worse). I have had great success using Matthew MacDonald's "Pro .NET 2.0 Windows Forms and Custom Controls in VB 2005" book. This is an excellent reference focused entirely on the development of custom controls in ...

Setting ComboBox.SelectedIndex Breaks OneWayToSource Binding On ComboBox.SelectedItem

Hello All, The following appears in a data template: <ComboBox IsSynchronizedWithCurrentItem="False" SelectedIndex="0" SelectedItem="{Binding Path=Value, Mode=OneWayToSource}" ItemsSource="{Binding Path=EnumeratedValues, Mode=OneTime}"/> With SelectedIndex being set (as shown above), the OneWayToSource b...

MVVM and Stateful commands - Good or bad idea?

Hi, I thought I'd post here in the hope that maybe someone with MVVM expertise would be able to offer opinions on whether the following is a good idea: I'm using Sacha Barber's Cinch MVVM framework, which includes Marlon Grech's SimpleCommand class. One thing this class doesn't have which some other alternatives have is a Text property...

Enable Vista glass effect on a borderless WPF window

Hi, I wrote an attached property that I can set on a window to extend the glass frame into the client area (using the DwmExtendFrameIntoClientArea API). It works fine in most cases. Now I want my window to be borderless, so I set the following attributes on my window : WindowStyle="None" ResizeMode="NoResize" Background="Tr...

How to catch mouse left down if data template has a transparent background?

Hi, My DataTemplate looks like this: <DataTemplate x:Key="ItemTemplate"> <StackPanel MouseLeftButtonDown="StackPanel_MouseLeftButtonDown"> However I can't catch mouse left button down. If I set the background of the template to some color, it is ok. How do I create a transparent DataTemplate and catch the MouseLefButtonDown event? ...

WPF: is it possible to have a content container move 3d dimenisional in a modelvisual3d element ?

i was learning 3d animation in wpf.. and most tutorials would make an image 3d then play with it alittle ..moving and changing dimensions.. so it got me wondering.. is it possible to add some type of data container (like a grid canvas.. or whatever).. and make it move in 3d dimensons too ? i am not talking about skewing.. i am talkin...

Docs/Utility to View WPF Control Template?

Is there documentation/utility that shows the default control template of a given control? I'd like to see how a given control is constructed so I can customize the behavior correctly and/or choose to use a style instead... ...

How do I display a Windows file icon in WPF?

Currently I'm getting a native icon by calling SHGetFileInfo. Then, I'm converting it to a bitmap using the following code. The Bitmap eventually gets displayed in the WPF form. Is there a faster way to do the same thing? try { using (Icon i = Icon.FromHandle(shinfo.hIcon)) { Bitmap bmp =...

WPF Grid for Window Layout

The main window of our WPF application consists of 4 regions, arranged as 2x2 tiles. The user must be able to resize these regions. This is not a problem when using a Grid control with GridSplitter elements. But there is an additional requirement. In the center of window where all the regions meet there has to be a button which can be u...

DependecyProperty.UnsetValue appears when using a IMultiValueConverter

I create simple converter to concatenate the text of 4 TextBoxes in my WPF app. Here is the Converter: public class FourString:IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { return string.Format("{0}{1}{2}{3}", values[0], values[1], values[2], values[...

WPF ViewBox Zoom

Hello, Is there a way to zoom a viewbox content, excpet for one control? I have a viewbox with a grid, and in this grid I have some controls and I'm trying to zoom all the controls in the viewbox except one, is it possible? Many thanks, Paulo ...