开发者

more Abbreviated XAML

开发者 https://www.devze.com 2023-04-04 15:37 出处:网络
Can you more abbretviate following code... <Button.Tag> <BitmapImage UriSource=\"/WpfApplication1;component/Images/ButtonIcons/Butt开发者_StackOverflow社区onIcon_Sound.png\"/>

Can you more abbretviate following code...

<Button.Tag>
    <BitmapImage UriSource="/WpfApplication1;component/Images/ButtonIcons/Butt开发者_StackOverflow社区onIcon_Sound.png"/>
</Button.Tag>

in one line?


You can define

"/WpfApplication1;component/Images/ButtonIcons/ButtonIcon_Sound.png"

as a StaticResource, then you would have something like,

<BitmapImage UriSource="{StaticResource SoundIcon}"/>

Also put this resource in a shared ResourceDictionary then you don't need to define it twice.

0

精彩评论

暂无评论...
验证码 换一张
取 消