wpf

WPF: Why doesn't the contentpresenter fill the grid cell?

Ok I have a contentpresenter inside a grid cell: <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> ...

byte[] to gray scale BitmapImage

I start out with a 128 x 128 array of doubles and turn that into a 1D array of bytes with proportional values for each double. I then take this array of bytes and turn it into a memory stream (dataStream below) and try and put that into a BitmapImage like so: imgScan.Width = 128; imgScan.Height = 128; BitmapImage bi = new BitmapImage()...

How do I properly style a button in WPF?

I know this is a basic question, but I'm having a bit of trouble understanding how to do this properly. Given the following XAML: <Button> <Grid Grid.Row="1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="16" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Image Grid...

Combobox selection problem (Wpf theme BureauBlue)

I am using WPF theme BureauBlue, I can only open down items in combobox by clicking the right side arrow on the control. But I should open it clicking any part of combobox. This problem is ruling for all themes. Any idea to solve this issue? ...

ItemsSource data type displayed in DataGrid

Hello Stackies I'm using a DataGrid inside a StackPanel inside a Grid which causes the GridView to be wider than its preferred size. All the columns are displayed correctly but after the last column the end of the ItemsSource data type name is displayed. Apparently its is drawn in the background and hidden by the columns in the normal c...

How to get databound TreeViews selected TreeViewItem's Header section height without child heights

I am using a WPF treeview with couple of heierachical datatemplates. Treeview has a drag drop capability. Can someone please help me to get the selected TreeViewItem's Header section height (Actual Height). If I get the selected items ActualHeight(TreeViewItem.ActualHeight) then it will give the height with the children. But I want is ...

Databinding selectedindex + 1

Hi, I would like to bind a textbox to show the text of the item below the item that is selected. Example: Item 1 - Text = row numer one Item 2 - Text = row number two Item 3 - Text = row number three I select item 2 output Textbox 1 - Text = row number two (this is easily set up binding to selecteditem) Textbox 2 - Text = row num...

WPF expander size issue

I am using an items control to place n number of expanders. My items control will be placed in a grid with height 600 (for example). I want to make sure my items control will always ocupy entaire available height, to do so it can expand some of the expanders. What will be the best approch to do so? Any suggestions will be appriciated. ...

Binding to DateTime.Now. Update the value

Well, I needed to bind DateTime.Now to a TextBlock, I used that: Text="{Binding Source={x:Static System:DateTime.Now},StringFormat='HH:mm:ss tt'}" Now, how to force it to update? It get's the time when control is loaded and wouldn't update it... ...

What is the proper way to handle multiple datagrids in a tab control so that cells leave edit mode when the tabs are changed?

In wpf I setup a tab control that binds to a collection of objects each object has a data template with a data grid presenting the data. If I select a particular cell and put it into edit mode, leaving the grid by going to another tab this will cause the exception below to be thrown on returning the datagrid: 'DeferRefresh' is not allo...

Browse on remote computer using SaveFileDialog in WPF

Hi all, I am doing a WPF applications that controls different processes (every process communicates with the GUI over the network). I want to be able to send a command to those processes asking them to save some information in a file on their computer. For now, in the GUI, I simply display a TextBox and the user must enter the correct f...

"Week of the year" Algorithm needs improvements

I have an algorithm which scans through data read from a .csv file(approx 3700 lines) and assess's which trading week of the year each entry is in by running a count++ for every Sunday of that year and assigning the count value as the trading week when the date falls within that week. It's working but performance is lagging. It is the ...

How do I access the controls in a WPF DataGrid

In good old (well!!) WinForms days the datagrids row used to the be the actual control and you could then access the DataItem. In WPF its all flipped and dataGrid.Items is just the source data. I am probably doing this the wrong way round as im a bit of a WPF newb but how can I iterate through the rows of my gridview grabbing the value...

is it possible to use Winform components in WPF

Hello All, We have a product which is developed using Winforms - .net 2.0. Now we are thinking about migrating this application to WPF. Is is possible to use the same Winform components in WPF. Or if it is not possible, then which is best possible ways to Migrate this application to WPF. Thanks and regards Harsha ...

changing textblock to textbox loses data bindings -

this is a wpf/c# app - I have one grid where I used text boxes and the data bindings were fine. I later built another grid using textblocks. both worked well. but when I changed the textblocks in the second grid into textboxes, all but one stopped displaying data. I copied both the c# LINQ code and the XAML code that provide the data f...

WPF, Expression 4: ArgumentNullException spam in the UI?

Hi all, I'm working with a new WPF project in .NET 4.0 using the Expression 4 beta, but when opening up a project that originated in the VS designer Expression is throwing all sorts of exceptions. It seems to happen as a reaction to a variety of different actions--selecting a control, moving a control, basically any manipulation of the ...

Cell color of WPF DataGrid back to the default

I'm using buildin WPF DataGrid in .net 4. I can set the background of a DataGridCell programatically like below. DataGridCell dgc = this.GetCell(i, j); //GetCell is extension func dgc.Background = Brushes.LightGray; My question is, how can i remove the background color i set and back to the default? By "default" I mean the default t...

Popup Stays Open with StaysOpen = "False"

Hello All, I've created a WPF Popup with StaysOpen = "False". Nonetheless, it stays open if I click outside the Popup but still within the app's main window. (If I click outside the main window, then the Popup will properly close.) For this Popup, I have tried both Placement = "MousePoint" and Placement = "Mouse". I do believe that th...

Databinding Issue With Custom ObservableCollection Properties

I'm making a small personal finance program that uses "envelopes" as the budgeting method. I'm mostly doing this as a means to learn WPF & MVVM. I've run into a problem where I can't databind to the custom properties I created in my custom ObservableCollection, seen here: public class ObservableEnvelopeCollection : ObservableCollection<...

Binding the content of a Span

I have a window that displays text. There are two parts to the text: the first is fixed while the second needs to be the content of a DependencyProperty declared on the window. I considered using a TextBlock containing two Spans, the first of which contains the fixed content and the second of which contains the variable content, but I ...