Click here to Skip to main content
15,888,984 members
Home / Discussions / WPF
   

WPF

 
QuestionThird Party Controls Pin
Kevin Marois11-Dec-12 7:22
professionalKevin Marois11-Dec-12 7:22 
AnswerRe: Third Party Controls Pin
Mycroft Holmes11-Dec-12 12:06
professionalMycroft Holmes11-Dec-12 12:06 
AnswerRe: Third Party Controls Pin
Pete O'Hanlon11-Dec-12 12:43
mvePete O'Hanlon11-Dec-12 12:43 
GeneralRe: Third Party Controls Pin
Kevin Marois12-Dec-12 8:28
professionalKevin Marois12-Dec-12 8:28 
GeneralRe: Third Party Controls Pin
Pete O'Hanlon12-Dec-12 8:29
mvePete O'Hanlon12-Dec-12 8:29 
GeneralRe: Third Party Controls Pin
Kevin Marois12-Dec-12 8:30
professionalKevin Marois12-Dec-12 8:30 
GeneralRe: Third Party Controls Pin
Mycroft Holmes12-Dec-12 12:02
professionalMycroft Holmes12-Dec-12 12:02 
QuestionHow can I Bind a DataTemplate Slider definition to the Code behind? Pin
maycockt10-Dec-12 5:24
maycockt10-Dec-12 5:24 
I have a DataTemplate which, when referenced, displays a Slider Bar. The setup of the slider is dependant on data passed to the Form from the calling class. The XAML for the config looks like this.

<pre lang="xml">
<Window.Resources>
<DataTemplate DataType="{x:Type ContentControl}" x:Key="TextBoxTemplate">
<TextBox Text="{Binding ElementName=MyWindow, Path=m_csValue}" Height="23"/>
</DataTemplate>
<DataTemplate DataType="{x:Type ContentControl}" x:Key="SliderTemplate">
<Slider Name="sli" Value="{Binding ElementName = MyWindow, Path=sli}" ValueChanged="OnSliderValueChanged" IsSnapToTickEnabled="True" Margin="5" />
</DataTemplate>
<Style TargetType="{x:Type ContentControl}" x:Key="DisplayValues">
<Setter Property="ContentTemplate" Value="{StaticResource TextBoxTemplate}" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=MyWindow, Path=eType}" Value="{x:Static local:eTagDisplay.Text}">
<Setter Property="ContentTemplate" Value="{StaticResource TextBoxTemplate}" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=MyWindow, Path=eType}" Value="{x:Static local:eTagDisplay.Slider}">
<Setter Property="ContentTemplate" Value="{StaticResource SliderTemplate}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>

<Grid Width="267">
<StackPanel Margin="0,37,0,133" Height="123">
<TextBlock Height="23" Name="textBlock1" Text="TextBlock" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>

<ContentControl Style="{StaticResource DisplayValues}" Margin="12,12,12,158" />
</Grid>
</pre>

In my Code Behind I set up the Max, Min, Tick Frequency and Value when the Form is created.
When the Slider bar is updated i find that the slider in the code behind is not bound to the slider on display, and so I'm not updating the value of the object I wish to update.
How can I ensure that the slider created in the XAML is bound to the slider in the code behind?

Regards

Tony
AnswerRe: How can I Bind a DataTemplate Slider definition to the Code behind? Pin
Alisaunder10-Dec-12 13:52
Alisaunder10-Dec-12 13:52 
GeneralRe: How can I Bind a DataTemplate Slider definition to the Code behind? Pin
maycockt14-Dec-12 1:18
maycockt14-Dec-12 1:18 
QuestionHow does one define IOleServiceProvider in a C# WPF application? Pin
Xarzu10-Dec-12 3:54
Xarzu10-Dec-12 3:54 
AnswerRe: How does one define IOleServiceProvider in a C# WPF application? Pin
Pete O'Hanlon10-Dec-12 4:08
mvePete O'Hanlon10-Dec-12 4:08 
QuestionSetting icons based on Region/city name?! Pin
radkrish9-Dec-12 19:43
radkrish9-Dec-12 19:43 
AnswerRe: Setting icons based on Region/city name?! Pin
Abhinav S9-Dec-12 20:12
Abhinav S9-Dec-12 20:12 
QuestionWPF ComboBox Selected Item Problem Pin
Kevin Marois8-Dec-12 10:48
professionalKevin Marois8-Dec-12 10:48 
AnswerRe: WPF ComboBox Selected Item Problem Pin
Ninja__Turtle8-Dec-12 17:43
Ninja__Turtle8-Dec-12 17:43 
AnswerRe: WPF ComboBox Selected Item Problem Pin
Wayne Gaylard8-Dec-12 18:24
professionalWayne Gaylard8-Dec-12 18:24 
GeneralRe: WPF ComboBox Selected Item Problem Pin
Kevin Marois8-Dec-12 19:37
professionalKevin Marois8-Dec-12 19:37 
GeneralRe: WPF ComboBox Selected Item Problem Pin
Kevin Marois8-Dec-12 19:37
professionalKevin Marois8-Dec-12 19:37 
GeneralRe: WPF ComboBox Selected Item Problem Pin
Wayne Gaylard8-Dec-12 19:39
professionalWayne Gaylard8-Dec-12 19:39 
QuestionAt commands Pin
Pranay Dabholkar7-Dec-12 5:56
Pranay Dabholkar7-Dec-12 5:56 
AnswerRe: At commands Pin
Abhinav S9-Dec-12 20:14
Abhinav S9-Dec-12 20:14 
QuestionCurrency Converter Pin
pjank427-Dec-12 5:44
pjank427-Dec-12 5:44 
AnswerRe: Currency Converter Pin
Pete O'Hanlon7-Dec-12 6:58
mvePete O'Hanlon7-Dec-12 6:58 
GeneralRe: Currency Converter Pin
pjank427-Dec-12 7:38
pjank427-Dec-12 7:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.