Home > other >  WPF custom Windows cannot when the design preview
WPF custom Windows cannot when the design preview

Time:12-25

Used to build custom controls (not user control) method to build a custom Windows

 
XMLNS: x="http://schemas.microsoft.com/winfx/2006/xaml"
XMLNS: local="CLR namespace: ExControls" & gt;

<style TargetType="{x: Type local: ExWindow}" & gt;






</style>



Then, define the class

 
Public class ExWindow: Window
{
The static ExingWindow ()
{
DefaultStyleKeyProperty. OverrideMetadata (typeof (ExWindow), new FrameworkPropertyMetadata (typeof (ExWindow)));
}

///& lt; Summary>
///constructor
///& lt;/summary>
Public ExingWindow ()
{
Enclosing WindowStyle=WindowStyle. None;//plus the also not line, form the WindowStyle constant, when the design only at run time change
}
}


Finally in Generic. The xaml file references the form



The last word in the project, cannot when the design preview,



But at runtime, excuse me everybody who met this kind of phenomenon? Is how to solve?
  • Related