[XAMARIN] Iconpack
2019. 6. 15. 21:43ㆍIT/C#
안드로이드에서 무료로 제공하는 아이콘 팩이 있음.
약 6.4메가 정도함.
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:IconPack" x:Class="IconPack.MainPage"
Title="Guest Manage"
>
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="VerticalOptions" Value="CenterAndExpand" />
<Setter Property="FontSize" Value="Large" />
<Setter Property="TextColor" Value="Blue" />
<Setter Property="BorderWidth" Value="3" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.ToolbarItems>
<ToolbarItem
Text="edit"
Order="Primary"
Clicked="Handle_Clicked"
>
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="Android" Value="ic_action_edit.png" />
</OnPlatform>
</ToolbarItem.Icon>
</ToolbarItem>
<ToolbarItem
Text="search"
Order="Primary"
Clicked="Handle_Clicked"
>
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="Android" Value="ic_action_search.png" />
</OnPlatform>
</ToolbarItem.Icon>
</ToolbarItem>
<ToolbarItem
Text="refresh"
Order="Primary"
Clicked="Handle_Clicked"
>
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="Android" Value="ic_action_refresh.png" />
</OnPlatform>
</ToolbarItem.Icon>
</ToolbarItem>
<ToolbarItem
Text="QnA"
Order="Secondary"
Clicked="Handle_Clicked"
>
</ToolbarItem>
<ToolbarItem
Text="About"
Order="Secondary"
Clicked="Handle_Clicked"
>
</ToolbarItem>
</ContentPage.ToolbarItems>
<StackLayout>
<Button Text="Edit" HorizontalOptions="Center" WidthRequest="150">
<Button.Image>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="Android" Value="ic_action_edit.png" />
</OnPlatform>
</Button.Image>
</Button>
<Button Text="Search" HorizontalOptions="Center" WidthRequest="150">
<Button.Image>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="Android" Value="ic_action_search.png" />
</OnPlatform>
</Button.Image>
</Button>
<Button Text="ㅎㅏ나"
Style="{StaticResource buttonStyle}"
/>
<Button Text="둘"
Style="{StaticResource buttonStyle}"
/>
<Button Text=""
Style="{StaticResource buttonStyle}"
/>
</StackLayout>
</ContentPage>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace IconPack
{
// Learn more about making custom code visible in the Xamarin.Forms previewer
// by visiting https://aka.ms/xamarinforms-previewer
[DesignTimeVisible(true)]
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
void Handle_Clicked(object sender, System.EventArgs e)
{
if(((ToolbarItem)sender).Text == "edit")
{
DisplayAlert("error", "edit", "ok");
}
else if (((ToolbarItem)sender).Text == "search")
{
DisplayAlert("error", "search", "ok");
}
else if (((ToolbarItem)sender).Text == "refresh")
{
DisplayAlert("error", "refresh", "ok");
}
else if (((ToolbarItem)sender).Text == "QnA")
{
DisplayAlert("error", "QnA", "ok");
}
else if (((ToolbarItem)sender).Text == "About")
{
DisplayAlert("error", "About", "ok");
}
}
}
}
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace IconPack
{
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new NavigationPage(new MainPage());
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
'IT > C#' 카테고리의 다른 글
[C#] DATA.go.kr 에서 미세먼지 정보를 얻어서 값을 출력하는 프로그램 (0) | 2023.05.01 |
---|---|
Entity Framework Core로 DB제어하기(dotnet core 2.1 환경) (0) | 2020.04.20 |
라즈베리파이에 도커를 사용하여 닷넷코어 설치하기 (0) | 2020.04.09 |
[XAMARIN] Entry, Editor, SearchBar DatePicker, TimePicker 사용 예제 (0) | 2019.06.08 |
[XAMARIN] Resource Dictionary 사용하기 (0) | 2019.06.02 |
[XAMARIN] ContentView 만들기와 Tapped 이벤트 처리 (0) | 2019.05.29 |
[XAMARIN] App Life cycle과 환경 변수 (0) | 2019.05.25 |
[XAMARIN] Button 이벤트 (0) | 2019.05.25 |