c# - Black Background occurs when using microsoft.windows.shell -
i using microsoft.windows.shell customize wpf window chrome. fine until added datagrid. problem appearance of window become black sometimes. situation not happen constantly! looks fine has black background. here xaml code:
<window x:class="codegeneratorwpf.config" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="config" height="300" width="300" style="{staticresource mainwindowstyle}" windowstartuplocation="centerowner" loaded="window_loaded"> <grid> <grid.rowdefinitions> <rowdefinition height="*"/> <rowdefinition height="40"/> </grid.rowdefinitions> <datagrid name="datagrid" grid.row="0" itemssource="{binding data}" alternatingrowbackground="{staticresource {x:static systemcolors.controlbrushkey}}" cliptobounds="true" verticalgridlinesbrush="{dynamicresource {x:static systemcolors.controllightbrushkey}}" horizontalgridlinesbrush="{dynamicresource {x:static systemcolors.controllightbrushkey}}" loadingrow="datagrid_loadingrow"> <datagrid.rowheadertemplate> <datatemplate> <textblock text="{binding relativesource={relativesource ancestortype=datagridrow}, path=header}"/> </datatemplate> </datagrid.rowheadertemplate> </datagrid> <grid grid.row="1"> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="*"/> </grid.columndefinitions> <button name="btnsave" grid.column="0" content="save" style="{staticresource emphasizebutton}" horizontalalignment="stretch" margin="25,5,25,5" click="btnsave_click"/> <button name="btncancel" grid.column="1" content="cancel" style="{staticresource normalbutton}" margin="25,5,25,5" click="btncancel_click"/> </grid> </grid> </window>
the mainwindowstyle:
<!--captions buttons control window borderless--> <dockpanel grid.row="0"> <dockpanel.background> <solidcolorbrush color="#ff5d91dc"></solidcolorbrush> </dockpanel.background> <image name="imgtitle" source="{templatebinding icon}" dockpanel.dock="left" margin="5"></image> <label content="{templatebinding title}" foreground="white"></label> <ctrl:captionbuttons margin="0,0,0,0" grid.row="0" horizontalalignment="right" type="full" foreground="{dynamicresource captionbuttoncolor}" fontsize="14" marginbutton="0,0,5,0" verticalalignment="center" shell:windowchrome.ishittestvisibleinchrome="true"> </ctrl:captionbuttons> </dockpanel> <contentpresenter margin="0" grid.row="1" content="{templatebinding content}"/> </grid> </border> </controltemplate> <style x:key="mainwindowstyle" targettype="{x:type window}"> <setter property="shell:windowchrome.windowchrome"> <setter.value> <shell:windowchrome resizeborderthickness="6" captionheight="25" cornerradius="0" glassframethickness="0,0,0,1" /> </setter.value> </setter> <setter property="template" value="{staticresource mainwindowcontroltemplate}"/> </style>
can help?
Comments
Post a Comment