Add new lines on top in TextBlock - wpf

I'm working with a TextBlock and Inlines to add new text which contains some information from a HTTP request.
How can I add new text coming from the top instead of a bottom like it works by default?

If your TextBlock has a name and you modify it from code-behind...
<TextBlock x:Name="MyTextBlock"/>
You can use InsertBefore with FirstInline to add the inline as first element to Inlines.
MyTextBlock.Inlines.InsertBefore(MyTextBlock.Inlines.FirstInline, new Run("My text to add as first inline."));
If you want to put newlines in between the text that you add, use LineBreak.
MyTextBlock.Inlines.InsertBefore(MyTextBlock.Inlines.FirstInline, new LineBreak());

Related

How can I detect Hyperlink Text Change?

I have this richtextbox with some hyperlinks, these hyperlinks allows users to change the text of it, and I need to make further actions when the text of it is changed. The hyperlink itself has nothing special, just like below:
Hyperlink link = new Hyperlink();
Run run = new Run("haha");
link.Inlines.Add(run);
When the users type within the link, I would like to detect that user action and make further moves, something like:
link.textchanged += myHandler;
So far, I tried to use textBox as the inline of the hyperlink, though it works, but there are so many downsides such as it automatically switch to the next line when there's no enough space.
I also tried to use textrange.changed method, but it did not work.
Thanks!

Removing Border/Margin/Padding from Form

I created a derived Form class, with the constructor using GridLayout as a parameter.
How do I remove the white border(or the margin/padding) from a form object? I tried updating listItemGapInt in my theme.res but that failed to work.
Here is an example of a form taking up the screen. (I believe the border is coming from my Form, it may be from my GridLayout)
Override both Form and ContentPane UIID's in the theme and make sure they have 0 padding/margin:
Double click theme.res
Select "Theme"
Click Add on the bottom
Type in Form on the top combo box
Select Margin tab and uncheck the Derive flag. Do the same for padding
Repeat this with ContentPane instead of form
Press Save in the designer tool

Combo Box, More Than One Item In A Row

I'm adding image items to a ComboBox, as you know ComboBox shows just one item in a row, but I want my combo to show more than one, and show images like they are all beside each other with a little space around them, so the user can pick one...
Any Help is pretty much appreciated...
You need to change the ComboBox.ItemsPanel to a WrapPanel.
You would have to edit the ItemTemplate and the ItemsPanel.
Right click the combobox and select Edit Aditional Template --> Edit Generated Items --> Create Empty
Add an image and a text to a Vertical StackPanel in the template and set the bindings.
Now leave the template editing and right click the combobox again.
This time go to Edit Aditional Template --> Edit Layout of Items --> Edit a Copy
Change the StackPanel to a UniformGrid and set the Columns property of this to 2.
The result should look a little like this:
I used sample data in this example. 2 properties: one image, one String(Name).

Reporting Services 2008 Visibility

Using reporting services and trying to hide a field placeholder value when it does not equal "View" The value is hyperlinked to a subreport and is located in a bordered textbox inside a tablix. If I use the visibility feature for the text box, I can hide the non-view hyperlinks with an expression, but it hides the entire textbox and the textbox borders go away for that cell--I really want them to remain and just show the empty cell. If, instead, I try to hide the value on the placeholder level, which does not present the visibility option, and I attempt to evaluate the expression for the placeholder value to Nothing or '' when it is not valued as "View" then I get a hyperlink dash display in the column where I think it's attempting to render an unvalued hyperlink, which I really don't want. I just want an empty, bordered textbox.
Any way around this?
One solution is to change the visibility of the textbox value like this
IIF(fields(View.value) = 'true' , fields(TextBoxVariable.value), " ")
note that " " at the end will hide your dash
Or you can put a rectangle in the tablix cell and set its border, the you can put a textbox inside of the rectangle and change the visibilityof the textbox easily
put you link action on placeholder properties: Action - go to subreport, then put hidden expression on textbox: IIF(Fields!NameFields="View", true, false)
it works for me.
I know this is an old post, but I recently ran into this same issue.
Remove the expression from the text box properties and add it to the expression box of the field (right-click on the field and instead of choosing Text Box Properties>Visibility, choose Expression from the context menu). This will replace the field with an expression and the border lines will still exist.
Here's what I added to my expression:
=IIF(FORMAT(CDATE(Fields!ApprovedDate.Value),"dd-mm-yyyy") > "01-01-1980",Fields!ApprovedDate.Value," ")
I think that the easiest way to get rid off this hyperlink dash, is to change the font effect of the text-box. Just select Font-tab from text-box properties and from there, click fx-button of Effects and put somethin like this as expression:
=IIF(Fields!YourValueField.Value is nothing, "None", "Underline")

WPF handle column header click

how to handle a column header click (WPF's DataGrid)
I want to get clicked column header's text from code and change it's background...
ButtonBase.Click can be used

Resources