In my model I have such property
...
public string LastClipFrame
{
get
{
var result = MCConstants.DEFAULT;
if (_LastClipFrame != MCConstants.DEFAULT_LAST_CLIP_FRAME)
{
return _LastClipFrame.ToString();
}
else if (IsLastFrameClipInFocus)
{
result = string.Empty;
IsLastFrameClipInFocus = false;
}
return result;
}
set
{
if (string.IsNullOrEmpty(value))
{
_LastClipFrame = MCConstants.DEFAULT_LAST_CLIP_FRAME;
}
else if (!value.Contains("-") && int.TryParse(value, out int tmpVal))
{
_LastClipFrame = tmpVal;
}
OnPropertyChanged();
}
}
...
And I use it in my .xaml
...
<TextBox x:Name="Tb_last_clip_frame"
Grid.Column="0"
GotFocus="Tb_last_clip_frame_GotFocus"
LostFocus="Tb_last_clip_frame_LostFocus"
Text="{Binding Path=LastClipFrame, UpdateSourceTrigger=PropertyChanged}"
Margin="5,5,0,5"
HorizontalAlignment="Stretch" />
...
Now I would like to add one if
condition like if LastClipFrame = "default"
, so do nothing, but if is isn't (like any other word), so make this word bold
How to do it?
I found a lot of ways how to make color, how to make specific word how to make anything you want, but nothing about just how to textbox.setBold(true)
... or something like this.
EDIT
#region Assembly PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\PresentationCore.dll
#endregion
using System.ComponentModel;
namespace System.Windows
{
//
// Summary:
// Refers to the density of a typeface, in terms of the lightness or heaviness of
// the strokes.
[Localizability(LocalizationCategory.None)]
[TypeConverter(typeof(FontWeightConverter))]
public struct FontWeight : IFormattable
{
//
// Summary:
// Compares two instances of System.Windows.FontWeight.
//
// Parameters:
// left:
// The first System.Windows.FontWeight object to compare.
//
// right:
// The second System.Windows.FontWeight object to compare.
//
// Returns:
// An System.Int32 value that indicates the relationship between the two instances
// of System.Windows.FontWeight. When the return value is less than zero, left is
// less than right. When this value is zero, it indicates that both operands are
// equal. When the value is greater than zero, it indicates that left is greater
// than right.
public static int Compare(FontWeight left, FontWeight right);
//
// Summary:
// Creates a new instance of System.Windows.FontWeight that corresponds to the OpenType
// usWeightClass value.
//
// Parameters:
// weightValue:
// An integer value between 1 and 999 that corresponds to the usWeightClass definition
// in the OpenType specification.
//
// Returns:
// A new instance of System.Windows.FontWeight.
public static FontWeight FromOpenTypeWeight(int weightValue);
//
// Summary:
// Determines whether the current System.Windows.FontWeight object is equal to a
// specified System.Windows.FontWeight object.
//
// Parameters:
// obj:
// The instance of System.Windows.FontWeight to compare for equality.
//
// Returns:
// true if the two instances are equal; otherwise, false.
public bool Equals(FontWeight obj);
//
// Summary:
// Determines whether the current System.Windows.FontWeight object is equal to a
// specified object.
//
// Parameters:
// obj:
// The System.Object to compare for equality.
//
// Returns:
// true if the two instances are equal; otherwise, false.
public override bool Equals(object obj);
//
// Summary:
// Retrieves the hash code for this object.
//
// Returns:
// A 32-bit hash code, which is a signed integer.
public override int GetHashCode();
//
// Summary:
// Returns a value that represents the OpenType usWeightClass for the System.Windows.FontWeight
// object.
//
// Returns:
// An integer value between 1 and 999 that corresponds to the usWeightClass definition
// in the OpenType specification.
public int ToOpenTypeWeight();
//
// Summary:
// Returns a text string that represents the value of the System.Windows.FontWeight
// object and is based on the System.Globalization.CultureInfo.CurrentCulture property
// information.
//
// Returns:
// A System.String that represents the value of the System.Windows.FontWeight object,
// such as "Light", "Normal", or "UltraBold".
public override string ToString();
//
// Summary:
// Compares two instances of System.Windows.FontWeight for equality.
//
// Parameters:
// left:
// The first instance of System.Windows.FontWeight to compare.
//
// right:
// The second instance of System.Windows.FontWeight to compare.
//
// Returns:
// true if the instances of System.Windows.FontWeight are equal; otherwise, false.
public static bool operator ==(FontWeight left, FontWeight right);
//
// Summary:
// Evaluates two instances of System.Windows.FontWeight to determine inequality.
//
// Parameters:
// left:
// The first instance of System.Windows.FontWeight to compare.
//
// right:
// The second instance of System.Windows.FontWeight to compare.
//
// Returns:
// false if left is equal to right; otherwise, true.
public static bool operator !=(FontWeight left, FontWeight right);
//
// Summary:
// Evaluates two instances of System.Windows.FontWeight to determine whether one
// instance is less than the other.
//
// Parameters:
// left:
// The first instance of System.Windows.FontWeight to compare.
//
// right:
// The second instance of System.Windows.FontWeight to compare.
//
// Returns:
// true if left is less than right; otherwise, false.
public static bool operator <(FontWeight left, FontWeight right);
//
// Summary:
// Evaluates two instances of System.Windows.FontWeight to determine whether one
// instance is greater than the other.
//
// Parameters:
// left:
// The first instance of System.Windows.FontWeight to compare.
//
// right:
// The second instance of System.Windows.FontWeight to compare.
//
// Returns:
// true if left is greater than right; otherwise, false.
public static bool operator >(FontWeight left, FontWeight right);
//
// Summary:
// Evaluates two instances of System.Windows.FontWeight to determine whether one
// instance is less than or equal to the other.
//
// Parameters:
// left:
// The first instance of System.Windows.FontWeight to compare.
//
// right:
// The second instance of System.Windows.FontWeight to compare.
//
// Returns:
// true if left is less than or equal to right; otherwise, false.
public static bool operator <=(FontWeight left, FontWeight right);
//
// Summary:
// Evaluates two instances of System.Windows.FontWeight to determine whether one
// instance is greater than or equal to the other.
//
// Parameters:
// left:
// The first instance of System.Windows.FontWeight to compare.
//
// right:
// The second instance of System.Windows.FontWeight to compare.
//
// Returns:
// true if left is greater than or equal to right; otherwise, false.
public static bool operator >=(FontWeight left, FontWeight right);
}
}