将WPF xaml转换为Silverlight xaml
除了一件事之外,我几乎成功地把它全部转化了 这是有问题的部分-将WPF xaml转换为Silverlight xaml,wpf,silverlight,styles,controltemplate,Wpf,Silverlight,Styles,Controltemplate,除了一件事之外,我几乎成功地把它全部转化了 这是有问题的部分- <ContentPresenter Margin="2,2,2,2" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/> 这是整个xaml(不太长)—— ContentSource不是Silverlight中ContentPresenter控件的依赖属性。不幸的是,我不知道Silverlight中的use/equillant属性,
<ContentPresenter Margin="2,2,2,2" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
这是整个xaml(不太长)——
ContentSource
不是Silverlight中ContentPresenter
控件的依赖属性。不幸的是,我不知道Silverlight中的use/equillant属性,所以我要查看msdn文档,了解如何迁移该值(http://msdn.microsoft.com/en-us/library/system.windows.controls.contentpresenter(v=vs.95).aspx)谢谢@Dave S,那么我应该在那里写些什么呢?我不确定,正在设置的SelectedContent值是多少?-在一个猜测,它似乎只是内容,所以尝试使用内容dp代替。
<Window.Resources>
<SolidColorBrush x:Key="OutlookButtonForeground" Color="#FF204D89"/>
<LinearGradientBrush x:Key="OutlookButtonBackground" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFD9EDFF" Offset="0"/>
<GradientStop Color="#FFC0DEFF" Offset="0.445"/>
<GradientStop Color="#FFC0D9FB" Offset="1"/>
<GradientStop Color="#FFAFD1F8" Offset="0.53"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="OutlookButtonHighlight" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFBD69" Offset="0"/>
<GradientStop Color="#FFFFB75A" Offset="0.0967"/>
<GradientStop Color="#FFFFB14C" Offset="0.2580"/>
<GradientStop Color="#FFFB8C3C" Offset="0.3870"/>
<GradientStop Color="#FFFEB461" Offset="0.9677"/>
<GradientStop Color="#FFFEBB67" Offset="1"/>
</LinearGradientBrush>
<Style x:Key="OutlookTabControlStyle" TargetType="TabControl">
<Setter Property="Foreground" Value="{StaticResource OutlookButtonForeground}"/>
<Setter Property="Background" Value="{StaticResource OutlookButtonBackground}"/>
<Setter Property="BorderThickness" Value="3"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="MinWidth" Value="10"/>
<Setter Property="MinHeight" Value="10"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabControl">
<Grid>
<Grid.RowDefinitions>
<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
<RowDefinition x:Name="RowDefinition1" Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ColumnDefinition0"/>
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
</Grid.ColumnDefinitions>
<Grid x:Name="ContentPanel" Grid.Column="0" Grid.Row="1">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter Margin="2,2,2,2" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
</Border>
</Grid>
<StackPanel HorizontalAlignment="Stretch" Margin="0,-2,0,0"
x:Name="HeaderPanel" VerticalAlignment="Bottom" Width="Auto"
Height="Auto" Grid.Row="1" IsItemsHost="True"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<TabControl VerticalAlignment="Stretch" Width="360" Height="Auto" TabStripPlacement="Bottom" Style="{StaticResource OutlookTabControlStyle}" BorderBrush="#FF6593CF" HorizontalAlignment="Left" BorderThickness="1,1,1,0">
<TabItem Header="Mail" Height="30" Background="{StaticResource OutlookButtonBackground}" Foreground="{StaticResource OutlookButtonForeground}">
<Grid>
<TextBlock Text="Mail"/>
</Grid>
</TabItem>
<TabItem Header="Calender" Height="30" Background="{StaticResource OutlookButtonBackground}" Foreground="{StaticResource OutlookButtonForeground}">
<Grid>
<TextBlock Text="Calender"/>
</Grid>
</TabItem>
</TabControl>
</Grid>