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...
精彩评论