This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TemplatePart(Name = "PART_OverlayAdorner", Type = typeof(AdornerDecorator))] | |
public class Overlay : ContentControl | |
{ | |
public static readonly DependencyProperty OverlayContentProperty = | |
DependencyProperty.Register("OverlayContent", typeof(UIElement), typeof(Overlay), | |
new FrameworkPropertyMetadata(new PropertyChangedCallback(OnOverlayContentChanged))); | |
public static readonly DependencyProperty IsOverlayContentVisibleProperty = | |
DependencyProperty.Register("IsOverlayContentVisible", typeof(bool), typeof(Overlay), | |
new FrameworkPropertyMetadata(new PropertyChangedCallback(OnIsOverlayContentVisibleChanged))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Style TargetType="{x:Type Label}"> | |
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> | |
<Setter Property="Background" Value="Transparent"/> | |
<Setter Property="Padding" Value="5"/> | |
<Setter Property="HorizontalContentAlignment" Value="Left"/> | |
<Setter Property="VerticalContentAlignment" Value="Top"/> | |
<Setter Property="Template"> | |
<Setter.Value> | |
<ControlTemplate TargetType="{x:Type Label}"> | |
<Border SnapsToDevicePixels="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Application.Current.Resources = Application.LoadComponent( | |
new Uri("Company.MyAppliction;component/Themes/MyImplicitStyles.xaml", UriKind.Relative)) | |
as ResourceDictionary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Application.Resources> | |
<ResourceDictionary> | |
<ResourceDictionary.MergedDictionaries> | |
<ResourceDictionary Source="MyImplicitStyles.xaml" /> | |
</ResourceDictionary.MergedDictionaries> | |
</ResourceDictionary> | |
</Application.Resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ListBox> | |
<ListBox.Template> | |
<ControlTemplate TargetType="{x:Type ListBox}"> | |
<Border x:Name="Bd" SnapsToDevicePixels="true" | |
Background="{TemplateBinding Background}" | |
BorderBrush="{TemplateBinding BorderBrush}" | |
BorderThickness="{TemplateBinding BorderThickness}" | |
Padding="1"> | |
<Grid> | |
<Image HorizontalAlignment="Right" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Found binding error | |
FrameworkElement element = parent as FrameworkElement; | |
if (element != null) | |
{ | |
var elementAdornerLayer = AdornerLayer.GetAdornerLayer(element); | |
Adorner[] adorners = elementAdornerLayer.GetAdorners(element); | |
if (adorners != null) | |
{ | |
foreach (Adorner a in adorners) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void CheckForBindingErrors(DependencyObject parent) | |
{ | |
// Examine parent for binding errors | |
LocalValueEnumerator localValues = parent.GetLocalValueEnumerator(); | |
while (localValues.MoveNext()) | |
{ | |
LocalValueEntry entry = localValues.Current; | |
if (BindingOperations.IsDataBound(parent, entry.Property)) | |
{ | |
BindingExpression binding = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ViewModelBehavior | |
{ | |
public static readonly DependencyProperty LoadUnloadProperty = | |
DependencyProperty.RegisterAttached("LoadUnload", typeof(Boolean), | |
typeof(ViewModelBehavior), | |
new FrameworkPropertyMetadata(false, | |
new PropertyChangedCallback(OnLoadUnloadChanged))); | |
public static void SetLoadUnload(FrameworkElement element, Boolean value) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IViewModel : INotifyPropertyChanged | |
{ | |
bool Initialized { get; set; } | |
void Load(FrameworkElement element); | |
void Unload(FrameworkElement element); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cbuffer CB | |
{ | |
matrix View; | |
matrix Projection; | |
matrix ViewProjection; | |
float4 FrustumPlanes[6]; // view-frustum planes in world space (normals face out) | |
float2 ViewportSize; // Viewport Width and Height in pixels | |