473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DataTemplate

I have the following Custom Control that uses a DataTemplate and is Bound to
a LightBox object. The template does bind correctly to properties directly on
the LightBox object. However my LightBox has a list of Lights and I want to
bind the List of lights in the DataTemplate somehow?

My attempt to solve the problem was to create a custom control that defined
a depencency property and set the dependency property in the DataTemplate. It
is located in the following xaml as "<custom:LightArrayControl" and the
dependency property is named LightBoxSource. The problem with this is that
the property does not get set. It executes the constructor of the control as
well as executing the RegisterDepencencyProperty method but never sets the
property itself. If I put a break point on the Property in the LightBox
object that I am trying to attach the DependencyProperty to it does break
there but the DependencyProperty does not break. This is confusing because
the only place that the property in the LightBox object would get called is
where I try to set my dependencyProperty equal to it in the XAML.

Any help would be appreciated.
<UserControl x:Class="StevenDale.MDAlertManager.Client.LightBox RowControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:src="clr-namespace:StevenDale.MDAlertSystem.LightSystem;ass embly=StevenDale.MDAlertSystem"

xmlns:custom="clr-namespace:StevenDale.MDAlertManager.Client.UserCon trols.LightBoxControls"
Height="30" Width="536">
<UserControl.Resources>

</UserControl.Resources>
<UserControl.ContentTemplate>
<DataTemplate DataType="{x:Type src:LightBox}">
<StackPanel Orientation="Horizontal" Name="_lightBoxRow" >
<Image Name="_connectedImage" Margin="6,0,20,0"
Source="Images/bullet_ball_glass_red.png" Stretch="None" />
<TextBlock FontWeight="Bold" Margin="0,0,30,0"
VerticalAlignment="Center" HorizontalAlignment="Center"
Name="_lightIPAddress" Text="{Binding Path=IPAddress}" />

<custom:LightArrayControl Name="_lightArrayControl"
LightBoxSource="{Binding Path=Self}"
Initialized="LightArrayControl_Initialized" />
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=IsConnected}"
Value="True">
<Setter TargetName="_connectedImage" Property="Source"
Value="Images/bullet_ball_glass_red.png" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</UserControl.ContentTemplate>
</UserControl>
Jun 27 '08 #1
0 915

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: =?Utf-8?B?V29ua28gdGhlIFNhbmU=?= | last post by:
Hello, I am using a custom control (based on Button), which has in its generic implementation: <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:BasedOnButton">...
0
by: =?Utf-8?B?V29ua28gdGhlIFNhbmU=?= | last post by:
Hi All, Perhaps its because its been a long week, but I just can't seem to figure out how to bind data in a DataTemplate using DataContext. The following is in the XAML code: <Button...
0
by: Czechtim | last post by:
Hello, I have problem with databinding. I created small application using structure that I need to demonstrate problem. I need to change content of label when changing content of property...
7
by: cmrhema | last post by:
Hi, I have two questions. 1. I have heard that replacing a <tr> <td> with <div> tags increases the rendering speed. Is it so, and if yes which speed does it increase, rendering speed or loading...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.