wpf - Style border and Title Bar cause NullReferenceException -
i want change form
border , title bar , fount this solution. after add xaml
(i using first solution in first answer) application running , can see style
changed after few seconds can see exception in designer:
my application still run , show new style happening again , again, try remove , add changes several times error still jump after while. update
this code added xaml
:
<window x:class="csharpwpf.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" > <windowchrome.windowchrome> <windowchrome captionheight="{binding actualheight,elementname=titlebar}"/> </windowchrome.windowchrome> <dockpanel lastchildfill="true"> <border background="lightblue" dockpanel.dock="top" height="25" x:name="titlebar"> <textblock text="{binding title, relativesource={relativesource findancestor,ancestortype=window},fallbackvalue=title}" margin="10,0,0,0" verticalalignment="center"> <textblock.effect> <dropshadoweffect color="white" shadowdepth="3"/> </textblock.effect> </textblock> </border> <border borderbrush="lightgray" borderthickness="1" padding="4"> <textblock text="window content"/> </border> </dockpanel> </window>
Comments
Post a Comment