Click here to Skip to main content
15,912,457 members
Home / Discussions / WPF
   

WPF

 
QuestionAdding images to silverlight datagrid Pin
sudheesh kumar s14-Jan-12 0:51
sudheesh kumar s14-Jan-12 0:51 
AnswerRe: Adding images to silverlight datagrid Pin
AbhijeetB14-Jan-12 22:05
AbhijeetB14-Jan-12 22:05 
QuestionSlilverlight with WCF Pin
sudheesh kumar s14-Jan-12 0:36
sudheesh kumar s14-Jan-12 0:36 
AnswerRe: Slilverlight with WCF Pin
Pete O'Hanlon14-Jan-12 0:51
mvePete O'Hanlon14-Jan-12 0:51 
GeneralRe: Slilverlight with WCF Pin
sudheesh kumar s14-Jan-12 1:06
sudheesh kumar s14-Jan-12 1:06 
GeneralRe: Slilverlight with WCF Pin
Pete O'Hanlon14-Jan-12 2:18
mvePete O'Hanlon14-Jan-12 2:18 
QuestionSilverlight 5 DataGrid MouseLeftButtonDown Fails Pin
Mycroft Holmes13-Jan-12 21:06
professionalMycroft Holmes13-Jan-12 21:06 
QuestionUserControl as a TabItem Pin
Tom Delany12-Jan-12 5:15
Tom Delany12-Jan-12 5:15 
Can someone please point me in the right direction? I'm already mostly bald, and I am pulling out what little hair that I have left!

Originally I had some XAML that looked something like this in my main window (I've left parts out for brevity):
XML
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="40" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <TextBlock Text="TapeStream Management Console"
           FontSize="20" TextAlignment="Center" VerticalAlignment="Center"/>
    <TabControl Grid.Row="1">
    <TabItem Header="Catalog">
        <views:CatalogTab>
    </TabItem>
    <TabItem Header="Datasets">
    ... etc.
    </TabItem>
    ... etc.
</Grid>

Under each tab item I had a UserControl that displayed the actual information. The DataContext for each UserControl was set in the code behind. Things rendered pretty much the way I expected. (Yeah, I know this UI is not going to win any awards, but it is a start.)

I had some issues with this implementation (trying to get a chance to prompt for the user to save changes when they switch to a different tab), and Collin Jasnoch[^] was kind enough to suggest an alternative approach. [^]

I got it to somewhat work after what he was telling me finally penetrated my thick skull (with a little extra pounding from Pete O'Hanlon[^]). Smile | :)

The problem that I have now is that it is rendering all screwy. The MainWindow XAML looks more like this now:
XML
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="40" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <TextBlock Text="TapeStream Management Console"
           FontSize="20" TextAlignment="Center" VerticalAlignment="Center"/>
    <TabControl Grid.Row="1" ItemsSource="{Binding ViewModels}" SelectedItem="{Binding SelectedItem}"/>
</Grid>
...

I now have a MainWindowViewModel class that is set as the DataContext for the MainWindow. It contains an ObservableCollection of my various ViewModels as per Collin's suggestion. I have a ResourceDictionary set up with the DataTemplates for my ViewModels / UserControls as suggested by Collin and Pete:
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:views="clr-namespace:TapeStreamManagementConsole.View"
                    xmlns:vms="clr-namespace:TapeStreamManagementConsole.ViewModel">
    <DataTemplate DataType="{x:Type vms:CatalogViewModel}">
        <views:CatalogTab />
    </DataTemplate>
    <DataTemplate DataType="{x:Type vms:DataSetsViewModel}">
        <views:DataSetsView />
    </DataTemplate>
    <DataTemplate DataType="{x:Type vms:TapeImageFilesViewModel}">
        <views:TapeImageFilesView />
    </DataTemplate>
</ResourceDictionary>

1) I cannot figure out any way to get tab headers and make the TabControl look "normal".
2) My UserControls have a ListBox on the left-hand side that no longer has scroll bars. Confused | :confused:

I tried changing my DataTemplates to look like this:
XML
<DataTemplate DataType="{x:Type vms:CatalogViewModel}">
    <TabItem Header="Catalog" >
        <views:CatalogTab />
    </TabItem>
</DataTemplate>

When I do that, I end up with Tabs with headings, but no content! Help!
WE ARE DYSLEXIC OF BORG. Refutance is systile. Your a$$ will be laminated.

There are 10 kinds of people in the world: People who know binary and people who don't.

GeneralRe: UserControl as a TabItem Pin
Tom Delany12-Jan-12 9:14
Tom Delany12-Jan-12 9:14 
QuestionIs IEnumerable<> a sufficent type for WPF binding? Pin
Harry von Borstel12-Jan-12 3:16
Harry von Borstel12-Jan-12 3:16 
AnswerRe: Is IEnumerable a sufficent type for WPF binding? Pin
Pete O'Hanlon12-Jan-12 3:24
mvePete O'Hanlon12-Jan-12 3:24 
GeneralRe: Is IEnumerable a sufficent type for WPF binding? Pin
Harry von Borstel12-Jan-12 3:59
Harry von Borstel12-Jan-12 3:59 
GeneralRe: Is IEnumerable a sufficent type for WPF binding? Pin
Pete O'Hanlon12-Jan-12 4:32
mvePete O'Hanlon12-Jan-12 4:32 
AnswerRe: Is IEnumerable a sufficent type for WPF binding? Pin
Abhinav S12-Jan-12 4:02
Abhinav S12-Jan-12 4:02 
GeneralRe: Is IEnumerable a sufficent type for WPF binding? Pin
Pete O'Hanlon12-Jan-12 4:18
mvePete O'Hanlon12-Jan-12 4:18 
GeneralRe: Is IEnumerable a sufficent type for WPF binding? Pin
Abhinav S12-Jan-12 17:55
Abhinav S12-Jan-12 17:55 
GeneralRe: Is IEnumerable a sufficent type for WPF binding? Pin
Harry von Borstel12-Jan-12 6:18
Harry von Borstel12-Jan-12 6:18 
GeneralRe: Is IEnumerable a sufficent type for WPF binding? Pin
Harry von Borstel12-Jan-12 9:28
Harry von Borstel12-Jan-12 9:28 
GeneralRe: Is IEnumerable a sufficent type for WPF binding? Pin
Abhinav S12-Jan-12 18:00
Abhinav S12-Jan-12 18:00 
GeneralRe: Is IEnumerable a sufficent type for WPF binding? Pin
Dean Oliver23-Jan-12 19:08
Dean Oliver23-Jan-12 19:08 
QuestionTooltip on DataGridTemplateColumn header [solved] Pin
Ravi Bhavnani11-Jan-12 6:01
professionalRavi Bhavnani11-Jan-12 6:01 
AnswerRe: Tooltip on DataGridTemplateColumn header Pin
Ravi Bhavnani11-Jan-12 6:10
professionalRavi Bhavnani11-Jan-12 6:10 
QuestionRIA Service not generating custom property Pin
Icarus12310-Jan-12 18:24
Icarus12310-Jan-12 18:24 
QuestionWPF Model From Hyperlink Pin
Kevin Marois10-Jan-12 10:50
professionalKevin Marois10-Jan-12 10:50 
GeneralRe: WPF Model From Hyperlink Pin
SledgeHammer0110-Jan-12 17:53
SledgeHammer0110-Jan-12 17:53 

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.