or
private
string
weatherloc;
[Category(
"MissionBoard"
)]
[Description(
"Weather station location"
)]
public
string
WeatherLoc
{
get
{
return
weatherloc; }
private
set
{ weatherloc = value; }
}
<
Grid.Resources
>
<
c:FieldTemplateSelector
x:Key
=
"DataTemplateSelector"
>
<
c:FieldTemplateSelector.WeatherDataTemplate
>
<
DataTemplate
>
<
telerik:RadComboBox
x:Name
=
"WeatherComboBox"
Loaded
=
"WeatherComboBox_Loaded"
/>
</
DataTemplate
>
</
c:FieldTemplateSelector.WeatherDataTemplate
>
</
c:FieldTemplateSelector
>
</
Grid.Resources
>
private
void
WeatherComboBox_Loaded(
object
sender, RoutedEventArgs e)
{
using
(EntitiesModel dbContext =
new
EntitiesModel())
{
try
{
var q = (from i
in
dbContext.WeatherFeeds
orderby i.Location
select
new
{ i.Location }).ToList();
// How to bind all the bits? The public property to the SelectedItem
// and the choices to the data source.
}
catch
(SqlException sx)
{
Console.WriteLine(sx.ToString());
}
catch
(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
<
common:RecentDocuments
x:Key
=
"RecentDocuments"
/>
<
common:RecentPlaces
x:Key
=
"RecentPlaces"
/>
<
common:AvailableTemplates
x:Key
=
"AvailableTemplates"
/>
<
common:HelpItems
x:Key
=
"HelpItemsTemplate"
/>
<
StackPanel
Margin
=
"15 15 0 0"
>
<
TextBlock
Text
=
"Recent Documents"
FontSize
=
"14"
FontWeight
=
"Bold"
Margin
=
"0 0 0 2"
/>
<
Rectangle
Height
=
"1"
Fill
=
"{StaticResource DottedLineBrush}"
/>
<
ItemsControl
ItemsSource
=
"{StaticResource RecentDocuments}"
Margin
=
"0 4 0 0"
ItemTemplate
=
"{StaticResource RecentDocumentTemplate}"
/>
</
StackPanel
>
foreach (var c in radGridViewTest.Columns)
{
var factory = new FrameworkElementFactory(typeof(Button), "myButton");
factory.SetValue(CursorProperty, Cursors.Hand); // OK
factory.SetBinding(ContentProperty, new Binding(string.Format("[{0}]", 4))); //OK
c.CellTemplate= new DataTemplate();
var mh = new RoutedEventHandler(onClick);
factory.AddHandler(Button.ClickEvent, mh,true); // won't work ...
c.CellTemplate.VisualTree = factory;
c.CellTemplate.Seal();
}