Set Minimum Button Width in Xamarin Forms or iOS - xamarin.ios

We are developing an application using Xamarin Forms, but rely heavily on custom renderers for iOS, including as our button base class. I have a requirement to set all buttons in the application to a minimum width of 120, however it doesn't appear that MinimumWidthRequest accomplishes this. How would I set the minimum width of a button?

try this alternative
var button = new Button();
if (button.WidthRequest < 120)
{
button.WidthRequest = 120;
}

Related

I want to display the button vertically with microsoft teams

I am developing a bot to use with microsoftteams. I am using the button to display the answer options, but if I check with ios or Android it will be displayed side by side. Is there any way to display buttons vertically?
for(var i= 0; i< arrayList.length; i++ ){
var val = arrayList[i].choice;
buttons.push(builder.CardAction.imBack(session, val, val));
}
var card = new builder.HeroCard(session).buttons(buttons);
var msg = new builder.Message(session).addAttachment(card);
builder.Prompts.text(session, msg);
No, unfortunately right now you can't control the layout of the buttons on a card.
Do you mind adding this as a suggestion on UserVoice, with examples of why this level of control would be useful, so others can vote on your idea?
While unfortunately hero cards are bound to the layouts given by their respective channels/viewing devices (ie why you get different views on Teams vs iOS), adaptive cards will allow for greater formatting of layout. At this time however, adaptive cards are not available on Microsoft Teams.

how to remove default graphic assigned to a control (like buttons and checkboxes) before setting new graphic to that control in java fx scene builder?

i am making a java desktop application using javafx. For gui building i am using scene builder 2.0.
Everything is just perfect as expected just 1 thing. I want to customize the buttons. i want to assign a custom graphic to a button.
When i use [button.setgraphic(node)] , this statement set the new graphic to the button but default graphic of button also remains present as well.
I just want to remove the default graphic and then want to assign the new (custom) garaphic to a control like buttons and radio buttons in javafx. 1 thing again i must tell that i am using scene builder for building gui.
How can i achieve this ?
thanks in advance....
Below is the screen-shot of current occuring situation, .....
Here i have made a button using javafx scene builder , and then in the controller of the fxml file (.java file) i am trying to set the image (shown in orange box in snapshot) to that button by using setGraphics property of button ..... i just need that button to be of following shape ...
You'd better customize your button via CSS. Here goes tutorial. What you are trying to do is to modify button picture (which is empty by default). I guess this wasn't your exact purpose.
button.setGraphic(null)
// worked for me.

Cannot set icons for buttons in the ribbon of MFC office style application

The only icons I was able to set for buttons in the ribbon of my MFC Office style application are the ones made available through the image index combo boxes in the button properties, all attempts to add custom images as icons failed.
Can someone please walk me through the process of setting icons for MFC ribbon buttons?
Instead of using an index when creating the button like this
CMFCRibbonButton *btnMyButton =
new CMFCRibbonButton (ID_APP_ABOUT, _T("About"), 13, 13);
you also can do it this way:
CMFCToolBarImages m_myOtherPanelImages;
...
CMFCRibbonButton *btnMyButton = new CMFCRibbonButton (ID_APP_ABOUT,
_T("About"), m_myOtherPanelImages.ExtractIcon(0));
In my CMFCRibbonBar derived clas, I use something like:
CMFCToolBarImages* pImageList;
pImageList= &GetCategory(0)->GetLargeImages();
pImageList->AddIcon(theApp.LoadIcon(IDI_SOME_ICON), true);
// ... and so on for every categorry and button, assuming that you have set the LARGE image indexes correctly for each button.
and it works.

Nokia S40 custom header bar

I'm building a custom header bar for Nokia S40, in LWUIT.
I've found 2 issues.
My Form has a BorderLayout and I've added the header bar (Container) in the NORTH. This container doesn't fill the width of the Form, as the CategoryBar does. I try with BoxLayout but I get the same result. I want that my custom header bar looks like the native CategoryBar, full width and visible over the rest of the Components.
Second issue.
I set my app to full screen using Display.getInstance().setForceFullScreen(true); and I've lost all the back Commandsof my app. Any idea?
You cannot change "headers" color if you are using Nokia S40. The color will be follow the mobile phone color theme.
The only way is using full screen, and draw ourself the Headers.
In my application it's work:
protected void createTitle(Form f) {
Container titleContainer = f.getTitleArea();
titleContainer.removeAll();
titleContainer.setLayout(new BorderLayout());
titleContainer.addComponent(BorderLayout.CENTER, titleBarContainer);
titleContainer.addComponent(BorderLayout.EAST, labelLogo);
}

Hide Controls At Design-Time [duplicate]

I need to handle multiple panels, containing variuous data masks. Each panel shall be visible using a TreeView control.
At this time, I handle the panels visibility manually, by making the selected one visible and bring it on top.
Actually this is not much confortable, especially in the UI designer, since when I add a brand new panel I have to resize every panel and then design it...
A good solution would be using a TabControl, and each panel is contained in a TabPage. But I cannot find any way to hide the TabControl buttons, since I already have a TreeView for selecting items.
Another solution would be an ipotethic "StackPanelControl", where the Panels are arranged using a stack, but I couldn't find it anywhere.
What's the best solution to handle this kind of UI?
You need a wee bit of Win32 API magic. The tab control sends the TCM_ADJUSTRECT message to allow the app to adjust the tab size. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form.
You'll get the tabs at design time so you can easily switch between pages. The tabs are hidden at runtime, use the SelectedIndex or SelectedTab property to switch between "views".
using System;
using System.Windows.Forms;
class StackPanel : TabControl {
protected override void WndProc(ref Message m) {
// Hide tabs by trapping the TCM_ADJUSTRECT message
if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
else base.WndProc(ref m);
}
}
A good solution would be using a TabControl, and each panel is contained in a TabPage.
But I cannot find any way to hide the TabControl buttons, since I already have a
TreeView for selecting items.
For the above,
You need to set the following properties of TabControl.
tabControl.Multiline = true;
tabControl.Appearance = TabAppearance.Buttons;
tabControl.ItemSize = new System.Drawing.Size(0, 1);
tabControl.SizeMode = TabSizeMode.Fixed;
tabControl.TabStop = false;

Resources