SlideView 页眉中的图像和文本框
Image and Text box in SlideView Header
在 Visual Studio 2013 的帮助下,我正在 Windows 10 中使用 https://slideview.codeplex.com 制作 windows 8.1 应用程序。我可以成功禁用右窗格。我还可以添加 TextBox,我可以分别从每个页面设置它。但是,当我将图像与文本框一起添加时,它将不起作用,但如果我只放置图像而没有文本框,它将起作用。我做了下面的代码。
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<Grid Background="#48649F">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<Image Source="{Binding library:SlideApplicationFrame.ImageSource}" HorizontalAlignment="Right" Stretch="None" Grid.Column="0"/>
<TextBlock Margin="6,12" VerticalAlignment="Center" FontSize="26" Text="{Binding}" Grid.Column="1" />
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
解决后我想动态制作Image Source。为此,我在 SlideApplicationFrame.cs 中添加了以下代码,但它没有帮助
#region ImageSource (DependencyProperty)
/// <summary>
/// Content for the header
/// </summary>
public object ImageSource
{
get { return (object)GetValue(ImageSourceProperty); }
set { SetValue(ImageSourceProperty, value); }
}
public static readonly DependencyProperty ImageSourceProperty =
DependencyProperty.Register("ImageSource",
typeof(object),
typeof(SlideApplicationFrame),
new PropertyMetadata(null));
#endregion
请帮我解决这个问题。
我的错误是我没有查看 ContentPresenter 我又添加了一个 属性 如下
Tag="{TemplateBinding ImageSource}"
它是按照我的要求开始的
在 Visual Studio 2013 的帮助下,我正在 Windows 10 中使用 https://slideview.codeplex.com 制作 windows 8.1 应用程序。我可以成功禁用右窗格。我还可以添加 TextBox,我可以分别从每个页面设置它。但是,当我将图像与文本框一起添加时,它将不起作用,但如果我只放置图像而没有文本框,它将起作用。我做了下面的代码。
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<Grid Background="#48649F">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<Image Source="{Binding library:SlideApplicationFrame.ImageSource}" HorizontalAlignment="Right" Stretch="None" Grid.Column="0"/>
<TextBlock Margin="6,12" VerticalAlignment="Center" FontSize="26" Text="{Binding}" Grid.Column="1" />
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
解决后我想动态制作Image Source。为此,我在 SlideApplicationFrame.cs 中添加了以下代码,但它没有帮助
#region ImageSource (DependencyProperty)
/// <summary>
/// Content for the header
/// </summary>
public object ImageSource
{
get { return (object)GetValue(ImageSourceProperty); }
set { SetValue(ImageSourceProperty, value); }
}
public static readonly DependencyProperty ImageSourceProperty =
DependencyProperty.Register("ImageSource",
typeof(object),
typeof(SlideApplicationFrame),
new PropertyMetadata(null));
#endregion
请帮我解决这个问题。
我的错误是我没有查看 ContentPresenter 我又添加了一个 属性 如下
Tag="{TemplateBinding ImageSource}"
它是按照我的要求开始的