wpf

WPF Binding to method of a collection element

Im searching for the best practice (or any working solution) for the following scenario: I have an Employee class: public class Employee { public string DisplayName { get; set; } // It is important that this method has a parameter public string GetSomething(string param) { return param + DisplayName; } } I have a...

ListView Binding refresh suggestion in WPF

I have an ObservableCollection bound to a list box and have a highlight mechanism set up with data triggers, when I had a simple set of highlighters (debug, warning, etc) I could simply enumerate the style with several data-triggers bound to the view model that exposes those options. I have now upgraded the system to support multiple us...

Localizing MVVM based WPF applications

What would be a good aproach to localize a MVVM based WPF allication that can change its language at runtime? Of course I could create a string property in the ViewModel for each and every string that is displayed somewhere in the View but that seems rather tedious to me. Is there a common approach/best practice for this? ...

split ARGB into byte values

I have a ARGB value stored as an int type. It was stored by calling ToArgb. I now want the byte values of the individual color channels from the int value. for example int mycolor = -16744448; byte r,g,b,a; GetBytesFromColor(mycolor,out a, out r, out g, out b); How would you implement GetBytesFromColor? To give the context I am pa...

HwndSource does not display the Adorner layer

When I host WPF controls that use adorners (the error border of the textbox) in a HwndSource the adorners are not shown. It seems that the adorner layer is not there. Why is that so and what can I do against it? Is this a known bug? ...

wpf rotate and translate transform issue on textblock

Hi, I've got a list of strings I'm binding to an items control. The strings are displayed in textblocks I've declared in the itemscontrol template. I've rotated the textblocks 270 so that the text is on its side - I've also translated the textblocks down by their width so that they are at the top of the page. My issue is they are now...

Invalid Cast Exception when trying to convert a property of a user control in a binding.

I have a user control that has a textbox. I have tried to expose the texbox's Text property by implementing a DependencyProperty with the same name in the UserControl. Thus: public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), ...

WPF Style to all control of one UserControl

Hello, Is there a way to apply a style to all controls of the same type in one user control dynamically, without applying in all controls of my application and without go to the control and set the style manually? EDIT The problem is that in my ResorceDictionary I have 2 styles, with the x:Key set <Style x:Key="ScrollBar_White" TargetT...

Send keys to WPF Browser control

Can I programatically send [UserID]{TAB}[Password]{CARRIAGE RETURN} to a webbrowser control which has a userID, password and Sign-in button there. I wanted to use my own virtual keyboard in my application. Any tips here? ...

FirstOrDefault() type error on return?

A RIA Domain service has this method... public virtual CmsDealer GetCmsDealer(string id) { return this.Context.CmsDealerSet.FirstOrDefault(p => p.Id == id); } The Wcf service has this... public CmsDealer GetDealer(string id) { return domainservice.GetCmsDealer(id); } When called with a nonexistent Id, the GetCmsDealer() cal...

WPF Checkbox control don´t react to MouseLeftButtonDown event

I have the following XAML code: <Grid Background="Blue"> <Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown"> <CheckBox MouseLeftButtonDown="CheckBox_MouseLeftButtonDown_1"></CheckBox> </Grid> </Grid> When i click the checkbox with the mouse left button, the declared event is not fired. Can anyone have an ...

How do I reference the Toggle Button Circle and override vertical alignment of the Aero theme Expander?

Currently, I am referencing the Aero theme in my App.xml file. In the main.xml file, I am using expanders to display the content in a resizable width app. (For this example, I limited the width to 500) The expander header content generally will be short, but it allows for up to 500 chars. Depending on the window size (600 pixels by defa...

Combo with 2D borders on XAML

I am working with XAML. How can I add a combo box with flat borders (Not 3D)? ...

How can I display a symbol in a string with c#?

I have a string that I want to display a symbol in (the division symbol you learn in elementary, not a slash). According to the character map, the font that I'm using to display the string (inkpen2) has a division symbol code of 0xD4. I want a string to be "5 symbol 7" and display it to the user. Is it possible to do this? ...

How can I display a negative symbol in .NET?

I want to display a negative symbol from a string in .NET. I want a string that represents an equation that looks something like this: 7--5=12 But when displayed, I want the 2nd minus sign to be slightly raised so it looks more natural as a negative sign instead of just 2 minus signs in a row. Is this possible? ...

WPF Datagrid row number.

I have a datagrid. I would like a column that displays simply 1 2 3 4 ... in the rows, up to as many rows as I have being created from my other data bindings. <dg:DataGridTextColumn Header="#" IsReadOnly="True" Binding="...." /> ...

Memory leak in xbap application

Hi, We are using many custom controls by inheriting form the WPFcontrols as the base and customizing it for our need. However, the memory used by these controls are not released, even after pages using the controls are closed, until the whole application is closed. As these application has to work for a whole day performance decrease...

Outline/Stroke the formatted text

Hi, I am rendering the FormattedText with different foreground color to different character(fore example first two red, next 2 yellow like..), now i have to display outline surrounded to this text. For apply outline(stroke) i have to convert this FormattedText into geometry and then draw geometry like Geometry textGeometry = FormattedTe...

How get this xaml to work from app.xaml

I made this UpButton.xaml file by converting it from an .ai-file that our graphics guys made but i just can't get it to work. I was thinking of making this some sort of template/style for buttons, but our buttons are made up from rectangles and not the button object. I've been fiddling with this since last Thursday, googled and tried ev...

Multicolumn ListView in WPF - errors

Hi, I am trying to define a multicolumn listview in xaml (visual studio 2008) and then add items to it in c#. I have seen many posts on this subject, and tried the various methods, but I am getting errors. my xaml code is below, VS does not flag any errors on it. <ListView Height="234.522" Name="chartListView" Width="266.337"> <ListV...