Beispiel #1
0
        void AddText(EditableTitle stackPanel, String text)
        {
            TextBlock textBlock = new TextBlock()
            {
                VerticalAlignment = VerticalAlignment.Center,
                FontSize          = 30,
            };

            Util.HtmlToTextBlockFormatter.Format(text.Replace(' ', (char)160), textBlock);

            stackPanel.Add(textBlock);
        }
Beispiel #2
0
        void AddComboBox(EditableTitle stackPanel, String selected, IEnumerable <String> candidates, SelectionChangedEventHandler selectionChanged, String columnName)
        {
            if (!IsSelected)
            {
                AddText(stackPanel, $"<b>{selected}</b>");
            }
            else
            {
                ComboBox comboBox = new ComboBox()
                {
                    Style             = App.Current.Resources[columnName.Length > 0 ? "SeamlessComboBoxStyle" : "SeamlessComboBoxStyle2"] as Style,
                    VerticalAlignment = VerticalAlignment.Center,
                    Tag      = columnName,
                    FontSize = 30
                };
                foreach (String candidate in candidates)
                {
                    ComboBoxItem comboBoxItem = new ComboBoxItem()
                    {
                        Content    = candidate,
                        IsSelected = candidate == selected,
                        Style      = App.Current.Resources["SeamlessComboBoxItemStyle"] as Style,
                    };
                    comboBox.Items.Add(comboBoxItem);
                }
                stackPanel.Add(comboBox);

                /*comboBox.PointerEntered += (o, e) =>
                 * {
                 *  if (e.Pointer.PointerDeviceType == PointerDeviceType.Pen)
                 *  {
                 *      e.Handled = true;
                 *      return;
                 *  }
                 * };
                 */
                comboBox.DropDownOpened += (o, e) =>
                {
                    comboBox.Width = comboBox.ActualWidth;
                };

                comboBox.DropDownClosed += (o, e) =>
                {
                    comboBox.Width = Double.NaN;
                };

                comboBox.SelectionChanged += selectionChanged;
            }
        }