Here is my problem. After I select iten I have 4 options to click, then each options give me 4 additional final options.
So now I have command bar:
And now after I click one of buttons I want to show another command bar above the first one:
Is it possible with winRT for Windows Phone 8.1? Or maybe show some Fly Menu with icons?
like so:
here is code for adding FlyOut menu but ... when i click sendBtn everything gets grey but nothing is shown ;/
MenuFlyout testMenu = new MenuFlyout();
MenuFlyoutItem item1 = new MenuFlyoutItem();
item1.Text = "Test1";
MenuFlyoutItem item2 = new MenuFlyoutItem();
item1.Text = "Test2";
testMenu.Items.Add(item1);
testMenu.Items.Add(item2);
AppBarButton sendBtn = new AppBarButton();
sendBtn.Label = textLoader.GetString("SendToService");
sendBtn.Icon = new SymbolIcon(Symbol.Mail);
sendBtn.Flyout = testMenu;
command_bar.PrimaryCommands.Add(sendBtn);
As for your main question - there is no possiblity to make double commandbar. Though you may build your own control and implement such functionality.
As for your code - in my case it seems to work - I've tried like this:
CommandBar command_bar;
public MainPage()
{
this.InitializeComponent();
command_bar = new CommandBar();
MenuFlyout testMenu = new MenuFlyout();
MenuFlyoutItem item1 = new MenuFlyoutItem();
item1.Text = "Test1";
MenuFlyoutItem item2 = new MenuFlyoutItem();
item2.Text = "Test2";
testMenu.Items.Add(item1);
testMenu.Items.Add(item2);
AppBarButton sendBtn = new AppBarButton();
sendBtn.Label = "SendToService";
sendBtn.Icon = new SymbolIcon(Symbol.Mail);
sendBtn.Flyout = testMenu;
command_bar.PrimaryCommands.Add(sendBtn);
BottomAppBar = command_bar;
}
You have one mistake - your second MenuItem has empty label - you change the first twice.
Also if you encounter problem with bad positioning of your flyout then this answer may help.
Related
I'm Having a problem regarding to the autocomplete textbox. First I already made the autocomplete textbox work with mysql database as custom source but the default textfilter of autocomplete is "start with" not "contains". I want to change the textfilter to "contains", so that when I search any part of the string, the whole name which contains the searched word will appear in the autocomplete suggestions.
Can anyone help me fix my code?
This is the code i've done so far:
txtSearch.AutoCompleteMode = AutoCompleteMode.SuggestAppend
txtSearch.AutoCompleteSource = AutoCompleteSource.CustomSource
Dim DataCollection As New AutoCompleteStringCollection()
Dim query As String
sqlcon = New MySqlConnection
sqlcon.ConnectionString =
"server=localhost;userid=root;password=root;database=svfmemberlistdb"
Try
sqlcon.Open()
query = " SELECT Name FROM svfmemberlistdb.svfmemberlist "
sqlcmd = New MySqlCommand(query, sqlcon)
sqladr.SelectCommand = sqlcmd
sqladr.Fill(ds)
sqladr.Dispose()
sqlcon.Close()
For Each row As DataRow In ds.Tables(0).Rows
If row.ToString.Contains(txtSearch.Text) Then
DataCollection.Add(row(0).ToString())
End If
Next
Catch ex As Exception
End Try
txtSearch.AutoCompleteCustomSource = DataCollection
I quote here Mitja Bonca's answer on MSDN.
In this case, autocompletemode will just not do. Its code is not meant
for something like it.
You will have to do your own code, to do the filtering on each letter
press.
So I would suggest not to use autocompletemode, and get all the data
(names) into dataTable. When user presses some button ("1" for
example), you start with your filtering, by creating new Datatable
(leave the main one untached - so you can return back to all data when
clearing comboBox by backspace), with Copy() method - to create a full
copy of original one, and use Select method to do the filteing.
This should look something like by using % simbol on both sides of a
string - to filter inbetween - this is what you want!
DataTable AllNames = new DataTable();
//fill it up and leave it untouched!
//to filter comboBox with names that contains pressed characters do in
private void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
{
string name = string.Format("{0}{1}", comboBox1.Text, e.KeyChar.ToString()); //join previous text and new pressed char
DataRow[] rows = table.Select(string.Format("FieldName LIKE '%{0}%'", name));
DataTable filteredTable = AllNames.Clone();
foreach(DataRow r in rows)
filteredTable.ImportRow(r);
comboBox1.DataSource = null;
comboBox1.DataSource = filteredTable.DefaultView;
comboBox1.DisplayMember = "FieldName";
}
Reference
EDIT: This is of course a c# answer not VB.NET but it might be helpful to get the concept.
I am trying to combine LineSeries, ScatterSeries and HeatmapSeries on a single OxyPlot instance. I am able to show the first two just fine on the same plot and it looks like the following:
The axes for this are generated by the following code:
var xAxis = new DateTimeAxis();
xAxis.Key = "X";
xAxis.Position = AxisPosition.Bottom;
xAxis.AbsoluteMinimum = DateTimeAxis.ToDouble(CurrentPass.AOS);
xAxis.AbsoluteMaximum = DateTimeAxis.ToDouble(CurrentPass.LOS);
xAxis.AxislineColor = xAxis.TextColor = xAxis.TicklineColor = xAxis.MajorGridlineColor = OxyColors.DarkGray;
var yAxis = new LinearAxis();
yAxis.Key = "Y";
yAxis.Position = AxisPosition.Left;
yAxis.AbsoluteMinimum = 0.0;
yAxis.AbsoluteMaximum = MaximumFrequency;
yAxis.Maximum = MaximumFrequency;
yAxis.AxislineColor = yAxis.TextColor = yAxis.TicklineColor = yAxis.MajorGridlineColor = OxyColors.DarkGray;
If I add in a third axes for the Heatmap (not even a HeatMapSeries yet), I get the following:
The extra code here for the axis for the HeatMap is:
var heatmapAxis = new LinearColorAxis();
heatmapAxis.AbsoluteMinimum = 0.0;
heatmapAxis.AbsoluteMaximum = MaximumFrequency;
heatmapAxis.Palette = OxyPalettes.Gray(1024);
heatmapAxis.Key = "HeatMap";
I am not sure what's going on here. The line series still shows. And all the ScatterPoints from the scatterseries I have are definitely there - the tracker shows up and I can interact with the points (hover, click etc.). But the points don't show. If I add a HeatMapSeries, the HeatMapSeries data does show up as expected, the LineSeries data still shows up but no ScatterSeries data.
Again, the HeatMap data and the Scatter Series data show up individually, but never together.
Has anyone encountered this before? Are there workarounds?
Thanks,
Aditya
Sorry this is a bit late but just stumbled upon this. I had something similar with a line not showing up on a Heatmap and after some experimenting i realized the order in which the series' are added to the plot model make a big difference. Make sure you add your ScatterSeries after you've added your Heatmap to the plot model.
I am trying to mask an image on another so that I only view the specific portion of the unmasked image through the masked one. My problem is that I cannot see anything on the screen.. no Image, no effect at all
cardMask = new Image(Root.assets.getTexture("card_mask"));
cardMask.y = Constants.STAGE_HEIGHT*0.40;
cardMask.x = Constants.STAGE_WIDTH *0.48;
trace("it's add mask");
cardLight = new Image(Root.assets.getTexture("card_light_mask"));
cardLight.y = Constants.STAGE_HEIGHT*0.46;
cardLight.x = Constants.STAGE_WIDTH *0.48;
cardLight.mask=cardMask;
maskedDisplayObject = new PixelMaskDisplayObject(-1,false);
maskedDisplayObject.addChild(cardLight);
maskedDisplayObject.x=cardLight.x;
maskedDisplayObject.y=cardLight.y;
maskedDisplayObject.mask=cardMask;
maskedDisplayObject.blendMode = BlendMode.SCREEN;
addChild(maskedDisplayObject);
First, for masking an object the mask object should also be added to the display list. Your code does not add cardMask to display list anywhere. Second, if your maskedDisplayObject should be visible at all times, the mask should be assigned not to it, but to some other object which displayed part you desire to control. And third, it is also possible that this.stage is null, therefore the entire tree (this -> maskedDisplayObject -> cardLight) is plain not rendered. You need to check all three of these conditions to get something displayed.
Also, if you desire cardLight as an object to move independently of maskedDisplayObject, you should add it to this instead, and check that it's displayed on top of maskedDisplayObject (call addChild(cardLight) after addChild(maskedDisplayObject)).
This all totals to this code:
trace("Stage is null:", (this.stage==null)); // if this outputs true, you're out of display
cardMask = new Image(Root.assets.getTexture("card_mask"));
cardMask.y = Constants.STAGE_HEIGHT*0.40;
cardMask.x = Constants.STAGE_WIDTH *0.48; // mask creation unaltered
trace("it's add mask");
cardLight = new Image(Root.assets.getTexture("card_light_mask"));
cardLight.y = Constants.STAGE_HEIGHT*0.46;
cardLight.x = Constants.STAGE_WIDTH *0.48;
cardLight.mask=cardMask; // this is right
maskedDisplayObject = new PixelMaskDisplayObject(-1,false);
// maskedDisplayObject.addChild(cardLight); this is moved to main part of display list
maskedDisplayObject.x=cardLight.x;
maskedDisplayObject.y=cardLight.y;
// maskedDisplayObject.mask=cardMask; NO masking of this, you're only masking cardLight
cardLight.blendMode = BlendMode.SCREEN; // display mode is also changed
addChild(maskedDisplayObject);
addChild(cardLight);
Ignore this to get to the main problem, below is only the idea
Scenario: I am making a total Private Messaging system in Visual Basic.
Trying: I want to make an Inbox for the users. The messages will be retrieved from the MySQL database and shown in small custom Grid made with Panel(Type of Control from Visual basic) for each message which will be clickable which is when clicked, the whole message will be shown.
Did so far: Not too much though(Talking about the Inbox.), I only wrote the MySQL query.
I will make the Sending and Reading PM after the Inbox as Inbox seems more complex than the other two things.
I really want to know how can this be achieved. I searched around almost everywhere, either it was for PHP and web based or nothing. I want to know how to dynamically create controls like panels and the labels and show the PMs. Is there any other way to do this rather than showing the PMs in DataGridView ? (I really don't want to use that as it's not what I want.)
For reference: The custom Grid is something like this:
The MySQL PM table:
PMId - The ID for the message (Auto Incremented)
Sender_Name - The person sending the message
Receiver_Name - The person receiving the message
Subject - The subject of the message
Date_Sent - Date on which the message was sent
PM_Read - If the PM has been read (0 for not read, 1 for read)
Deleted - If the PM has been deleted (0 for not deleted, 1 for deleted)
Look at the code-behind for a built form and you will see how to create controls at run-time. For example, I created a form, added a panel with a button and label and this is the code created in the designer:
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.Panel1.SuspendLayout()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(3, 3)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(3, 29)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(39, 13)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Label1"
'
'Panel1
'
Me.Panel1.Controls.Add(Me.Button1)
Me.Panel1.Controls.Add(Me.Label1)
Me.Panel1.Location = New System.Drawing.Point(12, 12)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(198, 69)
Me.Panel1.TabIndex = 2
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(284, 262)
Me.Controls.Add(Me.Panel1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.Panel1.ResumeLayout(False)
Me.Panel1.PerformLayout()
Me.ResumeLayout(False)
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Panel1 As System.Windows.Forms.Panel
You can do the same thing at run-time.
Dim iTop As Int32 = 5
For Each DR As DataRow In DT.Rows
Dim pnl As New Panel
pnl.Location = New System.Drawing.Point(12, iTop)
pnl.Size = New System.Drawing.Size(198, 40)
Dim lbl As New Label
lbl.Location = New System.Drawing.Point(3, 3)
lbl.Size = New System.Drawing.Size(39, 13)
lbl.Text = DR("Some field from your table")
'Add to panel
pnl.Controls.Add(lbl)
'Add to Form
Me.Controls.Add(pnl)
'Add to the top location so the next set of controls are not on top of the old ones
iTop += 50
Next
I'm creating a memory like game. I built all the desktop, the cards generation. I now have two cards of each.
I'm trying to do the pairs delete system.
my function to show the color to find looks like this :
private function onClick(e:MouseEvent):void
{
if (vueDos)
{
vueDos = !vueDos;
faceCarte = new Sprite();
faceCarte.graphics.lineStyle(2,0x000000,.5);
faceCarte.graphics.beginFill(clr);
faceCarte.graphics.drawRoundRect(8,8,this.width - 16, this.height - 16, 10,10);
faceCarte.graphics.endFill();
var _t:TextField = new TextField();
_t.selectable = false;
_t.antiAliasType = "advanced";
_t.autoSize = "left";
_t.defaultTextFormat= new TextFormat(maFont.fontName,24,0x000000);
_t.text = couleur;
_t.x = (this.width - _t.width)/2
_t.y = (this.height - _t.height) >> 1;
faceCarte.addChild(_t);
faceCarte.cacheAsBitmap = true;
this.addChild(faceCarte);
}
if(!vueDos)
}
Does it exist a function wich see if the color of the card is visible (faceCarte), and limit the visibles carte to two then removeChild faceCart.
Thank you in advance
You have to make such a function yourself. It'll be better to assign a couleur property to the card itself, instead of putting it into the TextField and forgetting. This way you'll be able to open first card, get that property, then open second card and compare that one's property with what you received, if match, both cards will be removed.