file360

Log | Files | Refs

BottomBarItem.xaml.cs (2315B)


      1 using System;
      2 using System.Collections.Generic;
      3 using System.IO;
      4 using System.Linq;
      5 using System.Runtime.InteropServices.WindowsRuntime;
      6 using Windows.Foundation;
      7 using Windows.Foundation.Collections;
      8 using Windows.UI.Xaml;
      9 using Windows.UI.Xaml.Controls;
     10 using Windows.UI.Xaml.Controls.Primitives;
     11 using Windows.UI.Xaml.Data;
     12 using Windows.UI.Xaml.Input;
     13 using Windows.UI.Xaml.Media;
     14 using Windows.UI.Xaml.Navigation;
     15 
     16 // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
     17 
     18 namespace File360
     19 {
     20     public sealed partial class BottomBarItem : Button
     21     {
     22         public BottomBarItem()
     23         {
     24             this.InitializeComponent();
     25             MinWidth = 5;
     26             MinHeight = 5;
     27             Loaded += BottomBarItem_Loaded;
     28         }
     29 
     30         public void Initialize()
     31         {
     32             if (IsVertical())
     33             {
     34                 contentText.FontSize = Window.Current.Bounds.Width / 35;
     35                 imageText.FontSize = Window.Current.Bounds.Width / 20;
     36             }
     37             else
     38             {
     39                 contentText.FontSize = Window.Current.Bounds.Height / 35; imageText.FontSize = Window.Current.Bounds.Height / 20;
     40             }
     41         }
     42 
     43         public string ImageText
     44         {
     45             get { return imageText.Text; }
     46             set { imageText.Text = value; }
     47         }
     48         public Brush ImageColor
     49         {
     50             get { return imageText.Foreground; }
     51             set { imageText.Foreground = value; }
     52         }
     53         public Brush ContentColor
     54         {
     55             get { return contentText.Foreground; }
     56             set { contentText.Foreground = value; }
     57         }
     58         public string ContentText
     59         {
     60             get { return contentText.Text; }
     61             set { contentText.Text = value; }
     62         }
     63         void BottomBarItem_Loaded(object sender, RoutedEventArgs e)
     64         {
     65             Initialize();
     66             Window.Current.SizeChanged += Current_SizeChanged;
     67         }
     68 
     69         void Current_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
     70         {
     71             //Initialize();
     72         }
     73         public bool IsVertical()
     74         {
     75             if (Window.Current.Bounds.Height > Window.Current.Bounds.Width) return true;
     76             else return false;
     77         }
     78     }
     79 }