wpf

WPF vertical TabItem border issue

I'm just starting with WPF and I'm facing a visual issue after displaying TabControl on the Left and Rotating TabItem text header 90 degrees. The issue is that the top border of the TabItem header is not showing. The code is this: <Window x:Class="WPF_Exemplo1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentatio...

How do I add a close button to the header of a ContentPane

How do I add a close button to the header of a ContentPane? Please explain it with an example. ...

How can I bind this View to this ViewModel?

The following code-behind binding works for the SmartFormView user control: View: <UserControl x:Class="CodeGenerator.Views.PageItemManageSettingsView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:v="clr-namespace:CodeGenerator.Views" xmln...

Linq-to-SQL: binding ListView

Hi all, I'm struggeling for quite some time now with binding my ListView to a table. I've read various solutions, but I keep running into trouble. I have 2 database tables: Customers and Products. For each Customer there is a list of Products. In my first attempt I bind to the generated Linq-to-SQL code. That means I binding immediate...

How to set the SystemColors.HighlightBrushKey in WPF with a Converter...

Hi, I im trying to set the SystemColors.HighlightBrushKey always a bit darker than the Background of the selected Row. Therefore im using this Code: App.xaml: <WPFTests2:SelectionBackgroundConverter x:Key="SelectionBackgroundConverter"/> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{Binding ...

Testing Composite WPF applications

How do I go about testing Composite WPF applications? I was looking at the Composite Application Library and the Stock Trader reference implementation for examples, but I don't understand how their tests are organized. I have several modules that are compiled to DLLs and referenced by my main shell. What do I need to do to test the ind...

Common uses for the Tag property

I've started using this alot to link elements of my UI to their data backing class (whatever that might be). What are some of the common uses you put the Tag property to use for? Indeed, do you use it at all? I know I didn't for a very long time. ...

What are the advantages of the WPF ToolBar?

I'm trying to decide whether I should create a simple StackPanel with Buttons on it, or whether I should use the WPF ToolBar class to contain these buttons (I am creating a simple toolbar). What are the pros and cons to using WPF's built-in ToolBar control? So far, these are the only advantages I have seen: The ToolBars can collapse...

Selection checkbox with triggers ?

Hi, I have this control (see picture). I like when check one option in this control, using styles or with triggers other option enable or disable. This is valid or I have other option for do that? ...

WPF Firing Validation Rules on Button Click

I have created a Custom TextBox control which fires the ValidationRules on LostFocus event. But now I need to fire the same validation rules when the user clicks the button. I wrote an article about my custom TextBox control which you can read it using the link below: http://highoncoding.com/Articles/578_Creating_WPF_TextBox_UserContro...

Design effects in WPF (tricks to enhance app's appearance)

I have developed an application that must be presented on exhibition as advertising. I want it to look more sexy! What tricks do you know that enhance the appearance of your applications? What are the best design effects the developer can use for its application? I am speaking about: glowing, shadows, maybe forms of buttons, beautiful a...

Calling ViewModel Methods

I'm pretty new to WPF and using the MVVM design pattern. To help learn this, I'm developing a simple dice-rolling application. Right now, I have a Dice class and a DiceViewModel class. I also have a MainWindowViewModel class that contains an observable collection of DiceViewModels. When a user clicks the "Roll" button, it launches a ...

What's the recommended way to store images used as icons for a WPF application?

I am creating a pretty standard business application in WPF. I need to use icons for the toolbars and menu items, and in a few other places. I'd like to know the answers to three (likely interrelated) things: What format should I use for the images? ICO? PNG? JPG? GIF? How do I store the images in my VS2008 project? As files on disk? I...

Data-based template selection in WPF

I have this simple XAML example: <Window x:Class="DynTemplateTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.Resources> <DataTemplate x:Key="ItemTemplate"> <ItemsCo...

MDX/SlimDX messes up WPF scrollbars?

I have a very simple WPF user control that is mixed in with a windows forms app. It has a list box that renders its scroll bar without the thumb (image below). I narrowed it down to a plugin in my app that uses Managed DirectX (MDX). If I remove the plugin, the scroll bar is just fine. I know MDX is deprecated, but I don't think toda...

How to set the text of a ListBox in code-behind design

Hi, I have a System.Windows.Control.ListBox, and I would like to select a specific index of it. For example, my listbox is red, white, and blue, and after I read an object/file, I want to select red as the window appears. What is the best way to do that? public partial class MyWindow : System.Windows.Window { public MyWin...

Why does overriding the WPF Window.OnRender method fail to draw to the screen?

Hi, I noticed that when overriding the System.Windows.Window OnRender method fails to draw to the screen. I'm sure there's a good reason for this but was unable to find the explanation. The following code demonstrates this: using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace WpfApp...

Updating items inside ListBox

I have a ListBox bound to an observable collection of DiceViewModel. Whenever I click a button to add a new item, the ListBox displays the new item like I expect. Everything so far is working well. <ListBox ItemsSource="{Binding Path=AllDice}" DisplayMemberPath="Value"/> However, I have another button to roll all existing dice. ...

WPF, BitmapFrames & cross-threading question

Hello, I have some BitmapFrames created on a thread other than the main UI thread; Sometime after they are created (and their creator thread finishes), I am trying to use them in the main thread, as sources to some Image controls. BUT I am getting this InvalidOperationException: The calling thread cannot access this object because a...

Drag and drop right click wpf.

When I start a drag and drop using a right click in WPF it will fire the drop on any target with out waiting for the right mouse button to come up. ...