wpf

Getting WPF Templated items from Control and Data templates

Hi, How do I get a named control from a control that is bound to a control template or data template? I have tried FindName it does not work. I prefer not to use the VisualTreeHelper as you have to traverse through each parent chld item individually. Thanks ...

logging and tracing using Enterprise application blocks

Whats the difference between tracing and logging in enterprise application blocks? When to you use tracing against logging? Any examples would be great ...

How to implement CRUD Master Details on the same screen under MVVM

I have a MVVM (Prism) application that I need to implement a master details screen wheer the master is a listview and the details is displayed next to it. Read-only seems easy enough (haven't done it yet but I've got my head around WPF binding) but edit/add confuses me. How to I make it so the master is not updated until the details is...

WPF Canvas.Left / Canvas.Top are not quite the right coordinates when rotated, why?

Hi guys, I have a weird but big problem. I am trying to let the user move / rotate some Rectangles on a Canvas. I am basing my mechanism on manipulating Canvas.Left / Canvas.Top properties for move, and RenderTransform.Rotate for rotation. I only need rotation on 0/90/180/270 angles. The problem is that a rectangle, which is placed a...

Why can't I reset the Background of the TextBox in my UserControl?

I've built a UserControl that extends the functionality of the ComboBox in interesting and useful ways. It looks like this when it's dropped down: I've built a whole bunch of features into the control and they all work smoothly. This leads me to believe that I have something of a clue as to what I'm doing. You'd think it would be a...

WPF Cursor on a partially transparent image.

I have a png that contains transparent regions and I set it to the image tag but how am I able to set the cursor to a hand when it is over an opaque part of the image? Thanks Tony ...

Problem in givin SelectedIndex -1 in Listbox

Hi,Im having listbox and getting selected item.The code is private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { int index = listBox1.SelectedIndex; string str =""; if (index == 0) { str = (string)Text1.Text; } ...

Same animation for multiple Target Name

Hi, Just a doubt.I have three images in my WPF application.Im going to give blink effect for that three images.So i gave this code. <Storyboard x:Key ="AlarmBlink"> <DoubleAnimation Storyboard.TargetName="Img1" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:0.1" AutoReverse=...

How to develop treeview with checkboxes in wpf?

I have a requirement that , i need to add nodes to treeview dynamically and that nodes with checkboxes. If one checkbox is selected childs also selected. And mainly i want to add data to treeview Dynamically ...

Winforms or WPF MVC

All, As far as I understand ASP.NET MVC is the framework that implements the MVC pattern released my Microsoft. I wonder why there is no Winforms or WPF MVC implementation ? The reason I am asking is that I am planning to start on a new big WinForms project and ideally we are looking for a framework that implements some kind of common...

Examples of fast .NET WPF/WinForms apps?

I am currently investigating whether to build a windows application using unmanaged C/C++ or in .NET and would like to know of the kind of performance and responsiveness that is capable with a managed C#/.NET GUI app? Not surprisingly it looks like the fastest most responsive applications (e.g. chrome, spotify, etc) are written in unman...

WPF: Should I manually call Close on windows opened by ShowDialog method?

The thing is that WPF Window doesn't implement IDisposable interface which led me to believe, that I don't have to manually dispose of it when I open it by calling ShowDialog() but the first comment on this MSDN page states differently. Does anybody know what's the truth? ...

Unhandled exception

What is the best way to handle an unhandled exception in a WPF application? ...

How to get Width of a Grid on Property Changed in WPF

i would like to get a grids actual width (or height) and display it in a textbox, but the width/height should be "live", when i resize the window i would like to see the new sizes. any ideas? thx ;) ...

EF model from 2 tables connected with junction table - Model don't see records and changes in junction table

I have several tables in my SQL2008 DB, Managers(ManagerID is a PK, incremental) and Customers(CustomerID is a PK, incremental) are among them. All ID columns are int. They are connected with junction table ManagersCustomers(fields: CustomerID is a PK, ManagerID) and there are relations: from CustomerID in Customers to same in junction t...

Nonstandard floating layout - grow then stop

Here is the sample pseudo XAML code <Window> <Grid Rows="2"> <Listbox Row="0"/> <Button Row="1"/> </Grid> </Window> Grid doesn't work here, just for example Listbox is databinded and can have multiple items Button is placed under the ListBox - immediately under, not on bottom of window Listbox can grow, mov...

Expand arrow in TreeView

I try to explain a little more. I have a class whose name is Resource . It keeps childrens for every single node. class Resource { public List<Resource> Children {get;set;} public ResourceItem Item {get;set;} public bool IsCollapsed {get;set;} } class ResourceItem { public string Name {get;set;} public string ImagePath {get;...

How to set focus in a programmatically created textbox?

What do I need to do to the following code so that the cursor is blinking in the second textbox when the window appears? XAML: <Window x:Class="TestFocksdfj.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="30...

How to scope NHibernate sessions and transactions in a WPF application

I am relatively new to both WPF and NHibernate and attempting to build an application that combines the two, using the MVVM pattern. However, I am struggling to understand when and where my application should open and close NHibernate sessions and transactions. From what I have read, it is recommended that sessions should be kept as sho...

Transaction support in an observable collection

I'm interested the most efficient way to change an observable collection in such a way that only one property changed is fired. Lets say that I want to populate the list with 3 items, there is no addCollection method or something like that, so I have to do clear + 3 times add. Do I need to create a different observable collection and ass...