Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7920997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:25:18+00:00 2026-06-03T16:25:18+00:00

I have my own custom element derived from StyledMultilineElement: public class SubmenuElement : StyledMultilineElement

  • 0

I have my own custom element derived from StyledMultilineElement:

public class SubmenuElement : StyledMultilineElement
{

    public static UITableViewCellStyle DefaultCellStyle { get; set; }

    public static UITableViewCellAccessory DefaultCellAccessory { get; set; }
    public static UILineBreakMode DefaultDetailTextLineBreakMode { get; set; }

    public UILineBreakMode DetailTextLineBreakMode { get; set; }
    public int? DetailLines { get; set; }
    public bool? DetailTextResizesFontToFitWidth { get; set; }


    static SubmenuElement()
    {
        // Set the defaults
        DefaultCellStyle = UITableViewCellStyle.Default;
        DefaultCellAccessory = UITableViewCellAccessory.DisclosureIndicator;
        DefaultDetailTextLineBreakMode = UILineBreakMode.TailTruncation;
    }

    ...


    public override UITableViewCell GetCell (UITableView tv)
    {
        var cell = base.GetCell (tv);
        if (cell.DetailTextLabel != null && !string.IsNullOrWhiteSpace(cell.DetailTextLabel.Text))
        {
            if (DetailLines.HasValue)
                cell.DetailTextLabel.Lines = DetailLines.Value;
            cell.DetailTextLabel.LineBreakMode = DetailTextLineBreakMode;
            if (DetailTextResizesFontToFitWidth.HasValue)
                cell.DetailTextLabel.AdjustsFontSizeToFitWidth = DetailTextResizesFontToFitWidth.Value;
        }
        return cell;
    }

}

It seems that setting the LineBreakMode for DetailText has no effect.

public class PeopleView
{

    ....



    void CreateUI()
    {
        var root = new RootElement(Header)
        {
            GroupAndSortResults(people, CurrentState.PeopleDirectoryOptions.GroupAndSort)
                .Select (g => new Section(g.Key)
                {
                    g.Select<PeopleListItem, SubmenuElement> (p => new SubmenuElement(
                        GetName (p),
                        p.TypeGradeSchool, 
                        () => GoToPersonProfile(p.ID),
                        null,
                        UITableViewCellAccessory.None,
                        UITableViewCellStyle.Subtitle
                    )
                {
                    ImageUri = PersonAvatarImage.GetAvatar (p.ID),
                    OnImageLoaded = WhenImageLoaded,
                    DetailTextLineBreakMode = UILineBreakMode.MiddleTruncation,
                    DetailTextResizesFontToFitWidth = true,
                    DetailLines = 0
                }).ToArray ()
                }).ToArray()
        };
        this.Root = root;
        this.NavigationItem.RightBarButtonItems = new UIBarButtonItem[] 
        {
            new UIBarButtonItem(UIBarButtonSystemItem.Organize, new EventHandler(WhenOrganizerTapped)),
            new UIBarButtonItem(UIBarButtonSystemItem.Refresh, new EventHandler(WhenRefreshTapped))
        };
    }

}

Any ideas on why the truncation for detail lines doesn’t work? Everything else works properly. My default is tail truncation but for this specific view I wanted middle truncation. No truncation styles work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:25:20+00:00Added an answer on June 3, 2026 at 4:25 pm

    I figured it out fast… It will truncate when the DetailLines property is set to 1. Truncation or text resizing using AdjustsFontSizeToFitWidth doesn’t work unless that lines number is set to 1.

    If there is a similar question to this one on SO, I will delete this question, unless it is upvoted (it helps someone else out).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my installer I have set WixUIBannerBmp to point to my own custom dialog-banner.bmp
I have a custom control of class DottedCanvas inherited from Canvas, which contains some
I have my own custom Content Provider that loads a database which contains the
We have our own custom calendar in our portal which is developed in Java.
I have my own custom tool for Visual Studio 2008 SP1. It consists of
I have my own custom UISegmentedControl subclass. It's buttons are bigger than the standard
I have created a custom list view, each row has it's own custom selector,
I have created my own button class called custom_btn. I created it on the
I'm trying to hide window after its startup. I have own window-class which is
What do I have to do to implement my own stream, which uses custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.