ãã¼ãã©ã¤ãã©ãªã®ä½¿ãæ¹
ãProgram Filesã®ä¸ã«Reference Assembliesã¨ãããã£ã¬ã¯ããªãããããã®ä¸ã«ã¹ã¿ã¤ã«ã©ã¤ãã©ãªãå«ã¾ãã¦ããã使ãæ¹ã¯こちらã«åããããã解説ãããã
ãã§ããããã®ã¹ã¿ã¤ã«ã¯è²¼ãä»ããã³ã³ããã¼ã«ã«é©ç¨ããããã¨ã«ãªãã®ã ããã¹ã¿ã¤ã«ãæ¹å¤ãããå ´åããããä¾ãã°XPã¨Vistaã§ãã©ã³ããç°ãªãï¼Xpã§ã¯MSPã´ã·ãã¯ãVistaã§ã¯ã¡ã¤ãªãªãé¸ã°ããï¼ã®ã§çµ±ä¸ããããã¨ãã£ãã±ã¼ã¹ã ãå¥ã®Styleãå®ç¾©ãã¦å½ã¦ã¦ãã¾ãã¨Aeroãã¼ãã®å¤è¦³ã§ãªããªã£ã¦ãã¾ãã
ãããã解決ããããã«ã¯ãBasedOnã§Aeroã®ã¹ã¿ã¤ã«ãå¼ãç¶ãã Styleãå®ç¾©ãã¦ä½¿ãã¨è¯ãããã¼ãã©ã¤ãã©ãªã®ResourceDictionaryã®Xamlå
ã§ã¯ãä¸éãã®æ¨æºã³ã³ããã¼ã«ã®ã¹ã¿ã¤ã«å®ç¾©ãããã¦ãããããããã®ã¹ã¿ã¤ã«ã®Keyã«ã¯ã³ã³ããã¼ã«åãã®ãã®ã使ããã¦ããããã®ãã次ã®ããã«BasedOnãæå®ããã°è¯ãã
<Window.Resources> <ResourceDictionary Source="/presentationframework.Aero;component/themes/aero.normalcolor.xaml"/> </Window.Resources> <Grid> <Grid.Resources> <Style x:Key="SampleButton" TargetType="{x:Type Button}" BasedOn="{StaticResource ResourceKey={x:Type Button}}"> <Setter Property="FontFamily" Value="MSææ"/> </Style> </Grid.Resources> <Button Style="{StaticResource SampleButton}">ãµã³ãã«</Button> :
ãä¸è¨ä¾ã§ã¯Aeroã¹ã¿ã¤ã«ã®ãã¿ã³ã«ãã©ã³ãã ãMSææã«ãããã®ã«ãªããæ®å¿µãªããåã ã®ã³ã³ããã¼ã«ã®Styleã«æ°è¨ãããã®ãèªåçã«è¨å®ãããã¨ã¯ã§ããªããï¼ã¤ï¼ã¤Styleã§æå®ããªãã¨ãªããªããããã©ãã
ãã¡ãªã¿ã«ããã¼ãã©ã¤ãã©ãªã¯ãReference Assembliesã¨ããååã§æ¨æ¸¬ã§ããã¨ããã.NET Frameworkãå ¥ã£ã¦ãããã·ã³ã«æ¨æºã¤ã³ã¹ãã¼ã«ãããé¡ã®ãã®ã§ã¯ãªãããã®ãããããã¸ã§ã¯ãåç §ã«è¿½å ãããã¼ãã©ã¤ãã©ãªã¯ãã¼ã«ã«ã³ãã¼ãTrueã«ããå¿ è¦ããããåç¬å®è¡ããã¨ãã«ããã¼ãã¢ã»ã³ããªããªãï¼ãã¨ããã¨ã©ã¼ã«ãªãããã ãIDEä¸ããã®å®è¡(.vshostçµç±ã®å®è¡)ã§ã¯åç §è§£æ±ºæ¸ã¿ã®ããåé¡ãåºãªãã®ã§ããã£ãããã¦ãã«ããããã®ããã®ã¾ã¾é å¸ããããã®ã§æ³¨æãå¿ è¦ã ã
追è¨
ãStyleå±æ§ãæå®ããªãã¦ãOKãªæ¹æ³ãåãã£ãï¼
ãKeyãéè¤ãã¦ã¯ãããªãã®ã¯åä¸è¦ç´ ã®Resourcesã®ä¸ã ãã®è©±ãªã®ã§ã親è¦ç´ ãã辿ã£ããã®ãç¶æ¿ããããã°Keyã¯åå®ç¾©ã§ãããâã®Xamlã¯âã®ããã«ã§ããã
<Window.Resources> <ResourceDictionary Source="/presentationframework.Aero;component/themes/aero.normalcolor.xaml"/> </Window.Resources> <Grid> <Grid.Resources> <Style TargetType="Button" BasedOn="{StaticResource ResourceKey={x:Type Button}}"> <Setter Property="FontFamily" Value="MSææ"/> </Style> </Grid.Resources> <Button>ãµã³ãã«</Button> :