wpf

Drawing a 2px Hatch brush in WPF

I'm trying to build a WPF DrawingBrush that will draw a hatch pattern using two 1px by 1px rectangles. The resulting pattern would look like the background on classic Macintosh apps. Here's what I'm working with: <Canvas SnapsToDevicePixels="True"> <Canvas.Background> <DrawingBrush x:Name="gridBackgroundBrush" Viewport="0,...

Isolating triggers from WPF THemes

HI, I am using the WPF themes libary which is relaesed in Codeplex.com. All works fine. The theme used is applied. But there is a problem when I need to create a style for a button control(With triggers especially) and associate it with a button. What happens is the theme does not get applied to that button alone because I have a differ...

WPF ReadOnly Control Tree

I want to be able to make all controls of a control tree readonly. Ideally I'd like to set an inherited dependency property from the root, but IsReadOnly doesn't exist in Control (only in children like TextBox). ...

Can't wrap my head around wpf databinding

My scenario: A wpf form has a textbox and a wpf toolkig datagrid. When a text is entered in the textbox, my service returns an IEnumerable<TranslationItem> items. I want my datagrid to show the result of this service. I tried googling around, but I can't get heads or tails to it. I'm only starting to learn WPF and most of the used ter...

Disable ComboBox Without Changing Appearance

Is there a way to disable changing the value of a ComboBox in WPF without giving it the visual properties of a disabled ComboBox? For example, I know that for a text field you can set the IsReadOnly property to true. Doing this for a ComboBox however, does not prevent the user from selecting a different value. ...

ComboBox with ItemTemplate that includes a button

So, lets say I have a ComboBox with a custom data template. One of the items in the data template is a button: <ComboBox Width="150" ItemsSource="{Binding MyItems}"> <ComboBox.ItemTemplate> <DataTemplate> <Button Content="ClickMe" /> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> The problem...

WPF Border DesiredHeight

The following Microsoft example code contains the following: <Grid> ... <Border Name="Content" ... > ... </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsExpanded" Value="True"> <Setter TargetName="ContentRow" Property="Height" Value="{Binding ElementName=Content,Path=DesiredHeight}" /> </T...

What are the problems of the MVVM pattern?

Is Model-View-ViewModel the best pattern to use in WPF? Are there any downsides? ...

How can I bind Wpf DataGridColumn to an object?

I want to bind the columns of my WPF DataGrid to some objects in a Dictionary like this: Binding Path=Objects[i] where Objects is my Dictionary of objects, so that each cell will represent an Object element. How can I do that? I suppose that I need to create a template for my cell, which I did, but how to get the result of column bin...

How can I watch the user.config file and reload the settings when it changes?

I have a situation where I am running multiple instances of my WPF application. I want the instances to share the same user.config file. Currently, whichever instance writes to the user.config file last wins. I'd prefer for all the instances to watch the user.config file and reload the settings whenever another instance changes it. T...

WPF: Button ControlTemplate + Spacebar = exception?

Hello, I've thrown together a template in Expression Blend for a button, and it works alright - until I tab over to it and press the spacebar. I get the following error: InvalidOperationException '[Unknown]' property does not point to a DependencyObject in path '(0).(1).[0].(2)'. The code is as follows: <ControlTemplate x:Key="E...

wpf textbox textwrapping

I need some help. Don't know if this is possible. I want to have the following: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <TextBox TextWrapping="Wrap" MinLines ="5"/> </Grid> which is a textbox wrappin...

WPF resources in an assembly

Is there to browse the WPF resources in a WPF assembly in .NET with Lutz's reflector? ...

How can I speed up the rendering of my WPF ListBox?

I have a WPF ListBox control (view code) and I am keeping maybe like 100-200 items in it. Every time the ObservableCollection it is bound to changes though it takes it a split second to update and it freezes the whole UI. Is there a way to add elements incrementally or something I can do to improve the performance of this control? ...

WPF Data Triggers Set Object properties based on events

With DataTriggers in WPF its possible to set properties on controls based on the the object you have bound. For example you could set the Background of a TextBlock based on a IsAlive property on your object. <DataTrigger Binding="{Binding Path=IsAlive}" Value="true"> <Setter Property="Background" Value="Yellow"/> </DataTrigger> I ...

How to cleanly get user input from the middle of model's method in Model-View-Viewmodel architecture?

Hi everyone, I am writing an app that listens on a network connection, and when some data arrive, it replies back, and depending on incoming data, it may need to ask user (show dialog) before replying back. I don't know how to do this cleanly in M-V-VM architecture: the events and binding to observable collections are nice if I need to ...

How can I get drag & drop working over WebEx (WPF)

I've created a very simple proof-of-concept WPF application that allows you to drag a rectangle and drop it on another area. It works great on my desktop. However, when I view it over WebEx using Application Sharing, I lose the drag & drop functionality. Any ideas why this is happening and/or how I can get around it? ...

wpf documentviewer to view different file formats?

Hi, I have a wpf application where the user can upload files with different formats (for now only pdf). I want to use document viewer to let the user see what's been uploaded. Is this possible? If this is not possible, can you suggest an alternative? If this is possible, is this a good solution for this? Thanks, Angela ...

WPF vs. Windows Forms

Duplicate: WPF vs WinForms or Rich UI vs Stable Applications? What do you think about the future of the Windows Forms platform? When is Winforms the correct choice vs. WPF? WPF versus Winforms Advantage of WPF app vs Winform for business apps? WPF, Winforms, or something else? What are the pros and cons of WPF compa...

Programmatically change individual ListViewItem layout

I have a ListView with a GridView in it: <ListView x:Name="listViewPersons" ItemsSource="{Binding Path=Persons, Mode=OneWay}" IsSynchronizedWithCurrentItem="True" Height="Auto" HorizontalAlignment="Stretch" Margin="4,4,4,4" Grid.Row="4" VerticalAlignment="Stretch" Width="Auto"> <ListView.View> <GridView x:Name="gr...