tips&tricks

What can I do if the System Process is locking files and folders?

The problem shows up when a file can not be deleted or overwritten. The system process (PID = 4) captures it for about a minute, then it is possible to delete or rename a file. The problem occurs on my Windows 7 64-bit machine, I can’t say whether this occurs under Vista or other operating systems.

If you are ever even been in this situation has caused you gray hair, then you can use the following tip.

First you can try the freeware tool Unlocker to unlock the file.

If this does not work, then try this (Possible more Information here):

Just turn on the “APPLICATION EXPERIENCE SERVICE” (“Anwendungserfahrung”) in your service settings.

This solved my problem, but my gray hairs stay there.

syntaxhighlighter for wordpress

after a long search i found my prefered syntax highlighter plugin for wordpress.

here is a little list of the most used highlighters that can be found at the internet.

i choose the SyntaxHighlighter Evolved because the plugin does allow XAML code to be added to a post under the language XML and does not let wordpress interpret the <> characters in the added sourcecode.

here is a little example

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options">
  <Grid>
    <TextBlock Text="it works" />
  </Grid>
</Page>

here are the ugly code change that i mean

<page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options">
  <grid>
    <textblock Text="it works" />
  </grid>
</page>

that’s it

automatically generate wpf listview columns

this code generates automatically listview columns for all properties for the given datatype

public class BaseListView : ListView
{
  public BaseListView() {
    ItemsSourceProperty.AddOwner(typeof(BaseListView), new FrameworkPropertyMetadata(null, OnItemsSourcePropertyChanged));
  }

  private static void OnItemsSourcePropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) {
    if (e.OldValue != e.NewValue && e.NewValue != null) {
      var lv = (BaseListView)dependencyObject;
      var gridView = new GridView();
      lv.View = gridView;
      gridView.AllowsColumnReorder = true;
      var properties = lv.DataType.GetProperties();
      foreach (var pi in properties) {
        var binding = new Binding {Path = new PropertyPath(pi.Name), Mode = BindingMode.OneWay};
        var gridViewColumn = new GridViewColumn() {Header = pi.Name, DisplayMemberBinding = binding};
        gridView.Columns.Add(gridViewColumn);
      }
    }
  }

  public Type DataType { get; set; }
}

here is the xaml usage

<Grid>
  <local:BaseListView x:Name="listView" DataType="{x:Type DummyType}" ItemsSource="{Binding Mode=OneWay, Path=DummyTypeList}" />
</Grid>

thats it

here is my answer at stackoverflow

Categories