Hi all,
Another (hopefully) easy question. And yes, I have searched for the answer first.
I have a dataTemplate:
<DataTemplate x:Key="codeTypeTemplate"><StackPanel Orientation="Horizontal"><Border BorderThickness="0,0,1,0" BorderBrush="Black"><TextBlock Text="{Binding Path=code}" Name="txtCode" mvvm:View.WidthEx="6"></TextBlock></Border><TextBlock Text="{Binding Path=description}" mvvm:View.WidthEx="15" Margin="1"></TextBlock></StackPanel></DataTemplate>
This works fine. I reference it in a style I use for comboBoxes:
<Style BasedOn="{StaticResource {x:Type ComboBox}}" TargetType="ComboBox" x:Key="cboCodeTypeStyle"><Setter Property="IsSynchronizedWithCurrentItem" Value="True" /><Setter Property="SelectedValuePath" Value="code" /><Setter Property="IsEditable" Value="true" /><Setter Property="IsReadOnly" Value="false" /><Setter Property="mvvm:View.FlowsWithPrevious" Value="True" /><Setter Property="TextSearch.TextPath" Value="code" /><Setter Property="ItemTemplate" Value="{StaticResource codeTypeTemplate}" /></Style>
So my ComboBox looks like this:
<ComboBox Name="cboCit_type" Style="{StaticResource cboCodeTypeStyle}" ItemsSource="{Binding Path=cuCodeInfo.CitTypes}" SelectedValue="{Binding cit_type}" Text="{Binding cit_type}" />
And it all works great (thanks to some of the helpful folk around here!)
But now I have a situation where I want to change the size of one of the textboxes referenced in the DataTemplate. I was hoping that, since I gave it a name, I put the following in the xaml for the comboBox:
txtCodeElement.Width ="10"
But, as you probably know, this won't work. What could I add to the ComboBox xaml so I can override the default width? Or what should I change in the DataTemplate so I can make such a change? I would prefer to NOT have to do this with code.
Thank you,
Fletcher
me (and yes, I DO mark correct answers)