Blogging, Personal, Programming
In Personal on 29 July, 2008 at 7:00 pm
The 2 main issues that will bog you down is that:
- how do you get the source code to indent properly
- and how do you get the style to show up properly, specifically the line spacing, the color for keyword and so on
I know that it can be solved by defining some CSS code but do you have to do that for every site that you change to?
.NET 3.0, C#, Programming, WPF, XAML
In Programming on 25 July, 2008 at 7:00 am
To expand on what I’ve mentioned in my previous post. The list box declared in XAML will look something like this:
<ListBox
x:Name="CheckList"
ItemTemplate="{DynamicResource CheckListTemplate}"
ItemsSource="{Binding Source={StaticResource CheckedSource},
Mode=Default}">
</ListBox>
Under the <Windows.Resources>, the data template will be declared as:
<DataTemplate x:Key="CheckListTemplate">
<StackPanel Margin="0,3,0,2" Orientation="Horizontal">
<CheckBox IsChecked="{Binding Path=IsShown}"/>
<TextBlock Text="{Binding Path=Name}"/>
</StackPanel>
</DataTemplate>
At the same place or inside a style XAML’s ResourceDictionary, the data source is declared as:
<source:SColorList x:Key="CheckedSource"/>
Inside the C# file the classes are declared as:
public class SColor : INotifyPropertyChanged
{
private string displayName;
private Color clrShow;
private bool permanent;
private bool show;
public bool IsShown
{
set
{
show = value;
OnPropertyChanged("IsShown");
}
get
{
return show;
}
}
public string Name
{
set
{
displayName = value;
OnPropertyChanged("Name");
}
get
{
return displayName;
}
}
public event PropertyChangedEventHandler
PropertyChanged;
private void OnPropertyChanged(String info)
{
if (PropertyChanged != null)
PropertyChanged(this, new
PropertyChangedEventArgs(info));
}
}
public class SColorList :
ObservableCollection<SColor>
{
}
Under an initialization method, you should then do the following:
SColorList colorList =
(SColorList)FindResource("CheckedSource");
After that is done, the binding is complete and you can then add data item into the colorList and it will show up in the list box control. And the best thing is your designer can do “magic” on the DataTemplate.
Software, Start, WordPress
In Personal on 24 July, 2008 at 7:00 am
After using iblog for about 1 and a half year, I’ve finally decided to join in the flow and choose the popular WordPress type of blogging service. One problem with iblog is that it is not up to date with the trend in blogging and thus not even tag is supported, however, it allows user to customize the theme (note CSS, not just changing the template) without any other added cost. But the cons finally outweigh the pros and I’ve finally made the change.
Welcome!