wpf

WPF Datagrid read a cell value

Hi, I am trying to find out how to read the value of my WPF datagrid cells. something along the lines of String myString = myDataGrid.Cells[1][2].ToString(); the datagrid has been created in XAML and i have populated the datagrid with row data by using reportGrid.Items.Add(new cbResultRow() { ... }); now I want to go back and r...

How can I set the LISTBOX tooltip through XAML

I have a list box in WPF as under <ListBox Name="lstName" DisplayMemberPath ="ListName" ToolTip="{Binding Path=ListName}" /> My requirement is that what ever items I am displaying in the listbox, should also appear in the tooltip. i.e. if the items are say "Item1", "Item2" etc. then when the user will point(hover) to "Item1" through m...

WPF, Silverlight or WinForms?

The company I work for has an existing product which is a Delphi 32 bit windows application. The application has a spreadsheet like UI which requires a very fast data grid/table view and advanced charting (plus the usual button/dropdown/menuing/toolbar controls). We also have a .net 3.5 ASP.NET application which mirrors large parts of ...

Setting the UserControl property to child controls - WPF, Sliverlight

I have a Usercontrol with a Button and TextBlock in it. I would like to set the Background of both Button and TextBlock with the Background of the Usercontrol.(ie, I am trying to Bind to the usercontrol's Background property). Please let me know how can I do this in XAML. Is there any difference for this in Silverlight and WPF? ...

MVVM Light: Bind event to command in code behind

Hi I am using MVVM light to bind events on UIElements in my View to ICommands in my view model, and this is working very well. However - I have a situation where I have to create some controls on the fly, and I'm doing this in the code behind on the view as this seems the best place to do it, and it is after all UI code. As I am genera...

Programmatically generated image doesnt have a CanvasLeft

Whilst that title is a slight lie it defines the problem. I have an image on a WPF Window of which the root element is a Canvas, this image has various event handlers attached to allow me to drag it around the window. This all works fine, but when I add a new Image to the canvas' children and bind the same event handers the Image does ...

Wpf: Grid: How can i share colum/row height width?

I have a grid with 3 columns and 5 rows: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> ...

StaticResource Markup Extension vs. System.Windows.Application.FindResource

I've defined a BitmapImage in my ResourceDictionary like that: <BitmapImage x:Key="Skin_Image_Back" UriSource="./images/back.png" /> and loaded the ResourceDictionary like that var dict = Application.LoadComponent( new Uri("TestProject.DefaultStyle;component/Style.xaml", UriKind.Relative)) as ResourceDictionary; Application.Cur...

How to keep a nested grid square without using ViewBox?

This is similar to how-do-i-keep-aspect-ratio-on-scalable-scrollable-content-in-wpf, with the following differences: I'd like to avoid side-effects of the ViewBox - while the grid should resize when the container resizes, some of the grid content should keep their sizes (buttons for example). I don't need aspect ratios other than 1:1 (...

How to put textboxes into a datagrid?

VS 2010, WPF project. I have a datagrid with text in all cells (data are from an array of custom objects). However I am unable to copy (ctrl+c) content of any cell. So I would like to use textboxes to display content of each cell. The real problem is I cannot do this in XAML but I have to do it dynamically in the code, because entire gr...

WPF XAML: How to automatically scale down children of a component in XAML?

Here's my problem: xaml file 1: a templated list control <ItemsControl ItemSource={Binding myUIrelatedDataList}/> <ItemsControl.ItemTemplate> <DataTemplate> <my:DynamicUIPresenter Width="160" Height="80"/> <!-- here, I want to specify my desired size to which i want to scale down the gene...

Making a silverlight UserControl fill the space available within content control

I have various user controls that get placed in a content control within my Silverlight App. At present I am hard coding the width and height of the controls to fill as they don't stretch. I have set the HorizontalAlignment and VerticalAlignment to strecth (on the usercontrol and DataTemplate), but they still don't fill the space availab...

Binding a subclass property

In WindowViewModel There is a property called statusBar In StatusBarViewModel , There is a property called public BatteryIndicatorViewModel batIndicatorViewModel In BatteryIndicatorViewModel , There is a property called public bool IsLowBattery <MultiDataTrigger.Conditions> <Condition Binding="{Binding statusBar.batIndicatorViewModel....

wpf simple print dialog page size issue

I'm creating a simple WPF print dialog box to setup a label printer. I want it to be very simple and so I've choosen not to use the standard WPF printdialog. All is going well accept for one thing, paper sizes. Having selected a printer from one combobox, a second combobox is populated with the paper sizes available from that device. ...

WPF Moving Adorner outside the AdornerLayer or Window

I have an adorner which is moving along with the mouse cursor. However as soon as the mouse moves outside the window the adorner gets cut off. Is it possible to expand the adorner layer to the whole screen or create a new adorner layer. ...

Silverlight binding to an object contained in a list

I am trying with difficulty to use binding on an object which is contained in a list, so for example: Class A { IList<Class B> Items; } Class B { string name; } I want to have in xaml for example <Textblock Text="{Binding ClassA.Items[5].name}"/> So any ideas? much appreciated ...

WPF: How to get Radiobuttons to display as a horizontal row of ToggleButtons

Hi everyone! I'm currently building a UI that is going to be used in a touch panel. Therefore, I would like to display any RadioButton groups as horizontal rows of ToggleButtons. I already figured out how to display ToggleButtons instead of the standard bullet items: <Style x:Key="{x:Type RadioButton}" TargetType="{x:Ty...

WPF C# - ComboBox methods return object instead of string

I'm new to WPF and I'm trying to figure out how to get the current text value of the selected item in a ComboBox. I saw in this question someone suggested doing MyComboBox.SelectedItem.Text. However, SelectedItem returns object for me, so I only have options like ToString(), Equals, etc. What's going on? I'm using .NET 3.5, developin...

Serious trouble with ILMerge and .NET 4.0

For the life of me, I can't seem to get my .NET 4 application merging properly with ILMerge. Even after setting /targetplatform, /lib, /ndebug and adding a custom ILMerge.exe.config file the output file doesn't work properly (it doesn't seem to be able to "find" the merged libraries). I've tried this and this to no avail. I can't even g...

WPF: Row of ToggleButtons with equal length?

Hi all, I'm currently displaying RadioButtons in my application as rows of ToggleButtons (see my last question). However, I'd like the buttons to be of the same width - currently, every button is just as wide as it has to be. Since I'm working with templates, I'd like to avoid specifying the width every time I use the control if poss...