Skip to content

Instantly share code, notes, and snippets.

<ItemsControl ItemsSource="{Binding Parameters}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
public class FormElement
{
public string Name { get; set; }
public object Value { get; set; }
}
public class FormElement<T> : FormElement
{
}
<DataTemplate DataType="{x:Type Elements:DateElement}">
<DockPanel>
<TextBlock Text="{Binding Name}" DockPanel.Dock="Left" Width="80"/>
<DatePicker SelectedDate="{Binding Value}" />
</DockPanel>
</DataTemplate>
<DataTemplate DataType="{x:Type Elements:StringElement}">
<DockPanel>
<TextBlock Text="{Binding Name}" DockPanel.Dock="Left" Width="80" />
<%@ ServiceHost
Language="C#"
Service="WcfService.GenericService`1[[WcfInterfaces.SpecificEntity, WcfInterfaces]]"
CodeBehind="GenericService.cs" %>
public class GenericService<T> : IGenericService<T> where T : EntityBase, new()
{
public T GetEntity(string text)
{
var t = new T() { Text = text };
t.Initialize();
return t;
}
}
@mathieubrun
mathieubrun / gist:4702790
Created February 3, 2013 17:48
Inherit WPF styles, longer
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel>
<StackPanel.Resources>
<Style TargetType="TextBlock" x:Key="DefaultTextBlock">
<Setter Property="Background" Value="Red" />
</Style>
<Style TargetType="TextBlock"
BasedOn="{StaticResource DefaultTextBlock}">
@mathieubrun
mathieubrun / gist:4702765
Last active December 12, 2015 02:58
Inherit defaut wpf style
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel>
<StackPanel.Resources>
<Style TargetType="TextBlock">
<Setter Property="Background" Value="Red" />
</Style>
<Style TargetType="TextBlock" x:Key="Custom1">
<Setter Property="Foreground" Value="Blue" />