Click here to Skip to main content
15,891,864 members
Home / Discussions / WPF
   

WPF

 
QuestionWorking Out Which Controls are Within Points Pin
Jammer9-Jul-10 0:23
Jammer9-Jul-10 0:23 
AnswerRe: Working Out Which Controls are Within Points Pin
Pete O'Hanlon9-Jul-10 1:54
mvePete O'Hanlon9-Jul-10 1:54 
GeneralRe: Working Out Which Controls are Within Points Pin
Jammer9-Jul-10 2:39
Jammer9-Jul-10 2:39 
GeneralRe: Working Out Which Controls are Within Points Pin
Jammer9-Jul-10 3:37
Jammer9-Jul-10 3:37 
GeneralRe: Working Out Which Controls are Within Points Pin
Pete O'Hanlon9-Jul-10 3:50
mvePete O'Hanlon9-Jul-10 3:50 
QuestionWPF Navigation Frame Pin
Gretna7-Jul-10 22:55
Gretna7-Jul-10 22:55 
QuestionWPF : Print Page number on footer Pin
priyagee7-Jul-10 21:30
priyagee7-Jul-10 21:30 
QuestionSimple problem pre-select WPF Codeplex ComboBox item [modified] Pin
devvvy7-Jul-10 15:54
devvvy7-Jul-10 15:54 
Hello

I'm using CodePlex WPF ComboBox and is having trouble pre-select item

From code behind, I bind the combo box to a DataTable with two columns:
<br />
...<br />
SomeTableSrc = new DataTable("SomeData");<br />
SomeTableSrc.Columns.Add("Data", typeof(string));<br />
SomeTableSrc.Columns.Add("IsSelected", typeof(bool));<br />
lstSomeData.DataContext = SomeTableSrc.DefaultView;<br />


Xaml:
<combobox name="lstSomeData">
<combobox.itemcontainerstyle itemssource="{Binding}">

<Setter Property="IsSelected" Value="{Binding Path=IsSelected}" />




The above will select relevant "ComboBoxItem" (and it works fine, if you click on ComboBox, as menu expands you can see desired items actually get selected), *** BUT *** "SelectedValue" or "Text" of "ComboBox" (not items) remains blank - and setting these "ComboBox" attributes directly just don't work.
<br />
// Don't work, "ComboBox" text remains blank<br />
lstSomeData.SelectedValue = "ABC";<br />
<br />
// Don't work, "ComboBox" text remains blank<br />
lstSomeData.Text = "ABC"; <br />


And I've already tried (PreSelectedData = code behind attrib hardcoded to return string "ABC"):
<ComboBox.ItemContainerStyle ItemsSource={Binding} Text="{Binding PreSelectedData}" SelectedValue="{Binding PreSelectedData}">
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="IsSelected" Value="{Binding Path=IsSelected}" />
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>

Or even outright hardcode,
<ComboBox.ItemContainerStyle ItemsSource={Binding} Text="ABC" SelectedValue="ABC">
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="IsSelected" Value="{Binding Path=IsSelected}" />
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>

No luck!
dev
modified on Wednesday, July 7, 2010 10:23 PM

Questionmultiple WCF client endpoints exposed as dropdown list Pin
Michael Eber7-Jul-10 13:00
Michael Eber7-Jul-10 13:00 
QuestionDomainServicess??? Pin
Chris H Developer7-Jul-10 8:32
Chris H Developer7-Jul-10 8:32 
QuestionGraphical Lasso to Select Controls Pin
Jammer7-Jul-10 6:03
Jammer7-Jul-10 6:03 
AnswerRe: Graphical Lasso to Select Controls Pin
Insincere Dave9-Jul-10 4:13
Insincere Dave9-Jul-10 4:13 
GeneralRe: Graphical Lasso to Select Controls Pin
Jammer9-Jul-10 6:12
Jammer9-Jul-10 6:12 
QuestionDrawing rubber-band lines and shapes on mouse events in WPF Pin
hamidkhan6-Jul-10 4:59
hamidkhan6-Jul-10 4:59 
AnswerRe: Drawing rubber-band lines and shapes on mouse events in WPF Pin
Abhinav S7-Jul-10 2:10
Abhinav S7-Jul-10 2:10 
QuestionWPF : Print Select Dialog in XamReportPreview Pin
priyagee6-Jul-10 3:14
priyagee6-Jul-10 3:14 
Questionhow to embeded a youtube video in a silverlight page(.xaml page) using silverlightblend 3.0. Pin
Ch.Gayatri Subudhi5-Jul-10 22:00
Ch.Gayatri Subudhi5-Jul-10 22:00 
AnswerRe: how to embeded a youtube video in a silverlight page(.xaml page) using silverlightblend 3.0. Pin
Arun Jacob5-Jul-10 22:52
Arun Jacob5-Jul-10 22:52 
GeneralRe: how to embeded a youtube video in a silverlight page(.xaml page) using silverlightblend 3.0. Pin
Ch.Gayatri Subudhi6-Jul-10 18:22
Ch.Gayatri Subudhi6-Jul-10 18:22 
AnswerRe: how to embeded a youtube video in a silverlight page(.xaml page) using silverlightblend 3.0. Pin
Abhinav S6-Jul-10 18:30
Abhinav S6-Jul-10 18:30 
GeneralRe: how to embeded a youtube video in a silverlight page(.xaml page) using silverlightblend 3.0. Pin
Ch.Gayatri Subudhi6-Jul-10 20:39
Ch.Gayatri Subudhi6-Jul-10 20:39 
GeneralRe: how to embeded a youtube video in a silverlight page(.xaml page) using silverlightblend 3.0. Pin
Abhinav S6-Jul-10 21:35
Abhinav S6-Jul-10 21:35 
GeneralRe: how to embeded a youtube video in a silverlight page(.xaml page) using silverlightblend 3.0. Pin
Ch.Gayatri Subudhi7-Jul-10 2:51
Ch.Gayatri Subudhi7-Jul-10 2:51 
GeneralRe: how to embeded a youtube video in a silverlight page(.xaml page) using silverlightblend 3.0. Pin
Ch.Gayatri Subudhi7-Jul-10 18:42
Ch.Gayatri Subudhi7-Jul-10 18:42 
AnswerRe: how to embeded a youtube video in a silverlight page(.xaml page) using silverlightblend 3.0. Pin
Abhinav S7-Jul-10 19:39
Abhinav S7-Jul-10 19:39 

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.