开发者

How can I define control as a resource and then place it onto form?

I want to do something like this:

<Window x:Class="WpfApplication10.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/开发者_运维技巧winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <Button x:Key="butt" Content="Yeah!" />
    </Window.Resources>
    <Grid>
        <!-- Place button here -->
    </Grid>
</Window>

How to do it? I want to create library of small user controls in single file.


<Grid>
    <StaticResource ResourceKey="butt"/>
</Grid>

Should work...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜