Beispiel #1
0
    public TImagePositionItem (TStyleInfo styleHorizontalInfo, TStyleInfo styleVerticalInfo, TImagePosition imagePosition)
      : this ()
    {
      Position = imagePosition;

      if (imagePosition.Equals (TImagePosition.None).IsFalse ())  {
        if (styleHorizontalInfo.NotNull () && styleVerticalInfo.NotNull ()) {
          var width = TContentStyle.RequestStyleSize (styleHorizontalInfo.StyleMode, styleHorizontalInfo.Style);
          var height = TContentStyle.RequestStyleSize (styleVerticalInfo.StyleMode, styleVerticalInfo.Style);

          switch (Position) {
            case TImagePosition.Left:
            case TImagePosition.Right:
              Size.Width = (int) (width * .4); // 40%
              Size.Height = height;
              break;

            case TImagePosition.Top:
            case TImagePosition.Bottom:
              Size.Width = width;
              Size.Height = (int) (height * .4); // 40%
              break;

            case TImagePosition.Full:
              Size.Width = width;
              Size.Height = height;
              break;
          }
        }
      }
    }
Beispiel #2
0
 public void CopyFrom(TStyleInfo alias)
 {
     if (alias.NotNull())
     {
         StyleMode = alias.StyleMode;
         Style     = alias.Style;
     }
 }
Beispiel #3
0
    public void Select (TStyleInfo styleInfo, bool locked)
    {
      if (styleInfo.NotNull ()) {
        TStylePropertyItem styleItem = null;

        for (int index = 0; index < StyleItemsSource.Count; index++) {
          styleItem = StyleItemsSource [index];

          if (styleInfo.Contains (styleItem.StyleInfo)) {
            StyleSelectedIndex = index;
            break;
          }
        }

        if (styleItem.NotNull () && locked) {
          StyleItemsSource = new Collection<TStylePropertyItem>
        {
          styleItem
        };

          StyleSelectedIndex = 0;
        }
      }
    }
Beispiel #4
0
 public bool Contains(TStyleInfo styleInfo)
 {
     return(styleInfo.NotNull() ? Style.Equals(styleInfo.Style) : false);
 }