Click here to Skip to main content
15,890,123 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Ian Shlasko28-Apr-11 1:41
Ian Shlasko28-Apr-11 1:41 
QuestionPulling controls from resources Pin
Jean-Louis Leroy19-Apr-11 2:51
Jean-Louis Leroy19-Apr-11 2:51 
AnswerRe: Pulling controls from resources Pin
Ian Shlasko19-Apr-11 5:56
Ian Shlasko19-Apr-11 5:56 
GeneralRe: Pulling controls from resources Pin
Jean-Louis Leroy19-Apr-11 23:00
Jean-Louis Leroy19-Apr-11 23:00 
GeneralRe: Pulling controls from resources Pin
Ian Shlasko20-Apr-11 2:40
Ian Shlasko20-Apr-11 2:40 
GeneralRe: Pulling controls from resources Pin
Jean-Louis Leroy20-Apr-11 3:00
Jean-Louis Leroy20-Apr-11 3:00 
QuestionHow To Create This Menu In WPF Pin
Kevin Marois18-Apr-11 10:49
professionalKevin Marois18-Apr-11 10:49 
AnswerRe: How To Create This Menu In WPF Pin
Pete O'Hanlon18-Apr-11 11:20
mvePete O'Hanlon18-Apr-11 11:20 
What you need to do is override the HeaderTemplate for the top most items. Here's a hard coded version, that you should easily be able to extend to fit your own needs:
XML
<Window
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="MenuSample.MainWindow"
  x:Name="Window"
  Title="Menu Window"
  Width="640" Height="480">
  <Window.Resources>
    <DataTemplate x:Key="MenuHeader">
      <StackPanel>
        <Image Width="24" Height="24" Source="Images/favorites_24.png" Stretch="Fill"/>
        <TextBlock Text="Outsource" />
      </StackPanel>
    </DataTemplate>
  </Window.Resources>

  <Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
      <RowDefinition Height="0.106*"/>
      <RowDefinition Height="0.894*"/>
    </Grid.RowDefinitions>
    <Menu HorizontalAlignment="Left">
      <MenuItem HeaderTemplate="{DynamicResource MenuHeader}">
        <MenuItem Header="Child 1" />
      </MenuItem>
    </Menu>
  </Grid>
</Window>

Forgive your enemies - it messes with their heads


My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility


GeneralRe: How To Create This Menu In WPF Pin
Kevin Marois18-Apr-11 11:26
professionalKevin Marois18-Apr-11 11:26 
GeneralRe: How To Create This Menu In WPF Pin
Pete O'Hanlon18-Apr-11 11:31
mvePete O'Hanlon18-Apr-11 11:31 
GeneralRe: How To Create This Menu In WPF Pin
Kevin Marois19-Apr-11 5:22
professionalKevin Marois19-Apr-11 5:22 
GeneralRe: How To Create This Menu In WPF Pin
Pete O'Hanlon19-Apr-11 6:37
mvePete O'Hanlon19-Apr-11 6:37 
QuestionAnybody got TaskbarItemProgressState.Indeterminate to work? Pin
SledgeHammer0118-Apr-11 6:55
SledgeHammer0118-Apr-11 6:55 
AnswerRe: Anybody got TaskbarItemProgressState.Indeterminate to work? Pin
KevinAG6-Mar-19 6:14
KevinAG6-Mar-19 6:14 
QuestionProblem with this binding... Pin
SledgeHammer0118-Apr-11 6:49
SledgeHammer0118-Apr-11 6:49 
AnswerRe: Problem with this binding... Pin
Adrian Cole18-Apr-11 11:03
Adrian Cole18-Apr-11 11:03 
GeneralRe: Problem with this binding... Pin
SledgeHammer0118-Apr-11 11:55
SledgeHammer0118-Apr-11 11:55 
QuestionResource dictionary [modified] Pin
CrafterIt18-Apr-11 4:36
CrafterIt18-Apr-11 4:36 
AnswerRe: Resource dictionary Pin
Kunal Chowdhury «IN»20-Apr-11 22:37
professionalKunal Chowdhury «IN»20-Apr-11 22:37 
Questiondialogs must be user-initiated silverlight 4 Pin
NTheOne18-Apr-11 1:24
NTheOne18-Apr-11 1:24 
AnswerRe: dialogs must be user-initiated silverlight 4 Pin
Pete O'Hanlon18-Apr-11 2:00
mvePete O'Hanlon18-Apr-11 2:00 
GeneralRe: dialogs must be user-initiated silverlight 4 Pin
NTheOne18-Apr-11 18:53
NTheOne18-Apr-11 18:53 
AnswerRe: dialogs must be user-initiated silverlight 4 Pin
Abhinav S22-Apr-11 8:30
Abhinav S22-Apr-11 8:30 
QuestionImage control not getting resized while resizing window Pin
DavJes18-Apr-11 0:33
DavJes18-Apr-11 0:33 
AnswerRe: Image control not getting resized while resizing window Pin
DavJes18-Apr-11 0:34
DavJes18-Apr-11 0:34 

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.