Thursday, August 28, 2014

Asynchronous Tasks Simplified

Superb article and nice explanation
http://visualstudiomagazine.com/articles/2014/08/01/manage-asynchronous-tasks.aspx

Wednesday, August 27, 2014

Rendering custom shape in WPF

http://wpf.2000things.com/2014/08/27/1145-using-rendersize-in-custom-shape/

Tuesday, August 26, 2014

WPF Creating SolidColorBrush From Hex Color Value

private static readonly SolidColorBrush connectedBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFD5D5D5"));

Thursday, August 14, 2014

WPF - Passing string to ConverterParameter

<sys:String x:Key="mystring">The time of the day is </sys:String>

<TextBlock Text="{Binding Source={x:Static sys:DateTime.Now}, Converter={StaticResource custConverter},ConverterParameter={StaticResource mystring}}" />

Wednesday, August 13, 2014

How to 'merge' a XAML file and its code-behind with Visual Studio

You need to edit the .csproj file. Find the <Compile> element for MyTemplate.cs, and add a <DependentUpon> element under it:
<Compile Include="MyTemplate.cs">
  <DependentUpon>MyTemplate.xaml</DependentUpon>
</Compile>

Tuesday, August 12, 2014

Combine DataTrigger and Trigger in a WPF MultiDataTrigger

<MultiDataTrigger>
 <MultiDataTrigger.Conditions>
         <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="True"/>
  <Condition Binding="{Binding Path=Model.IsRunning, Mode=OneWay}" Value="false"></Condition>
 </MultiDataTrigger.Conditions>
        <Setter TargetName="OuterBorder" Property="Background" Value="{StaticResource DarkBrushMouseOver}" />
</MultiDataTrigger>