Clipboard.SetData(DataFormats.Text, text);
txtQuery.Paste();
Clipboard.SetData(DataFormats.Text, text);
txtQuery.Paste();
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
<toolkit:Viewbox Stretch="Uniform">
</toolkit:Viewbox>
Sometimes you need to throw your own custom event with custom arguments. The arguments can be passed directly or by implementing a custom class that inherits from EventArgs. The latter is needed when adding handlers on the event in for instance XAML. The event can be e.g.:
public delegate void ValidationEventHandler(object sender, ValidationEventArgs e); public event ValidationEventHandler Validation; protected virtual void OnValidation(string propertyName, bool isValid, string message) { if (Validation != null) Validation(this, new ValidationEventArgs(propertyName, isValid, message)); }
Which can then be raised by:
OnValidation("Code", false, "Value must not be empty.");
Or you skip the helper method. Make sure the event is not null, meaning there are no listeners:
Validation?.Invoke(this, new ValidationEventArgs(nameof(Code), false, "Value must not be empty."));
You can also use the generic delegate. It can be invoked the same way.
public event EventHandler<ValidationEventArgs> Validation;
private void NotifyPropertyChanged([CallerMemberName]string propertyName = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
NotifyPropertyChanged();
function startsWith($Text, $Value){ return strpos($Text, $Value) === 0; } function endsWith($Text, $Value){ return strrpos($Text, $Value) === strlen($Text) - strlen($Value); }
<Style x:Key="Button" TargetType="Button">
<Style.Resources>
<LinearGradientBrush x:Key="lgbNormal" StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="{x:Static SystemColors.ControlLightLightColor}" />
<GradientStop Offset="0.5" Color="{x:Static SystemColors.ControlLightColor}" />
<GradientStop Offset="0.5" Color="{x:Static SystemColors.ControlDarkDarkColor}" />
<GradientStop Offset="1" Color="{x:Static SystemColors.ControlDarkDarkColor}" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="lgbMouseOver" StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="{x:Static SystemColors.ControlLightLightColor}" />
<GradientStop Offset="0.5" Color="#083B80" />
<GradientStop Offset="0.5" Color="{x:Static SystemColors.ControlDarkDarkColor}" />
<GradientStop Offset="1" Color="{x:Static SystemColors.ControlDarkDarkColor}" />
</LinearGradientBrush>
</Style.Resources>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border" BorderThickness="1" BorderBrush="#3E3E3E" CornerRadius="2">
<Grid>
<Rectangle x:Name="rect" RadiusX="2" RadiusY="2" Fill="{StaticResource lgbNormal}" />
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="rect" Property="Fill" Value="{StaticResource lgbMouseOver}" />
<Setter TargetName="border" Property="BorderBrush" Value="#083B80" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
svg2xaml D:\Projects\ArrowUp.svg
<ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> </Style> </ListBox.ItemContainerStyle>
<Setter Property="IsEnabled" Value="False" />
result = from o in orders join c in coupons on o.Id equals c.Order.Id into c2 from c3 in c2.DefaultIfEmpty() select new ContactCoupon() { Contact = o.Contact, Coupon = c3 };