c# - How to disable the gray overlay when the hamburger menu is active in Material Design In XAML Toolkit (WPF) -
here's picture of overlay sample app:
here's git page of material design in xaml toolkit (you can download demo project here): toolkit:https://github.com/butchersboy/materialdesigninxamltoolkit
this property somewhere in material design in xaml toolkit library , asking if knows how set (or if overlay can turned off).
<window x:class="materialdesigncolors.wpfexample.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wpfexample="clr-namespace:materialdesigncolors.wpfexample" xmlns:domain="clr-namespace:materialdesigncolors.wpfexample.domain" xmlns:system="clr-namespace:system;assembly=mscorlib" xmlns:materialdesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:domain1="clr-namespace:materialdesigndemo.domain" xmlns:materialdesigndemo="clr-namespace:materialdesigndemo" title="material design in xaml" height="800" width="1100" textelement.foreground="{dynamicresource materialdesignbody}" textelement.fontweight="regular" textelement.fontsize="13" textoptions.textformattingmode="ideal" textoptions.textrenderingmode="auto" background="{dynamicresource materialdesignpaper}" fontfamily="{staticresource materialdesignfont}" icon="favicon.ico"> <window.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="pack://application:,,,/materialdesignthemes.wpf;component/themes/materialdesigntheme.button.xaml" /> <resourcedictionary source="pack://application:,,,/materialdesignthemes.wpf;component/themes/materialdesigntheme.shadows.xaml" /> <resourcedictionary source="pack://application:,,,/materialdesignthemes.wpf;component/themes/materialdesigntheme.togglebutton.xaml" /> </resourcedictionary.mergeddictionaries> <!-- data template used dialogs example, defines view viewmodel of type datetime --> <datatemplate datatype="{x:type system:datetime}"> <stackpanel margin="16"> <textblock>england win world cup:</textblock> <textblock margin="0 8 0 0" text="{binding }" /> <textblock margin="0 8 0 0" >you never see again.</textblock> <button margin="0 8 0 0" isdefault="true" command="{x:static materialdesign:dialoghost.closedialogcommand}" style="{dynamicresource materialdesignflatbutton}">awesome</button> </stackpanel> </datatemplate> </resourcedictionary> </window.resources> <materialdesign:dialoghost identifier="rootdialog"> <materialdesign:drawerhost isleftdraweropen="{binding elementname=menutogglebutton, path=ischecked}"> <materialdesign:drawerhost.leftdrawercontent> <dockpanel minwidth="212"> <togglebutton style="{staticresource materialdesignhamburgertogglebutton}" dockpanel.dock="top" horizontalalignment="right" margin="16" ischecked="{binding elementname=menutogglebutton, path=ischecked, mode=twoway}" /> <listbox x:name="demoitemslistbox" margin="0 16 0 16" selectedindex="0" previewmouseleftbuttonup="uielement_onpreviewmouseleftbuttonup"> <listbox.itemtemplate> <datatemplate datatype="domain:demoitem"> <textblock text="{binding name}" margin="32 0 32 0" /> </datatemplate> </listbox.itemtemplate> <domain:demoitem name="home">
...
<domain:demoitem name="shadows"> <domain:demoitem.content> <wpfexample:shadows /> </domain:demoitem.content> </domain:demoitem> </listbox> </dockpanel> </materialdesign:drawerhost.leftdrawercontent> <dockpanel> <materialdesign:colorzone padding="16" materialdesign:shadowassist.shadowdepth="depth2" mode="primarymid" dockpanel.dock="top"> <dockpanel> <togglebutton style="{staticresource materialdesignhamburgertogglebutton}" ischecked="false" x:name="menutogglebutton"/> <materialdesign:popupbox dockpanel.dock="right" placementmode="bottomandalignrightedges" staysopen="false"> <stackpanel> <button content="hello world" click="menupopupbutton_onclick"/> <button content="nice popup" click="menupopupbutton_onclick"/> <button content="goodbye" click="menupopupbutton_onclick"/> </stackpanel> </materialdesign:popupbox> <textblock horizontalalignment="center" verticalalignment="center" fontsize="22">material design in xaml toolkit</textblock> </dockpanel> </materialdesign:colorzone> <contentcontrol margin="16" content="{binding elementname=demoitemslistbox, path=selecteditem.content}" /> </dockpanel> </materialdesign:drawerhost> </materialdesign:dialoghost> </window>
the black shade due grid defined in generic.xaml:
<grid x:name="part_contentcover" background="{x:null}" opacity="0" ishittestvisible="false" focusable="false" />
which animated set opacity 0.56 when drawer drawn. unfortunatelly grid not belong template cannot change in client xaml.
the other option change shade's black brush defined in generic.xaml:
<solidcolorbrush x:key="blackbackground" color="black" />
but wouldn't know how change client xaml, advice until more wpf skillz gives better option recompile source , change black brush to:
<solidcolorbrush x:key="blackbackground" color="#00000000" />
alternatively can use flyout control shown in other demo not have dark shade feature other same.
update: i've found 1 way solve this. can subclass drawerhost this:
public class drawerhostex : drawerhost { public drawerhostex() { } public override void onapplytemplate() { base.onapplytemplate(); var grid = gettemplatechild(templatecontentcoverpartname) system.windows.controls.grid; grid.visibility = system.windows.visibility.collapsed; } }
then replace drawerhost drawerhostex in xaml.
Comments
Post a Comment