wpf

WPF Getting Control null reference during InitializeComponent

So my InitializeComponent method call in the Window's constructor is running through the XML and adding the controls and plugging them into their events. So when a property of one of the controls changes it calls the Method that subscribes to the event. The method references a control that has not yet been built. Why does this hap...

Does WPF refresh drawing similar to Windows Forms?

So if I have a WPF window, would moving another window over the WPF window cause the WPF window to do thousands of redraws like Windows Forms? I am wondering the effects of using vectors in this case, as opposed to everything being bitmap-based like Window Forms. ...

How apply a storyboard to a Label programmatically ?

Hi :), I've a little problem, I'd search google and my Wpf's books but I don't found any answer :( I have created a little storyboard : <Storyboard x:Key="whiteAnim" Duration="1"> <ColorAnimation By="Black" To="White" Storyboard.TargetProperty="Background" x:Name="step1"/> <ColorAnimation By="White" To="Black" Storyboa...

WPF Hide DataGridColumn via a binding

For some reason I can't hide WPF Toolkit's DataGridColumn. I am trying to do the following: <dg:DataGridTemplateColumn Header="Item Description" Visibility="{Binding IsReadOnly}"> <dg:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox Text="{Binding Path=ItemDescription}" /> </DataTemplate> </dg:DataGridTemplat...

Dialog Box Property Value Editor

hello, i am new to WPF and i want to create user control with Dialog Box Property Value Editor in VB.NET. i find this example in C# and rewrite it to VB.NET but it does not work. Is creating property value editor in VB.NET somehow special, because i can`t find examples in VB.NET thanks ...

What method can I override in GridViewHeaderRowPresenter to prevent it from drawing some columns?

The thing is that I created a custom column that inherits from GridViewColumn, and I added a Visibility dependency property to it. Now I want to create a custom GridViewHeaderRowPresenter, that does not draw the columns when their visibility is hidden or collapsed, but other than the OnRender() method, I can't think of anything else. Th...

validation properties by attribute

I create class with two property - name,link(below). I use simple property validation by Required and StringLength attribute. I bind this class object to WPF ListBox(with textBoxs). But when I have textbox empty or write words longer than 8 sign nothing happens :/ What should I do to fires ErrorMessage? Or how to implement validation ...

How to get checked items in a WPF ListBox?

I have a WPF ListBox where I have checkboxes, but what's the way to get the list of items that are checked? The ListBox is data binded to a Dictionary<T>. Here is the XAML: <Window x:Class="WpfApplication.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/wi...

How do I bind to another control's property from a trigger?

In my particular case, I want to bind to the IsReadOnly property of a TextBox to set the Content property of a Button? They are both part of the same StackPanel. I've tried doing it with a DataTrigger with a Binding to the ElementName of the TextBox and a Trigger using the TextBox name as the SourceName. Any thoughts? ...

How do I hide a row in a WPF grid?

I have been hiding a row in a WPF grid by setting the Height property to 0. I was expecting something akin to a Visible property. Is there a more appropriate way to hide the row? Thanks, E ...

Is it possible to vertical align listitem marker in a flowdocument?

I want to to align listitem marker to the top, default is alignment to the bottom of the first block. My faulty code: <Grid> <FlowDocumentScrollViewer> <FlowDocument> <List MarkerStyle="Decimal"> <ListItem> <BlockUIContainer> <Grid> ...

Get a bitmap image from a Control view

Hello, I would like to "copy to clipboard" what a Control of my WPF app draws on the screen. Therefore, I need to build a bitmap image from my Control current display. Is there an easy way to do that ? Thanks in advance. ...

TextAlignment="Right" has no effect in WPF XAML bound to int field?

The binding works great, but as soon as I bind to to an field of type int, the field no longer gets alignet to the right? <TextBlock TextAlignment="Right" Width="50" Text="{Binding SomeIntField}"> </TextBlock> ...

Binding to WPF ViewModel properties

I'm just playing around with WPF and MVVM, and I have made a simple app that displays a Rectangle that changes color whenever Network availability changes. But when that happens, I get this error: Cannot use a DependencyObject that belongs to a different thread than its parent Freezable. Code XAML <Window x:Class="WpfApplication1.Win...

Using SketchFlow to prototype MS Surface Applications

Hi We're doing mockups/prototyping on a MS Surface device and I wonder if anyone has succeeded in using SketchFlow for this. The problem that I see is that the code generated by the tool uses normal WPF controls (Button, etc.) instead of the contact aware surface counterparts (SurfaceButton) which means that they won't work nice on the ...

Working with Resources in WPF

I am wanting to use the example from http://blogs.microsoft.co.il/blogs/tomershamam/archive/2008/09/22/lt-howto-gt-replace-listview-columns-with-rows-lt-howto-gt.aspx However I don't want to put this into the App.xaml code as this will apply to ALL gridviews, how do I apply this example to a select few gridviews in the application? Th...

Navigate between screens in WPF

This should be a very basic design question, but for some reason it doesn't seem to be well documented (maybe due to its simplicity?). If I'm building a dashboard application in WPF that brig up different CRM tasks and I want to navigate between screens, is this the best way to do this, or is there a better way? So for example I have L...

wpf cancel backgroundworker on application exits

Hi! In my application I have a main windows and into it, in a frame I load a page. This page do a long time task when the user press a button. My problem is that when long task is being doing and the user presses the close button of the main window, the application seems to not finish because I am debugging it in VS2008 and I can see th...

WPF PRISM reloading module does not update view

I have a situation where I load a WPF PRISM module into the program when the user clicks a button. The program looks at a ComboBox SelectedItem property on the already loaded module to pick data for the datacontext of the new module. Then it loads data from a database into the datacontext of the new module. This sets the properties of...

WPF - How to properly reference a class from XAML

OK, this is a super super noob question, one that I'm almost embarrassed to ask... I want to reference a class in my XAML file. It's a DataTemplateSelector for selecting the right edit template for a DataGrid column. Anyway, I've written the class into my code behind, added the local namespace to the top of top of the XAML, but when I ...