wpf

ListView items not rendering in GridView columns

I've got a ListView control bound to an ObservableCollection of items, and I've set it's view to a GridView with columns bound to properties Data. Things seem to be ok, but the data in the source properties aren't being rendered at all. Here's the ScanData struct: struct ScanData { public ushort Port; public bool? Status; ...

Passing the all column values to a multibinding

I have a ListView that is configured as a GridView. It is databound to a DataTable and displays several columns of ints. I'd like to display the maximum value in each column in the bold font. To do this, I have a MultiBinding on the FontWeight of each cell. It is easy enough to pass the cell value to the MultiBinding converter. But how...

How to create a WPF UserControl with NAMED content

I have a set of controls with attached commands and logic that are constantly reused in the same way. I decided to create a user control that holds all the common controls and logic. However I also need the control to be able to hold content that can be named. I tried the following: <UserControl.ContentTemplate> <DataTemplate> ...

WPF TextBlock highlight certan parts based on search condition

Hello, I have TextBlock that has Inlines dynamicly added to it (basically bunch of Run objects that are either italic or bold). In my application I have search function. I want to be able to highlight TextBlock's text that is in being searched for. By highlighting I mean changing certain parts of TextBlock text's color (keeping in mi...

WPF MVVM + UserControl with Code Behind.

For some reason I'm having issues Binding a custom User Control up through my ViewModel in an MVVM WPF application. The basic control is a Date entry form with three text boxes. I am using the codebehind for the usercontrol to capture the textchange event and so some manipulation. For some reason Adding Binding to the property never t...

Does WPF use the installed color profile(ICC) in windows?

Does WPF use the installed color profile in windows for correcting the colors that are rendered? I'm pretty sure old forms/gdi-based applications are not "automatically" color corrected, but I wonder if WPF does (or can be made to do) this automatically? (I know I can do this manually in my own WPF apps by creating a gpu shader to do th...

How to get "native" look for WPF widgets on windows XP?

I have just started playing around with WPF. I've noticed that while some widgets automatically pick up the native look and feel (e.g, buttons, menus), some others don't (e.g., labels, panels and windows have white backgrounds). How do I make all widgets look normal by default in WPF? ...

Going fullscreen on secondary monitor

How can you program a dotNet Windows (or WPF) Application in order to let it going fullscreen on the secondary monitor? ...

What is the best way to convert between a Media.Matrix to a Drawing2D.Matrix

I have the need to convert from the WPF Media.Matrix to the Windows Forms Drawing2D.Matrix and so I did the following: public static System.Drawing.Drawing2D.Matrix ConvertToDrawing2DMatrix( Matrix matrix) { return new System.Drawing.Drawing2D.Matrix((float)matrix.M11, (float)mat...

Polygon Boundary not matching visual on a Canvas with a ScaleTransform

The following XAML is simply a Polygon on a Canvas that is scaled x2000. There is a trigger that changes the Fill color for the Polygon when the mouse is over it. Why does the box change color when you hover your mouse above and to the left of the Polygon. <Canvas Background="Black" Height="600" Width="600"> <Canvas.RenderTransf...

WPF Image Source Binding

I have a ListBox with ItemTemplates and some data bindings, including an Image The ItemsSource is set in the codebehind. Everything works as expected until the app tries to change the image's source by updating the object's member, which is bound to the image source. What am I doing wrong? Here's the XAML: <ListBox x:Name="myList" Mou...

WPF button textwrap style

Hi, How do I change the default textwrapping style of a button in WPF? The obvious solution of: <Style x:Key="MyButtonStyle" TargetType="{x:Type Button}"> <Setter Property="TextWrapping" Value="Wrap"></Setter> </Style> doesn't work, because Textwrapping isn't a settable property here, apparently. If I try: <Style x:Key="MyButt...

How can I implement a "pass-through" DataBinding?

A little background: I am loading a WPF UI from a database which is stored in a table of properties (Control type, label, margin, etc.) which I load into a class I call ControlPresenter. Basically I set ControlPresenter as the DataContext of a ContentPresenter and use a TemplateSelector to choose which type of control to load. The DataTe...

How to underline a TextBlock on a MouseEnter

Hello all, In a WPF form, I have the following TextBlock. When I move my mouse over it, I would like to see the text of the TextBlock underlined. How can I do that? I tried with TextBlock.Triggers, but it didn't work. Thanks! ...

How to animate a Window?

With WPF, how do I animate the position of a Window. I tried to simply animate the Left/Top properties, but it didn't work. Does anybody know how? Thanks! ...

WPF - Display single entity with a data template

I Have a data template that i use in items control, i wanna know if its possible some how to use it(the template) on single item display without the items control? if not whats the best way to do it...? ...

Routed events in wpf

Hi, A very well known fact is that routed events only travel up or down the ancestry and not through all the elements. But an equally known fact is that an event handler can be wired in the common parent of two disparate controls. My questions is how, some pointers please. I have XAML that looks like <Grid Name="MainGrid"> <Lis...

WPF Window MinWidth depending on size of toolbar

Hello, Before asking this question I have looked at all related questions, but have not found anything relevant. In my application I have toolbox style bar, which is basically stack panel with bunch of buttons. User may change which buttons are shown in toolbar. Window width may be changed, but it can not be smaller then width of tool...

applying function on a value returned from MarkupExtension in xaml

Is there a way to apply a function on a value returned from a MarkupExtenstion such as {Binding ... } or {StaticResource ...} in XAML? Usage example: making the font size of button1 to be twice bigger than the font size of button2? ...

c# code for select all checkbox in wpf datagrid

I need some c# code to select / deselect all checkboxes in a datagrid in WPF 3.5 framework. I would like to do this by clicking a single header checkbox in the grid. Please help. ...