Beispiel #1
0
        public NoteBox(Note note, Color col)
        {
            this.InitializeComponent();
            color             = col;
            header.Background = new SolidColorBrush(col);
            add.Foreground    = new SolidColorBrush(Colors.White);
            edit.Foreground   = new SolidColorBrush(Colors.White);
            self = note;

            this.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch;
            edit.Tapped           += (a, b) =>
            {
                if ((edit.Foreground as SolidColorBrush).Color == Windows.UI.Colors.Black)
                {
                    foreach (EditableItem box in holder.Children)
                    {
                        box.setEditable(false);
                    }
                    edit.Foreground = new SolidColorBrush(col);
                }
                else
                {
                    foreach (EditableItem box in holder.Children)
                    {
                        box.setEditable(true);
                    }
                    edit.Foreground = new SolidColorBrush(Windows.UI.Colors.Black);
                }
                //this.Height = holder.ActualHeight + 68;
            };

            Title.Text     = self.Name;
            TitleEdit.Text = self.Name;

            TitleEdit.TextChanged += (a, b) =>
            {
                Title.Text = TitleEdit.Text;
                self.Name  = TitleEdit.Text;
            };

            add.Tapped += (a, b) =>
            {
                NoteFragment frag = new NoteFragment {
                    Content = "Turn on editing to add text"
                };
                self.Fragments.Add(frag);
                refresh();
            };

            this.Loaded += (c, d) =>
            {
                refresh();
                //holder.SizeChanged += (a, b) => this.Height = holder.ActualHeight + 68;
            };
        }
Beispiel #2
0
        public NoteFragmentControl(NoteFragment fragment, UIElementCollection container, Note note, Color col, bool shouldShade)
        {
            this.InitializeComponent();
            self         = fragment;
            content.Text = fragment.Content;
            editBox.Text = content.Text;
            //back.Background = new SolidColorBrush(fragment.BackColor);
            SetEditableItems(editBox, deleteButton);
            SetStaticItems(content);

            back.Background  = new SolidColorBrush(col);
            shade.Visibility = (shouldShade) ? Visibility.Visible : Visibility.Collapsed;

            deleteButton.Tapped += (e, ev) =>
            {
                container.Remove(this);
                note.Fragments.Remove(self);
            };
            editBox.TextChanged += (e, ev) =>
            {
                content.Text = editBox.Text;
                self.Content = editBox.Text;
            };

            editBox.SizeChanged += (_e, _ev) =>
            {
                this.Height = editBox.ActualHeight + 10;
            };
            //selector.SizeChanged+= (_e,_ev) => selector.Width = selector.ActualHeight;
            this.Loaded += (_e, _ev) => this.Width = (this.Parent as FrameworkElement).ActualWidth;
            //selector.Fill = new SolidColorBrush(col);
            Update();

            edit.Tapped += (a, b) =>
            {
                NotesToolbox ns = new NotesToolbox(self);
                Flyout       fl = new Flyout {
                    Placement = PlacementMode.Bottom, PlacementTarget = edit
                };
                fl.Content   = ns;
                fl.IsOpen    = true;
                ns.OnChange += () => Update();
            };
        }
Beispiel #3
0
        public NotesToolbox(NoteFragment fragment)
        {
            this.InitializeComponent();
            sizeSlider.Value = fragment.FontSize;
            italic.IsChecked = fragment.Italic;
            bold.IsChecked   = fragment.Bold;
            center.IsChecked = fragment.Centered;

            sizeSlider.ValueChanged += (a, b) =>
            { fragment.FontSize = sizeSlider.Value; OnChange(); };
            italic.Tapped += (a, b) =>
            {
                fragment.Italic = italic.IsChecked.Value;
                OnChange();
            };
            bold.Tapped += (a, b) => {
                fragment.Bold = bold.IsChecked.Value;
                OnChange();
            };
            center.Tapped += (a, b) => {
                fragment.Centered = center.IsChecked.Value;
                OnChange();
            };
        }