wpf

Check mark in a checkbox.

In my simple WPF application I use regular CheckBox control. It looks like I can control background and foreground. Foreground property controls the text next to the check box but not the check mark. By default background is white, my foreground is very close to white because I have a dark windows form background. When I run the appl...

Visualize/Edit Business Object's Properties in WPF

I am new in WPF and wondering about business properties visualization approach in WPF. I explain myself: I am a city architect and draw a city plan. My city is a canvas with rectangles, representing houses. I can drag rectangles on the canvas. Now, I need to edit house's properties when I select a house. Is there a WPF way to do it...

Make highlight brush the same as control brush without specifying colour

I want to ensure that a selected ListViewItem's non-focused background is the same as the focused background. I know that the common way of doing this is as follows: <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Blue"/> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Blue"/> However...

WPF Binding to ElementName inside ItemsControl

I have a checkbox, and an ItemsControl populating several DataGrids the following way: <Checkbox Content="Birthday Column Visible" x:Name="UI_BirthdayVisibleCB" /> <ItemsControl ItemsSource="{Binding Path=ParentsCollection}"> <ItemsControl.ItemTemplate> <DataTemplate> <DataGrid AutoGenerateColumns="False" ItemsSourc...

wpf - ListBox - bind SelectedItem to an xml attribute?

I have a listbox on a usercontrol which is populated by a xml file. <Machines xmlns=""> <Machine Name="Prod1" IP="192.168.1.200" isDefault="true" InstanceName="sql08" /> <Machine Name="Prod2" IP="192.168.1.101" /> <Machine Name="Test1" IP="192.168.1.103" /> <Machine Name="Test2" IP="192.168.1.104" /> </Machines> I would like t...

How to become an expert in WPF?

Yes, indeed. To anybody who's sole goal is to become an expert in WPF (or you already are) what would you recommend doing to achieve this goal? What books would you recommend going through? What topics to cover in detail? What achievements to make to become an expert? Would you recommend to become an expert in other areas as well (.ne...

WPF Validation: Styling/templating validation properties

I have a WPF screen that displays a number of TextBox inputs. I have a style that handles all the validation: <Style x:Key="TextBoxStyle" BasedOn="{x:Null}" TargetType="{x:Type TextBox}"> <!-- etc etc --> <Setter Property="Validation.ErrorTemplate"> <Setter.Value> <ControlTemplate> <Border Gri...

WPF - DataTemplate - Using element binding within an attached property

I'm working on an application that uses a richly formatted ListBox. One of the things I need is to bind multiple pieces of information to a button that lives within the ListBox's DataTemplate. This is an over-simplification of my actual code that I made to help you understand the problem. Here's a chunk of XAML from inside the DataTem...

Programatically set the width of a DataColumn for use with a DataGrid

I assign a column programmatically to a DataTable like this: myDataTable.Columns.Add(myDataColumn); Is there a way to programmatically set the width / size of the column? I'm using WPF with C# in vs2010. ...

RelayCommand CanExecute behavior not working

I'm having trouble getting the RelayCommand to enable/disable the attached control properly. I've got an EventToCommand element attached to a button. The command is databound to the ViewModel. Initially, the button is disabled (expected behavior), but I cannot seem to get the CanExecute logic to check it's value. When CurrentConfigFile...

Telerik RadTreeView visual cue

Hello. We're building this visual cue control to use with a RadTreeView control. The idea is that the visual cue should indicate the currently selected item, when clicking the VisualCue, it should bring up and show the selected item when the items parents are collapsed, or when the items get scrolled out of view. Basically, clicking it w...

add radtreeview items to radtreeview root programmatically

Platform: WPF, .NET 4, Visual Studio 2010 XAML code is as below: <telerik:RadTreeView x:Name="mytree" IsOptionElementsEnabled="True" IsLineEnabled="True" HorizontalAlignment="Left" AllowDrop="True"> <telerik:RadTreeViewItem Header="Root of the Tree" x:Name="myroot" AllowDrop="True"> I intend to add a node in the code behind like the ...

Call a storyboard declared in xaml from c#

I am trying to call a storyboard declared in xaml from c#. <UserControl.Resources> <Storyboard x:Name="PlayStoryboard" x:Key="PlayAnimation"> ... I dont have access to "PlayStoryboard" from the codebehind file. Any ideas what i am doing wrong? ...

Binding WPF ComboBox to List<MyClass> where MyClass doesn't have properties, just methods.

Hi, I want to bind a combo box to a list of Device, List. I use, m_ctrlCB.DataContext = m_List; m_ctrlCB.DisplayMemberPath = "ToString()"; m_ctrlCB.SelectedValuePath = "ToString()"; // do I even need this? I don't have any properties in Device to bind to and it's not my class. However, they do override ToString to something that i...

Binding Scope - Styles & Templates

I've got a custom ItemsControl in my project and I'm trying to write a style for it that combines a static list of items with a list of items on a Dependency Property on the control itself. Here is the respective XAML in my Resource Dictionary: <x:Array Type="{x:Type System:Object}" x:Key="Static_CloudItems"> <Button>One</Button> ...

Microsoft Certification Advice : Silverlight path

I apologize if this title is misleading. I already know that Microsoft isn't planning on releasing a Silverlight certification due to their quick development cycles (please correct me if I am wrong). I have started a new job that places a lot of emphasis on Microsoft Certifications, as of late I have been doing Microsoft Silverlight deve...

Expression blend convert example from Silverlight into WPF

Hey! I was looking at a cool layout example in particular the V3FluidLayout.xaml found inside this set of examples : http://gallery.expression.microsoft.com/en-us/DynamicLayoutTrans Anyhow - this appears to be a silverlight app - it runs within a browser. I am trying to pull the V3FluidLayout example into a WPF app - and struggling. I ...

How to add flash video in WPF?

Possible Duplicate: How can one host Flash content in a WPF application and use transparency? How to add flash video in WPF? ...

How can I access a view property from my ViewModel ?

I have a ViewModel whose properties are bounded to from the View (XAML file). I also have a property "StaticText" in the code behind file. how can I access the property "StaticText" from inside the ViewModel ? as suggested by Cameron, i've created a dependency property in my View : String textToTest="I am just testing ."; pu...

how do i handle events in c# wpf custom control

I have just started to explore custom controls in wpf. I am typically a vb.net developer. In vb.net there are a list of events in the code file in the upper right combo box. Even though the combo box is there, the events are not there in C#. I know how to override the events in c# but the signature is not the same and this is not the...