Progress with icons (not working)
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="clr-namespace:Aurora.Design.Extensions"
|
||||
x:Class="Aurora.Design.Components.MediaPlayer.Player">
|
||||
<ContentView.Resources>
|
||||
<StyleSheet
|
||||
@ -33,19 +34,20 @@
|
||||
Grid.Column="1"
|
||||
HorizontalOptions="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Text="Previous"
|
||||
<Image Source="{local:ImageResource Aurora.gtk.Resources.forward.png}" />
|
||||
<ImageButton
|
||||
x:Name="PreviousButton"
|
||||
Source="{local:ImageResource Aurora.gtk.Resources.backward.png}"
|
||||
WidthRequest="100"
|
||||
HeightRequest="50"/>
|
||||
<Button
|
||||
HeightRequest="50"></ImageButton>
|
||||
<ImageButton
|
||||
x:Name="PlayButton"
|
||||
Text="Play/Pause"
|
||||
Source="{local:ImageResource Aurora.gtk.Resources.play.png}"
|
||||
WidthRequest="100"
|
||||
HeightRequest="50"/>
|
||||
<Button
|
||||
Text="Next"
|
||||
<ImageButton
|
||||
x:Name="NextButton"
|
||||
Source="{local:ImageResource Aurora.gtk.Resources.forward.png}"
|
||||
WidthRequest="100"
|
||||
HeightRequest="50"/>
|
||||
</StackLayout>
|
||||
|
42
Aurora/Design/Extensions/ImageResourceExtension.cs
Normal file
42
Aurora/Design/Extensions/ImageResourceExtension.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace Aurora.Design.Extensions
|
||||
{
|
||||
[ContentProperty(nameof(Source))]
|
||||
public class ImageResourceExtension : IMarkupExtension
|
||||
{
|
||||
public string Source { get; set; }
|
||||
|
||||
public object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (Source == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Assembly[] referencedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
var gtkAsm = referencedAssemblies.FirstOrDefault((e) =>
|
||||
{
|
||||
return e.FullName.Contains("Aurora.gtk");
|
||||
});
|
||||
|
||||
foreach (var res in gtkAsm.GetManifestResourceNames())
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("found resource: " + res);
|
||||
}
|
||||
|
||||
if (gtkAsm == null && gtkAsm is Assembly)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Do your translation lookup here, using whatever method you require
|
||||
var imageSource = ImageSource.FromResource(Source, gtkAsm);
|
||||
|
||||
return imageSource;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 48 KiB |
Reference in New Issue
Block a user