c# - key does not exist in style -
i learning trigger in wpf
. here trigger demo when write code similar tutorial show "the property key not exist"
my code
<window.resources> <style x:key="buttonstyle" targettype="{x:type button}"> </style> </window.resources> <grid> <grid.rowdefinitions> <rowdefinition height="*"></rowdefinition> <rowdefinition height="*"></rowdefinition> <rowdefinition height="*"></rowdefinition> <rowdefinition height="auto"></rowdefinition> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="*"></columndefinition> <columndefinition width="*"></columndefinition> <columndefinition width="*"></columndefinition> <columndefinition width="auto"></columndefinition> </grid.columndefinitions> <button content="my button" horizontalalignment="left" verticalalignment="top" maxwidth="100" padding="6" margin="8"/> </grid>
k in key needs in capital x:key
make sure have included namespace 'x'
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
in windows tag
Comments
Post a Comment