wpf

XAML: The property 'Resources' is set more than once.

I'm getting the following error: The property 'Resources' is set more than once. Here is my XAML: <UserControl.Resources> <!--Resource dictionaries for framework stuff--> <ResourceDictionary> <Style x:Key="MultiLineTextBox" TargetType="TextBox"> <Setter Property="BorderThickness" Value="0"/> ...

Parameterized style/template in WPF ?

If I have two 200 lines long control templates which differ only in a few words (a few colors), how can I make the xaml reusable ? That is, to don't have to copy-paste the template and change 3 words in 200 lines. Here is a simplified example. The only difference between the two styles is the border color. So can I somehow define a Butt...

The 'clr-namespace' URI refers to a namespace that is not included in the assembly.

Hello all. I'm trying to include in my XAML some classes which convert values. However, I'm getting the following error when I compile: Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'View.Summary.Converters' that is not included in the assembly.(View\View) And the XAML it's erroring on: xmlns:c="clr-name...

MVVM - How to create columns at runtime for a xamdatagrid?

I have to create a XamDataGrid that shows a dynamic amount of columns for a time frame x to y. Therefore I dont know how many years a user would select to have these columns created upfront. Now usualy within MVVM you would just populate the data through as many Properties as you would need Columns within your XamDataGrid and the latter...

how to set accelerator (access key) for an imagebutton

Imagebutton is a hybrid consisting of image and text. See here: http://blogs.msdn.com/b/knom/archive/2007/10/31/wpf-control-development-3-ways-to-build-an-imagebutton.aspx http://www.hardcodet.net/2009/01/create-wpf-image-button-through-attached-properties I use the first method because it is most straightforward for me. Now, the pr...

WPF layout issue with nested StackPanel straying outside parent StackPanel

I have a horizontal StackPanel with an image and another StackPanel. The inner StackPanel is vertical with two TextBlocks both of which have TextWrapping set to Wrap. However when the text gets wide the inner StackPanel increases in width so that the TextBlocks don't wrap. The outer StackPanel is staying with the grid layout space it h...

Update a LinearDoubleKeyFrame KeyTime value from code

Hi I have some xaml like this: <UserControl.Resources> <Storyboard x:Name="sbLogo" x:Key="onLoadeducLogo" Completed="sbLogo_Completed"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="image"> <LinearDoubleKeyFrame x:Name="pauseKeyFrame" KeyTime="0:0:2" Value...

Single click edit in WPF DataGrid

I want the user to be able to put the cell into editing mode and highlight the row the cell is contained in with a single click. By default, this is double click. How do I override or implement this? I've searched on google, and the codeplex answer doesn't work for me. I'm pretty new to WPF and coding in general, so a simple answer is b...

How to distinguish Mouse.Clicks from different part of a control

If I have a Control with template like this: <Style x:Key="HomeButtonStyle" TargetType="{x:Type Control}" > <Setter Property="Template"> <Setter.Value> <ControlTemplate> <StackPanel VerticalAlignment="Top"> <Rectangle Width="20" Height="50" x:Name="PART_Rectangle" /> ...

using XAML to bind to a System.Drawing.Image into a System.Windows.Image control

I'm binding a ListView to a list of objects, like so; <ListView ItemsSource="{ Binding Path=. }" ItemTemplate="{DynamicResource EventTemplate}"> I'm binding to an object which declares two properties; string DisplayName { get; } System.Drawing.Image Image { get; set; } I want to populate a DataTemplate but I can't figur...

Using WPF blur to focus attention...Why won't the whole screen gray out?

I used this example to make the screen blur to focus attention. http://blog.wpfwonderland.com/2010/03/23/use-the-wpf-blur-effect-to-focus-attention/ I wanted the whole thing to grey out too, except only one user-control is graying out. I have a grid with 2 columns, left column is a tab control styled like outlook sidebar, and the right...

TemplatedParent - A clarification

Here's the Tree: MyControl : BOUND(IContentMenuItem) ControlTemplate ContentPresenter : BOUND(Header, HeaderTemplate, HeaderTemplateSelector) DataTemplate (For Header) Label I Want to bind The Label @ the end of that tree to a property on the DataContext of MyControl I can use FindAncestor to get the MyControl (Obviously) bu...

List data from a webservice in datagrid WPF

Hi all, i am trying to list data from a webservice in a datagrid (wpf), but i dont know what i doing wrong, or gives me errors or dont list anything. This is how i have right now. WINDOWS.XAML <Window x:Class="IssueAddinOutlook.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.mi...

Not refreshing in WPF with DataGrid

Sorry, I have seen this questioned asked a couple of times here already, but none of the answers have solved my problem. public MainWindow() { _PropertyTenantData = new DataTable(); _PropertyTenantData.Columns.Add(new DataColumn("Property", typeof(string))); _PropertyTenantData.Columns...

canceling remove action - NotifyCollectionChangedAction

I am using the following code in my viewmodel to delete items out of a collection: UnitMeasureCollection.CollectionChanged += new NotifyCollectionChangedEventHandler(ListOfUnitMeasureCollectionChanged); void ListOfUnitMeasureCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChan...

Moving ListBoxItems around a Canvas?

Hello all. I'm working on dragging objects around a Canvas, which are encapsulated in ListBoxItems -- the effect being to create a simple pseudo desktop. I have a ListBox with a Canvas as the ItemsPanelTempalte, so that the ListBoxItems can appear anywhere on screen: <ListBox ItemsSource="{Binding Windows}"> <ListBox.ItemsPanel> ...

pass window as variable, wpf

Thank you for your help in advance. In the following code located in Main(): Application.Run(new frmBackground(frmExit)) I am trying to launch window frmBackground that takes a window as a parameter in the constructor and after all content is loaded (background image), it then launches the passed window. This however does not compile...

Building a reversible StackPanel in WPF

I'd like to build a custom StackPanel with a ReverseOrder property that I can declaratively set to true to have the elements in the StackPanel appear in the opposite order of normal (e.g. bottom to top or right to left). It needs to be reversible on the fly. I'm thinking of deriving a new class from StackPanel, but I need to know what m...

I don't test my model, MVC for WPF

Yesterday I have a talk with my ex-boss, he was a great programmer but the old style B-) me: boss have you heard about Presentation Model AKA MVVM? him: yes, but I don't like it me: why? it is already have a worshiper out there, him: not necessary to me.. you know dude, i don't want to DRY my domain in Model and View Model, and somet...

Why does WPF have its own Color class instead of just using Drawing.Color?

Why does WPF have its own Color class instead of just using Drawing.Color? ...