wpf

WPF Dispatcher timer tick freezes my application

I've got a little problem using WPF Dispatcher Timer. On each timer tick my application freezes for a moment (until timer tick method finishes). This is my code: private DispatcherTimer _Timer = new DispatcherTimer(); _Timer.Tick += new EventHandler(_DoLoop); _Timer.Interval = TimeSpan.FromMilliseconds(1500); _Timer.Start(); Is there...

How to close only single dialog on ESC key in WPF/WinForms?

I have a WPF form. It handles the KeyUp event and if the released key was Escape, it closes itself. Also this form has a button to show some Windows Form as a dialog. It does handle the Escape key in the same way. What happens is that when I press Escape when in the child dialog, both windows close. I expect only the child Windows Form...

WPF - Correct Syntax for Using Coverter with Current Binding

Hi, I have a collection of hex strings that represent colours and I am binding a combobox's ItemsSource to that collection. The combobox items are templated to have a filled rectangle with the relevant colour. I therefore need to use a converter to convert the hex value to a string. Easy enough. However, Blend is telling me that this ...

WPF blinking textblock

Hi iam trying to make an Wpf TextBlock to blink. I want like when im clicking on an button then the textblock blinks. How can i achive this. I have tried the following. <TextBlock Name="txtBlockScannerText" Margin="10,0,0,0" Style="{StaticResource TextBlockNormal}" Text="Skanna Inleverans listan"> <TextBlock...

wpf DependencyProperty Not accepting default value for short

Hi, I was trying to use tis depencency property in my code but it gives me error says that Default value type does not match type of property 'MyProperty'.But short should accept 0 as default value.Ans also if i try to give null as default value it works..even if its a non nullabel type.How come this happens.. public short MyProperty ...

wpf, Style, Setters

Hello, I've got question about wpf xaml style definitions. When I try to set style in this way: <StackPanel Orientation="Vertical"> <StackPanel.Style> <Setter Property="BusinessModeler:GraphItemBehaviour.IsBroughtIntoViewWhenSelected" Value="True" /> </StackPanel.Styl...

Why use MVVM???

Okay, I have been looking into MVVM pattern, and each time I have previously tried looking into it, I gave up for a number of reasons: Unnecessary Extra Long Winded Coding No apparent advantages for coders (no designers in my office. Currently only myself soon to be another coder) Not a lot of resources/documentation of good practices!...

Drag and drop with wpf and nested listview

I have a model like this: <List> <Obj Number="1"> <Group Number="1"> <Detail Name="AAA"/> </Group > </Obj > <Obj Number="2"> <Group Number="1"> <Detail Name="BBB"/> </Group > </Obj > <Obj Number="3"> <Group Number="1"> <Detail Name="CCC"/> </Group > <Group Number="2"> <Detail ...

Can't get the new 2009 XAML primitives working, why?

What I'd like to use: 2009 XAML primitives How it would be nice to use them: <sapv:ExpressionTextBox xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ExpressionType="x:String" /> What actually happens: "Type reference cannot find the public type named String" The examples I see don't have updated namespaces. I ...

How to define a ListBoxItem Template that has the same size of its parent?

I am using the following code: <ListBox x:Name="lbItems" Grid.Row="1" Margin="2"> <ListBox.Template> <ControlTemplate> <Border Background="{StaticResource DarkerBrush}" Width="{Binding Path=ActualWidth, RelativeSource={RelativeS...

WPF: Menu items and combo boxes don't render in Windows 7 64-bit

I'm trying to use an existing internal WPF application (I do have access to the source), but it was developed on XP and I'm using Windows7 64-bit. When I click (for instance) the File menu, 90% of the time I see no drop-down menu at all. The menu still exists - I can use the arrow keys to navigate up and down and choose an option if ...

Shell StatusBar UserControl communication

I have a wpf main window as the application shell containing status bar and a tab control with two tab items. I have also two User controls and their View Model objects using MVVM. I placed each user control on a tab item in the application shell. My question is, I want the user controls to update the status bar on the main shell. What ...

Is there a way to associate a Command with a WPF Toolkit DataGridHyperlinkColumn?

Hi: Is there any way I can associate a Command with a DataGridHyperlinkColumn? I've tried this: <DataGridHyperlinkColumn Header="Client Name" Binding="{Binding ShortName}"> <DataGridHyperlinkColumn.ElementStyle> <Style TargetType="TextBlock"> <Setter Property="Hyperlink.Command" ...

C# 4.0 .net 4 and WPF UI update

Hello , I'm trying to build an app to work with twitter like site , and the problem I'm trying to solve is - How am i going to update the UI with a background worker and only add show the latest posts(tweets if you will ) on top of the wrap panel without removing the ones that already exist? in my previous attempt i have done this b...

Where should I put WPF specific code when using MVVM?

I'm just getting up to speed on MVVM, but all the examples I've seen so far are binding View controls to simple non-WPF specific data types such as strings and ints. However in our app I want to be able to set a button's border brush based on a number in the Model. At the moment, I translate the number into a brush in the ViewModel to ...

Multilingual spellcheck on WPF richtextbox

I need to turn spellcheck on for a richtextbox, and set the language to one the user has picked from a drop down. For now, I'm just testing it by building the richtextbox in xaml and providing a language to the xaml language attribute. I've read two different resources and one says I need to set the language attribute, and the other ...

WPF DataGrid extended "copy and paste"

Hi, How can I make the WPF DataGrid have some sort of improved "copy and paste" where I can select a single cell , copy using Ctrl-C , select a bunch of cells of columns and paste using Ctrl-V ??? So for example...in the image bellow ...I want to be able to copy the "Tech" word to all the highlighted cells just by a Ctrl-C on tech, a s...

Converter problem with XmlDataProvider

Sorry for this, I've just started programming with wpf. I can't seem to figure out why the following xaml displays "System.Xml.XmlElement" instead of the actual xml node content. This is displayed 5 times in the listbox whenever I run it. Not sure where I'm going wrong... <Window x:Class="TestBinding.Window1" xmlns="http://schema...

How to disable ListView navigation through keyboard

Hello. Can I somehow disable ListView items navigation through keyboard (arrow keys), and leave navigation with mouse and in code? Im new to WPF, but have some experience with WinForm so any tips? ...

a loading screen for a c# wpf listbox

I'm using a list box where there are on average about 500 thumbnails (items) that can be sorted and searched. Since I'm using default databinding and search descriptors (which I've heard are slow due to reflection) the list takes a noticeable pause of a few seconds loading, sorting, and searching (the list dynamically updates based on t...