Posts

Showing posts with the label wpf

WPF DataGrid change cell value based on underlying data object

XAML <Window x:Class=" DataGridCellBackground.MainWindow " xmlns=" http://schemas.microsoft.com/winfx/2006/xaml/presentation " xmlns:x=" http://schemas.microsoft.com/winfx/2006/xaml " xmlns:DataGridCellBackground=" clr-namespace:DataGridCellBackground " Title=" MainWindow " Height=" 350 " Width=" 525 " DataContext=" {Binding RelativeSource={RelativeSource Self}} "> <Window.Resources> <DataGridCellBackground:DataGridCellValueConverter x:Key=" dataGridCellValueConverter "/> </Window.Resources> <Grid> <DataGrid ItemsSource=" {Binding Data} " Width=" 400 " Height=" 200 " CanUserAddRows=" False "> <DataGrid.CellStyle> <Style TargetType=" {x:Type DataGridCell} "> <Setter Property=" Template "> <Setter.Value...

WPF Toggle button group

<StackPanel> <RadioButton Content=" Left " Style=" {StaticResource {x:Type ToggleButton}} " /> <RadioButton Content=" Right " tyle=" {StaticResource {x:Type ToggleButton}} " /> </StackPanel>

WPF DataGrid change cell style based on underlying data object

XAML < Window x : Class = "DataGridCellBackground.MainWindow" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns : x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns : DataGridCellBackground = "clr-namespace:DataGridCellBackground" Title = "MainWindow" Height = "350" Width = "525" DataContext = "{Binding RelativeSource={RelativeSource Self}}" > < Window.Resources > < DataGridCellBackground : DataGridCellBackgroundConverter x : Key = "dataGridCellBackgroundConverter" /> </ Window.Resources > < Grid > < DataGrid ItemsSource = "{Binding Data}" Width = "400" Height = "200" > < DataGrid.CellStyle > < Style TargetType = "{x:Type DataGridCell}" > < Setter Property = "Background" > ...

Save window size & position in WPF

* Right Click on Settings.settings and Open With XML (Text) Editor * Add Top, Left, Height, Width & WindowState settings < Settings > < Setting Name = "Top" Type = "System.Double" Scope = "User" > < Value Profile = "(Default)" > 50 </ Value > </ Setting > < Setting Name = "Left" Type = "System.Double" Scope = "User" > < Value Profile = "(Default)" > 50 </ Value > </ Setting > < Setting Name = "Height" Type = "System.Double" Scope = "User" > < Value Profile = "(Default)" > 800 </ Value > </ Setting > < Setting Name = "Width" Type = "System.Double" Scope = "User" > < Value Profile = "(Default)" > 1200 </ Value > </ Setting > < Setting Name = "WindowSta...

Model-View-ViewModel in WPF

90 Minutes Video by Jason Dolinger DataModel-View-ViewModel pattern series by Dan Crevier

Free WPF Docking Library (like in Visual Studio)

Image
AvalonDock http://avalondock.codeplex.com/ Getting Started Tutorial

WPF Toolkit DataGrid & Chart example

Image
Download WPF Toolkit Create new WPF Project Add References to WPFTookit, WPFTookit.Design (DataGrid) Add Reference to System.Windows.Controls.DataVisualization.Toolkit (Chart) This is XAML < Window x : Class = "WpfDataGrid.Window2" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns : x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns : toolkit = "http://schemas.microsoft.com/wpf/2008/toolkit" xmlns : charting = "clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" Title = "WPF Toolkit DataGrid &amp; Chart" Height = "357" Width = "590" > < DockPanel LastChildFill = "True" > < toolkit : DataGrid ItemsSource = "{Binding Path=Data}" Height = "118" AutoGenerateColumns ...

WPF blinking cell

< Window x : Class = "WpfTable.Window6" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns : x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns : dg = "http://schemas.microsoft.com/wpf/2008/toolkit" Title = "Window6" Height = "158" Width = "271" > < Window.Resources > < DataTemplate x : Key = "BlinkCellTemplate" > < TextBlock TextAlignment = "Center" x : Name = "tbMessage" Background = "White" Padding = "5,0,0,0" > < TextBlock.Text > < Binding Path = "Price" NotifyOnTargetUpdated = "True" > < Binding.StringFormat > {0:#.0000} </ Binding.StringFormat > </ Binding > </ TextBlock.Text > ...