Open Windows Phone ApplicationBar from code-behind - c#

Is there an official way or trick to open the Windows Phone ApplicationBar using C# from the code-behind? I'd like to show my users additional options hidden in the menu.
To be clear, I don't need to create the menu in code-behind (but can, if that helps in any way).

There are no way to open application bar programmatically. But you can create application bar in C#. Here is the sample.
ApplicationBar = new ApplicationBar();
ApplicationBar.Mode = ApplicationBarMode.Default;
ApplicationBar.Opacity = 1.0;
ApplicationBar.IsVisible = true;
ApplicationBar.IsMenuEnabled = true;
ApplicationBarIconButton button1 = new ApplicationBarIconButton();
button1.IconUri = new Uri("/Images/YourImage.png", UriKind.Relative);
button1.Text = "button 1";
ApplicationBar.Buttons.Add(button1);
ApplicationBarMenuItem menuItem1 = new ApplicationBarMenuItem();
menuItem1.Text = "menu item 1";
ApplicationBar.MenuItems.Add(menuItem1);

Related

Gtk# application is not rendering TreeView Properly

I am trying to develop a gtk application on mac using gtk#. I created a tree view just like in the tutorial but the arrows are not rendering properly as seem below, there are no arrows. I can click to open and close but the actual arrows aren't working.
I copy pasted the code from the tutorial and It did the same thing, but here is my code anywhere. I have also verified view.ShowExpanders is set to true
Application.Init();
Window window = new Window("Editor Window");
window.SetPosition(WindowPosition.Center);
window.HeightRequest = 800;
window.WidthRequest = 1200;
TreeView view = new TreeView();
view.WidthRequest = 500;
TreeViewColumn column = new TreeViewColumn();
column.Title = "Heirarchy";
CellRendererText cell = new CellRendererText();
column.PackStart(cell, true);
view.AppendColumn(column);
column.AddAttribute(cell, "text", 0);
TreeStore store = new TreeStore(typeof(string));
TreeIter i = store.AppendValues("Project");
i = store.AppendValues(i,"Room1");
i = store.AppendValues(i, "Item");
store.AppendValues(i, "Attribute");
store.AppendValues(i, "Attribute");
store.AppendValues(i, "Attribute");
view.ShowExpanders = true;
view.Model = store;
view.ShowExpanders = true;
window.Add(view);
window.DeleteEvent += ExitWindow;
window.ShowAll();
Application.Run();
Is there some sort of image asset that doesn't exist on my computer? How would I install that on mac? Thank you for any help you can provide.
As a comment suggested, using brew install adwaita-icon-theme fixed the problem

To avoid the Windows form to disappear under the task bar when opened as IE page

I am using SHDocVw.InternetExplorer() for open new IE page ,for mainley used height and width set for IE page But my application open as new IE page goes under the tool bar. After i will click it will open which I tried many ways.
Please give any idea to open IE with height and width.
below my code:
var IE = new SHDocVw.InternetExplorer();
object URL = "http://www.northwind.com";
IE.ToolBar = 0;
IE.StatusBar = false;
IE.MenuBar = false;
IE.Width = 540;
IE.Height = 640;
IE.Visible = true;
IE.Navigate2(ref URL);

How to create a pop up window when a button is clicked

This is the code I have for the button. I want the configbutton to display a pop up window when clicked on. I have looked up and tried a lot of different codes but none of them work. I feel like I am missing a key component but I am not sure what that is. Appreciate the help!
tr = new TableRow();
// Create the cell
tc = new TableCell();
tc.Width = Unit.Point(300);
tc.BorderWidth = 0;
tc.BorderStyle = BorderStyle.None;
Button ConfigButton = new Button();
ConfigButton.Text = "Configuration";
ConfigButton.Visible = true;
tc.Controls.Add(ConfigButton);
tr.Cells.Add(tc);
tbl.Controls.Add(tr);
Using JavaScript Along with ASP.NET you will do the following:
// when you create the button, you can add attributes
Button ConfigButton = new Button();
// this example will display alert dialog box
ConfigButton.Attributes.Add("onclick", "javascript:alert('ALERT ALERT!!!')");
// to get you popup windows
// you would use window.open with the BLANK target
ConfigButton.Text = "Configuration";
ConfigButton.Visible = true;
I recommend looking into using the AJAX Control Toolkit ModalPopupExtender. This is what I use for my pop ups in ASP.NET.
Here is a link to he AJAX Control Toolkit samples website showing how this control works:
http://www.ajaxcontroltoolkit.com/ModalPopup/ModalPopup.aspx

WPF App doesn't run on Tablet

I wrote a simple wpf application which handles a TCPIP and a Serial communication. At the first version of the App I used a "GUI" with a connect button and so on. This version was running on the Tablet. The Tablet is a ThinkPad with Windows 8.
The second version the app should run without any GUI, but with an taskbar icon. I was able to create the taskbar icon and so. The app perfectly works on my computer. Its possible to install the app on the tablet, but it just doesn't run.
Has anybody a clue why the app doesn't open?
Beneath you can find some source code, how I created the icon and so on. In the Visual Studio project I disabled the "Main Window" which looks like this
xml-code
Title="MainWindow" Height="350" Width="525" Visibility="Hidden">
c# - code
public MainWindow()
{
InitializeComponent();
// Initailize Menu
this.components = new System.ComponentModel.Container();
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
// Initialize contextMenu1
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1 });
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem2 });
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem3 });
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem4 });
// Initialize Menu Items
this.menuItem3.Index = 0;
this.menuItem3.Text = "Connect";
this.menuItem3.Click += new System.EventHandler(this.Connect);
//
this.menuItem2.Index = 1;
this.menuItem2.Text = "Disconnect";
this.menuItem2.Click += new System.EventHandler(this.Disconnect);
//
this.menuItem4.Index = 2;
this.menuItem4.Text = "About";
this.menuItem4.Click += new System.EventHandler(this.About);
//
this.menuItem1.Index = 3;
this.menuItem1.Text = "Exit";
this.menuItem1.Click += new System.EventHandler(this.Exit);
// Create the NotifyIcon.
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
// The Icon property sets the icon that will appear
// in the systray for this application.
notifyIcon1.Icon = new Icon("icon.ico");
// The ContextMenu property sets the menu that will
// appear when the systray icon is right clicked.
notifyIcon1.ContextMenu = this.contextMenu1;
// The Text property sets the text that will be displayed,
// in a tooltip, when the mouse hovers over the systray icon.
notifyIcon1.Text = "Icon Test";
notifyIcon1.Visible = true;
//Handle the Click event
notifyIcon1.MouseUp += new MouseEventHandler(ShowContextMenu);
}
EDIT
is it possible that System.Windows.Input using directive is needed that the app starts on the tablet? I had to exclude that one because of a collision with another using directive..
There is another issue. I believe its an Windows 8 error. The app is working on my Win7 machine, but neither on a Win8 notebook nor a Win8 tablet.

Gtk# Embed TextView in ToolBar

Is there any way to embed a TextView widget in a ToolBar? I am using Gtk# with C# on mono in Linux.
I recently had to do this for a project and was able to accomplish by manually setting the Width and Height Request. Putting the TextView in a HBox (or similar) also works.
Toolbar _toolBar = new Toolbar();
TextView t = new TextView();
t.WidthRequest = 200;
t.HeightRequest = 20;
_toolBar.Add(t);
t.Buffer.Text = "Hello World!";
t.Visible = true;

Categories