wpf

XAML Binding to complex value objects

I have a complex value object class that has 1) a number or read-only properties; 2) a private constructor; and 3) a number of static singleton instance properties [so the properties of a ComplexValueObject never change and an individual value is instantiated once in the application's lifecycle]. public class ComplexValueClass { ...

Wait for animation, render to complete - XAML and C#

Hi all. I have a situation where I am animating part of my XAML application, and I need to wait for the animation AND rendering to complete before I can move on in my code. So far the tail end of my function looks like: ProcExpandCollapse.Begin(); while (ProcExpandCollapse.GetCurrentState() != ClockState.Stopped) { } } Which...

How to assign Application Icon that will display in Task bar?

I am working on a Wpf desktop application, whenever i run my application it shows me a window and associated tab in the task bar(Normal windows feature). My problem is that the tab is using window's icon for unknown file-type, I tried with Icon property of Window, Icon gets assigned but still problem is when I run application, task bar T...

DataContext as Source for Converter Binding Within Resources

<Canvas.DataContext> <ViewModels:VMSomeControl Model="{Binding RelativeSource={RelativeSource TemplatedParent}}" /> </Canvas.DataContext> <!-- DataContext is not passed into these Instances. they also have no knowledge of their TemplatedParent. --> <Canvas.Resources> <!-- is there a way to use a binding t...

Multiple objects in list, C#

I'm looking for something similar to List<T>, that would allow me to have multiple T. For example: List<TabItem, DataGrid, int, string, ...> = new List<TabItem, DataGrid, int, string, ...>(). ...

Why does my TextBox with custom control template not have a visible text cursor?

I have a custom control template which is set via the style property on a TextBox. The visual poperties are set correctly, even typing to the textbox works, but there is no insertion cursor (the | symbol) visible which makes editing challenging for our users. How does the control template need changing to get the traditional TextBox beh...

Problem dragging Winforms TreeNode to WPF List

I'm having some problems dragging a WinForms TreeNode to a WPF ListBox. I set the ListBox.AllowDrop = true and subscribe the DragEnter and Drop events. The events are raised when they should but I think the Args are a bit messed up. I'm trying to filter the objects that can be dropped into this specific target. I just started by trying...

WPF Command with Click Event Handler

Hi all, When I use the Command in a Button control the event handler which joined with Click event will never raised, how can I use the Command and handle the Click event handler Thanks in advance ...

WPF Datagrid Combobox binding to each other within the datagrid

How to get a WPF datagrid combobox to bind within the datagrid elements. For example: I have a collection of People => Name, Age and Sex. Foo, 18, Male Boo, 21, Male FooBoo, 30, Female Now inside the datagrid i have a combobox (DataGridComboBoxColumn) with the collection of the names only (Foo, Boo, FooBoo) ItemsSoure and two Data...

Adding Enumeration Value to Silverlight Attribute/Property

In the <ImageBrush/> element, there are AlignmentX and AlignmentY attributes with values Left/Center/Right and Top/Center/Bottom, respectively. What I'm wanting to do is set my own value in, for example, AlignmentX either as a value or as another enumeration like AlignmentX="HalfCenter" where HalfLeft equals my own value (halfway betwee...

Using a Datagrid as a Datagrid.RowDetailsTemplate

Hey Guys, I want to use a Datagrid as conten of another Datagrid's RowDetailsTemplate. It works nerarly perfect, but there is the problem, that the child Datagrid ColumnDefinition seems to have no effect. Here is my Code: <toolkit:DataGrid VerticalAlignment="Top" HorizontalAlignment="Stretch" AutoGenerate...

How many layers is too many?

As I have been learning about software development the last 2 years the more I learn, it seems the more gray areas I am running into. One gray area I have issues with right now is trying to decide how many layers an application should have. For example, in a WPF MVVM application what fashion of layering is ok? Is the following too sep...

Difference between User Control and Custom Control Library

I'm working on creating a date/time user control in WPF using C# 2008. My first user control. I'm also using Matthew MacDonald's book, "Pro WPF in C# 2008". In that book he strongly recommended creating a user control using the WPF Custom Control Library project template; so I followed his suggestion. I've finished writing the code w...

Display a running number in the WPF DataGrid RowHeader

Hello, I am using WPF with MVVM. How can I bind: a list of numbers or a list of clr objects with property number or a list of strings in my ViewModel to the RowHeader of the WPF DataGrid ? ...

Binding TreeView selection to ViewModel

So I have a TreeView that looks something like this: <TreeView Name="elementTreeView" ItemsSource="{Binding Elements}" Width="Auto" SelectedValuePath="Path" /> I also have a TextBlock defined as follows: <TextBlock Text="{Binding ElementName=elementTreeView, P...

How can I check for child control clipping in a WPF ScrollViewer?

I'm trying to use the WPF ScrollViewer with a stackpanel containing buttons, and without the scrollbar. <ScrollViewer Grid.Row="1" Name="scrollViewer1" VerticalScrollBarVisibility="Hidden"> <StackPanel Name="stackPanel1"> <Button Content="Button1" Height="23" Name="button1" MinHeight="75" /> <Button ...

How do I bind to a color in a WPF ColorAnimation?

I would like to do something that is seemingly quite simple, but I cannot figure out how to do it. I have a ColorAnimation that is triggered when the MouseEnter event occurs. It simply changes the background color of a Border from one color to another color. Unfortunately, I can't figure out how to put anything but hardcoded colors in...

capture MouseEnter / MouseLeave on Image in WPF TreeViewItem

Hi! I've done my TreeView all with XAML but now I'd like to manage an event with code-behind and I don't know how. The HierarchicalDataTemplate contains an Image. I need to capture the events MouseEnter / MouseLeave on the Image. I've tried in this way: <Image x:Name="imgArticolo" Source="{Binding imgArt}"> <Image.Style TargetType=...

Creating a simple seeking media player with MediaElement in WPF

I have also posted this on MSDN forums - i hope its not a problem. I am basically trying to create a WPF based video player which allows you to seek within media. I'm trying to implement it using MediaTimeline (i know i can change the Position property, but i had other issues which i'll post in a separate question). XAML and code-behind...

WPF DataBinding with Constructor

(For this example) ListBox l is bound to CustomObjectCollection c. Does l call c's Constructor? What if c is a Generic Object? **In XAML (1)** <ListBox Content={Binding CustomObjectCollection}/> **In Codebehind** CustomObjectCollection<MyClass> c; **In XAML (2)** <ListBox Content={Binding CustomObjectCollection}/> Suppose in c, I po...