Posted in Silverlight, tagged dynamic styles on July 21, 2008 | No Comments »
In this post, I will show my attempt to change the Theme of SL application without reloading the app.
you can see a demo here . There are 3 main steps
1. Isolate all the styles into individual files .xaml or xml
2. load all the resources and save them
3. clear the Application Resources before the content is initialized
I [...]
Read Full Post »
If we want to align the content of the header vertically(Bottom) in datagrid, found that we need to change the style. I thought there would be an easier way, but could not find one.
xmlns:my1=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data”
Here is the style, changes made to the default style in Bold
<Style TargetType=”my1:DataGridColumnHeader”>
<Setter Property=”SeparatorBrush”>
<Setter.Value>
<SolidColorBrush Color=”#FFA4A4A4″ />
</Setter.Value>
</Setter>
<Setter Property=”SeparatorVisibility”
Value=”Visible” />
<Setter Property=”Template”>
[...]
Read Full Post »
ItemContainerStyle is the style that is applied to the dataitems. In the figure below we see the default style that comes with the listbox on the left and style that is customized on the right.
Here are the steps
1. Get the default style for the ListBoxItem from generic.xaml using reflector or from the sdk
2. Remove all [...]
Read Full Post »
Posted in Silverlight on July 10, 2008 | 3 Comments »
There are different ways to communicate between usercontrols. Here is a sample of that using events. Basically an event is raised when something happens in one Usercontrol an event is raised and Page which contains the UserControl subscribes to the event and passes the relevant details it to a different UserControl
you can download the sample here
Read Full Post »
Posted in Silverlight on June 30, 2008 | 5 Comments »
I was changing the ItemsPanelTemplate of Listbox and set the Position of Elements generated using TranslateTransform
WPF app works fine, while the Silverlight app crashes. As far as I can tell the code is same
Here is the XAML
<UserControl x:Class=”t14.Page”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation“
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml“
Width=”400″ Height=”300″>
<UserControl.Resources>
<DataTemplate x:Key=”dt”>
<TextBlock Text=”{Binding Name}”>
<TextBlock.RenderTransform>
<TranslateTransform X=”{Binding Position.X}”
Y=”{Binding Position.Y}” />
[...]
Read Full Post »