Template of root control
I have custom control named Frame (public class Frame : ContentControl, IDisposable). Frame in constructor defines DefaultStyleKey = typeof(Frame); and Frame template is in Generic.xaml resource. Now In some other project I use frame that is in Silverlight.Controls and if I set my main page that the root element is frame like this
<ShellFrame:Frame x:Class="Modules.Adresar.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:s="clr-namespace:Modules.Adresar.ViewModel"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ShellFrame="clr-namespace:Silverlight.Controls;assembly=Silverlight.Controls" mc:Ignorable="d"
DataContext="{Binding Source={StaticResource VMLocator}, Converter={StaticResource VMIndexerConverter}, ConverterParameter=AdresarVM}"
d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type=s:AdresarViewModel}" x:Name="MainFrame">
<Grid x:Name="LayoutMain">
</Grid>
I can't edit template of frame. Blend is showing al edit template menu items disabled. But If I put frame inside layout root grid in normal user control then everything is ok.. like this
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ShellFrame="clr-namespace:Silver开发者_JS百科light.Controls;assembly=Silverlight.Controls"
mc:Ignorable="d"
x:Class="Adresar.Test"
d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot">
<ShellFrame:Frame Content="Frame" HorizontalAlignment="Left" Margin="72,136,0,0" VerticalAlignment="Top"/>
</Grid>
Does enybody knows why this is happening? Thank you!
Changing your Frame control to be based on UserControl
instead of ContentControl
should fix the behavior you're seeing in Blend. I'm not sure how you're using your control, but if you can't utilize a UserControl you might want to include some context.
精彩评论