我有电视连续剧项目,我正在使用mediaelement.但我需要帮助寻求酒吧.如何添加?如何制作像MediaPlayerLauncher一样的搜索栏滑块?
我试着这样想:
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<MediaElement x:Name="player1" MediaOpened="player1_MediaOpened" CurrentStateChanged="player1_CurrentStateChanged" />
<ListBox x:Name="alternatifliste" FontSize="20" FontStyle="Italic" FontWeight="Bold" Foreground="White" Margin="677,98,10,153" SelectionChanged="alternatifliste_SelectionChanged" />
</Grid>
<Button x:Name="play" Content="play" HorizontalAlignment="Left" Margin="94,336,0,0" Grid.Row="1" VerticalAlignment="Top" Click="play_Click"/>
<Button x:Name="stop" Content="stop" HorizontalAlignment="Left" Margin="331,336,0,0" Grid.Row="1" VerticalAlignment="Top" Click="stop_Click"/>
<Slider Name="timelineSlider" Margin="0,68,0,244" Grid.Row="1" ValueChanged="timelineSlider_ValueChanged" />
</Grid>
Run Code Online (Sandbox Code Playgroud)
我的项目:

İts代码:
private void player1_MediaOpened(object sender, RoutedEventArgs e)
{
TimeSpan ts …Run Code Online (Sandbox Code Playgroud) 我试图使用以下示例实现无限滚动
http://www.davidbritch.com/2014/05/data-virtualisation-using.html
问题是在我的情况下,LoadMoreItemsAsync不断被无休止地调用.我正在集线器上开发这个(不确定这是否有所不同)并使用MVVMLight.以下是我的代码
的.xaml
<Page
x:Class="MyFileServer.UniversalApp.AppHubPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyFileServer.UniversalApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
DataContext="{Binding Source={StaticResource MFSViewModelLocator}, Path=AppHub}">
<Grid>
<Hub Header="My File Server">
<HubSection x:Name="MFSNotifications" Header="Notifications">
<DataTemplate>
<StackPanel>
<ListView x:Name="Notifications" ItemsSource="{Binding IncrementalNotifications}" >
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding NotificationDescription}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</DataTemplate>
</HubSection>
<HubSection x:Name="MFSFiles" Header="Files"></HubSection>
</Hub>
</Grid>
Run Code Online (Sandbox Code Playgroud)
下面给出了我的ISupportIncrementalLoading实现
public class IncrementalLoadingNotificationsCollection : ObservableCollection<MFSNotificationModel>, ISupportIncrementalLoading
{
private INotificationService _notificationService;
public IncrementalLoadingNotificationsCollection(INotificationService notificationService)
{
HasMoreItems = true;
_notificationService = notificationService;
}
public bool HasMoreItems
{
get;
private set; …Run Code Online (Sandbox Code Playgroud) 在我的Windows Phone 8.1应用程序中,我想获取当前页面类型,如果它与我的检查匹配以刷新该页面.怎么做?这不起作用:
Frame rootFrame = Window.Current.Content as Frame;
Run Code Online (Sandbox Code Playgroud) c# windows-phone windows-phone-8 windows-8.1 windows-phone-8.1
我正在尝试将应用程序从Windows Phone Silverlight 8.0升级到8.1.当我尝试访问8.1上的"Assets"文件夹时,我遇到了异常.我能够在一个示例项目中重现这一点,该项目在定位8.0时工作正常,但在升级到8.1时会产生异常.
以下是示例应用程序MainPage的XAML:
<phone:PhoneApplicationPage
x:Class="PhoneApp1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
<TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Button Content="Get Assets" HorizontalAlignment="Center" VerticalAlignment="Center" Click="Button_Click"/>
</Grid>
</Grid>
</phone:PhoneApplicationPage>
Run Code Online (Sandbox Code Playgroud)
这是MainPage代码隐藏:
using System;
using System.Diagnostics;
using System.Windows;
using Microsoft.Phone.Controls;
using Windows.Storage;
namespace PhoneApp1
{
public partial class MainPage …Run Code Online (Sandbox Code Playgroud) 这是显示数据库表中所有列和记录的 GridView:
<asp:GridView ID="GridView1" runat="server" AllowPaging="true" BackColor="White"
BorderColor="#CCCCCC" BorderWidth="2px" CellPadding="2" CellSpacing="5"
ForeColor="#000066" GridLines="None">
<RowStyle BackColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#E7E7FF" />
<FooterStyle BackColor="White" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066"
HorizontalAlign="Center" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
<Columns>
<asp:CommandField ShowSelectButton="true" HeaderStyle-ForeColor="Yellow"
ControlStyle-ForeColor="Red" SelectText="Select" HeaderText="Select" />
</Columns>
</asp:GridView>
Run Code Online (Sandbox Code Playgroud)
背后代码:
public void ShowBooks()
{
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Book", con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected …Run Code Online (Sandbox Code Playgroud) 我正在开发一款适用于Windows手机的应用程序,它主要包括手机通讯录.我正在使用Contacts类获取所有电话联系人,并且我将联系人数据存储在隔离存储中.由于我无法序列化图像,我在序列化之前将它们转换为byte [].我的代码是:
foreach (var result in e.Results)
{
if (result.PhoneNumbers.FirstOrDefault() != null)
{
BitmapImage bmp2 = new BitmapImage();
bmp2.SetSource(result.GetPicture());
listobj.Add(new AddressBook()
{
FirstName = result.DisplayName ?? "",
imageBytes = AddressBook.imageConvert(bmp2),
EmailAddress = "",
LastName = "",
Phone = result.PhoneNumbers.FirstOrDefault().PhoneNumber ?? "",
});
}
}
Run Code Online (Sandbox Code Playgroud)
当Contact没有图片时,它会在行上显示Argument null异常错误:
bmp2.SetSource(result.GetPicture());
Run Code Online (Sandbox Code Playgroud)
因此,当联系人图像为null时,我想使用一些自定义图像("/Images/ci2.png"或任何空白图像也可以使用).我的xaml代码是:
<StackPanel Margin="0,0,0,2" Orientation="Horizontal">
<StackPanel Width="80" Orientation="Horizontal" Height="80">
<Ellipse Margin="0" Height="70" Width="70" HorizontalAlignment="Left" Stroke="{x:Null}">
<Ellipse.Fill>
<ImageBrush Stretch="Fill" ImageSource="{Binding imageByte, Converter={StaticResource BytesToImageConverter}}"/>
</Ellipse.Fill>
</Ellipse>
</StackPanel>
<StackPanel Height="80" Margin="0" Width="380" HorizontalAlignment="Left">
<TextBlock FontWeight="Bold" Text="{Binding FirstName}" …Run Code Online (Sandbox Code Playgroud) 我将计时器刻度事件设置为250毫秒:
private void timer4_Tick(object sender, EventArgs e)
{
if (pictureboximagestosavecount == 72)
{
timer4.Enabled = false;
}
else
{
Bitmap bmp = new Bitmap(this.Width, this.Height);
Rectangle rect = new Rectangle(this.Location.X, this.Location.Y, this.Width, this.Height);
pictureboximagestosavecount++;
savePictureBox(pictureBox1, @"c:\temp\pboximages\" + pictureboximagestosavecount.ToString("D6") + "pbimg.gif");
this.DrawToBitmap(bmp, rect);
bmp.Save(@"c:\temp\pboximages\" + pictureboximagestosavecount.ToString("D6") + "form.gif");
}
}
Run Code Online (Sandbox Code Playgroud)
首先,我使用savePictureBox方法将pictureBox保存为gif.其次我保存form1:
bmp.Save(@"c:\temp\pboximages\" + pictureboximagestosavecount.ToString("D6") + "form.gif");
Run Code Online (Sandbox Code Playgroud)
在timer4停止后,我有一个基本点击事件,我从保存的文件中创建动画gif:
private void animatedgifbutton_Click(object sender, EventArgs e)
{
DirectoryInfo di1;
FileInfo[] fi1;
di1 = new DirectoryInfo(@"c:\temp\pboximages\");
fi1 = di1.GetFiles("*form.gif");
List<string> newImages = new List<string>();
for …Run Code Online (Sandbox Code Playgroud)