wpf

WPF Grid layout panel with row height set to "Auto"

I'd like to have a Grid with a row on the top and bottom with either labels or buttons in them. In the middle I plan on using a ListBox. I want the ListBox to expand to use all the available space. It would be nice to not hard code the height of the other two rows. My XAML is below. How can I make the middle section expand automatic...

best practice for rendering a set of controls in WPF?

I'm creating a WPF application that is similar in layout to Microsoft Outlook, where you have some navigation buttons on the left and then a grid on the right hand side that displays content. I'd like this content area (which is just a Grid, split into a left side of specific Width, and then Width="*" for the right side) to change based ...

WPF Creating Custom Events

I am working on a part of a menu to allow it to be re-organized by its user. This menu has a grid(4x3) with 12 elements, all of which are of the type NavButton, a class I created that extends Button. In the NavButton I have a drag feature that allows the buttons to be moved throughout the grid and currently I am working on determining wh...

Containing hidden "objects" in ListviewItem, with inheritance?

Hello! I have a listview control, and it's data refreshing continously. I'd like to 'put' an XElement into a row, so I if e.g. double-click on the row, the double-click would call a method, with the 'hidden' xelement parameters. I hope I started to solve it, the debugger doesn't show any errors, but I don't know how to reach the XEleme...

Is this thread/background worker design for a C# WPF application OK?

Being new to using threads etc in UI's, can I ask is the following simple design seem OK. Refer to diagram image at link here In particular: a) use of backgroundworker & backgroundworker ProgressChanged to have the aggregator work on a separate thread. So I would need a custom class/type that had all the data I'd need to pass back fro...

How to show/hide a panel.

When the mouse hover, the panel will be show on the left side and leave the mouse it will be hiden. How to do that in WPF? Is there any component? ...

WPF Binding and Using Custom Sample Data in Visual Designer

Quick 1 sentence summary: I wrote a demo app [download src here][1] that doesn't properly display sample data in the Visual Studio Designer and I need help. After 6+ years developing in C# and WinForms, I've decided to use WPF in my current project. I've written a small demo application to teach myself and experiment with WPF (you can s...

can a worker thread read a control in the GUI?

I got a thread running every few seconds fetching some data from a db but this is based on the selection on a listbox and on a few checkboxes... can I read the values of these controls without using the GUI thread? The data is also read whenever one of the controls change, but the data might change in db without warning...hence the thre...

Change ControlTemplate of ContentControl in View using MVVM

I have two resources Dock and Undock in my View which is a UserControl(Dock.xaml), Following is xaml code <Grid> <ContentControl Template="{StaticResource Dock}"/> </Grid> In DockViewModel there is property called IsDocked,if its true i need to apply Dock otherwise Undock template How to change the template in view using Vi...

Wpf button text in Expression Blend

Normally, If i use the button in C# Windows form, and if the button text is too long, it will go to next line. (Eg. Very Happy, Happy will go to next line). But When i use wpf app in expression blend, the text will be truncated even though i set the auto size to false. (Eg. Very Happy, Happy will be truncated). Any advice would be really...

Splitting Generic.Xaml - problem loading merges set. Please help with Source.

Hello, working on a pretty large library of controls the generic.xaml gets simpy out of control. I want to split it pretty much by control (although once for a namespace which contains only some simple ones for now). For that, i am adding more Resource Dictionaries. Then, in the generic.Xaml I add: <ResourceDictionary.MergedDictionar...

How to initialize UserControl's CLR property in the following case?

I’ve created UserControl: public partial class MyTemplate : UserControl { public MyUser User { get; set; } } And then have written the following code in the main window’s xaml <Window.Resources> <DataTemplate x:Key="My"> <local:MyTemplate Margin="10"/> </DataTemplate> <Window.Resources> <ListBox x:Name="MyMainList"...

How to use WPF's asterisk size value in codebehind?

I create some control in codebehind and would like to set its size dynamically. I can assign numerical values as well as System.Windows.GridLength.Auto, but there is no equivalent to "*". Is that because the "*" from XAML gets translated into code when the WPF gets parsed? To give this some detail: There is a grid with three rows. I wan...

WPF: Dynamic Actions in Template

Hi, I've defined a control Template for a progressbar to make it look like a thermometer ... now i want it to change its color when reaching a certain value (for example .. when the progressbar has the value 70, its color should change to yellow) Currently the color of PART_Indicator is bound to the background color of the progressbar ...

adding a custom namespace to xaml

i am quite new on c#, wpf and xaml etc then i may not be able to use the right terms to ask the right question=) i am trying to add my own namespace to my xaml file in order to use my own class easily-i guess the reason is this- i wrote that command in window tag for this: xmlns:myns="clr-namespace:LibNameSpace" where my window tag als...

drag an email from thunderbird into a ListView

I'm trying to drag an email from Thunderbird into my Window. If I drag the mail into Desktop, Windows create a file with .eml extension. If I drag into my software, DataObject contains the following: Format: application/x-moz-file-promise-url MemoryStream: news://aioe.org/1jlkokt.1c9t0vz1nl7jtqN%25sapo68%40gmail.com?group=it.comp.os....

Disabled WPF Datagrid

I've recently started to use Visual Studio 2010 and its new version of the WPF Datagrid control. I've noticed something weird with it and was wondering whether it was my code, by design or a bug in the control? I've created a simple datagrid and bound it to a dataview. If I set its IsEnabled attribute to false, I would expect not to b...

How can I define a GridView for a WPF ListView so that the ListView items are distributed over more than one column?

I have a data-bound ListView in WPF with the ListView items being rendered as RadioButtons. I want to use a GridView to display these in a grid. I can find numerous examples for using a GridView where the data is to be displayed in columns (with different item properties in each column) but I want an entire child item in each cell not ...

LostFocus event problem and Button Command in wpf.

Hi, I have a textbox and inside its lost focus event, I show a new window and give the user choices, I also have a button below the text box. Now, when I change the value of the text box..and click the button (while the cursor is still inside the text box...) the lost focus event gets fired... but as I show a modal window dialog, the ...

WPF binding of string property and Button.Content

I want to bind string property with Button.Content. But why it didn't work? The data class: namespace test4 { public class Test : INotifyPropertyChanged { string _Text = "Begin"; public string Text { get{return _Text;} protected set { _Text = value; } } publi...