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

WPF

 
GeneralRe: LINQ Pin
sunil.n.cs5-Aug-09 1:50
sunil.n.cs5-Aug-09 1:50 
GeneralRe: LINQ Pin
Pete O'Hanlon5-Aug-09 2:13
mvePete O'Hanlon5-Aug-09 2:13 
GeneralRe: LINQ Pin
sunil.n.cs5-Aug-09 3:11
sunil.n.cs5-Aug-09 3:11 
QuestionHow can I set my dynamic images in random position? Pin
Kunal Chowdhury «IN»3-Aug-09 21:13
professionalKunal Chowdhury «IN»3-Aug-09 21:13 
AnswerRe: How can I set my dynamic images in random position? Pin
Christian Graus3-Aug-09 22:47
protectorChristian Graus3-Aug-09 22:47 
QuestionHow i can add new buttons to my epander control Pin
wasimsharp3-Aug-09 20:40
wasimsharp3-Aug-09 20:40 
AnswerRe: How i can add new buttons to my epander control Pin
Super Lloyd4-Aug-09 0:47
Super Lloyd4-Aug-09 0:47 
GeneralRe: How i can add new buttons to my epander control Pin
wasimsharp4-Aug-09 1:27
wasimsharp4-Aug-09 1:27 
thnx buddy.
i solve the problem by creating the custom control for the Expander. take idea from( Form link
)
i add the buttons in template here is the xaml
<Style TargetType="{x:Type local:CustomControl1}">
       <Setter Property="Template">
           <Setter.Value>
               <ControlTemplate TargetType="{x:Type local:CustomControl1}">
                   <ControlTemplate.Resources>
                       <OuterGlowBitmapEffect x:Key="outerGlow" GlowColor="Brown" GlowSize="0"></OuterGlowBitmapEffect>

                       <!-- Style for the toggle button which wil be used as expander header -->
                       <Style TargetType="{x:Type ToggleButton}" x:Key="toggleButtonKey">
                           <Setter Property="Template">
                               <Setter.Value>

                                   <ControlTemplate TargetType="{x:Type ToggleButton}">

                                       <Border Background="White">
                                           <Grid Background="Aquamarine"
                                                   Margin="{TemplateBinding Padding}">
                                          <ContentPresenter ContentSource="{TemplateBinding Content}" Margin="5"/>

                                           <Grid Background="Transparent">


                                               <Ellipse x:Name="shadow" Visibility="Hidden"
                                                        HorizontalAlignment="Center" VerticalAlignment="Center"
                                                        Width="17" Height="17" />


                                               <Path x:Name="arrow"
                                                     VerticalAlignment="Center" HorizontalAlignment="Center"
                                                     Stroke="#666" StrokeThickness="2"
                                                     Data="M1,1 L4,4 7,1" />
                                           </Grid>



                                       </Grid>
                                       </Border>
                                       <ControlTemplate.Triggers>
                                           <!-- Trigger to change the arrow direction when expanded -->
                                           <Trigger Property="IsChecked" Value="true">
                                               <Setter TargetName="arrow"
                                                       Property="Data" Value="M 1,4  L 4,1  L 7,4"/>
                                           </Trigger>

                                           <!-- Trigger to give a mouse over effect on the circle containing direction arrow -->
                                           <Trigger Property="IsMouseOver" Value="true">

                                               <Setter TargetName="arrow"
                                                       Property="Stroke" Value="#222"/>
                                               <Setter TargetName="shadow"
                                                       Property="Visibility" Value="Visible"/>
                                           </Trigger>
                                       </ControlTemplate.Triggers>
                                   </ControlTemplate>
                               </Setter.Value>
                           </Setter>
                       </Style>
                   </ControlTemplate.Resources>
                   <Border Background="{TemplateBinding Background}"
                           BorderBrush="{TemplateBinding BorderBrush}"
                           BorderThickness="{TemplateBinding BorderThickness}">
                       <Grid>
                           <!-- Expander -->
                           <StackPanel>
                               <!-- Expander Header -->
                               <Grid>
                                   <Grid.ColumnDefinitions>
                                       <ColumnDefinition/>
                                       <ColumnDefinition/>
                                   </Grid.ColumnDefinitions>
                                   <ToggleButton x:Name="expanderHeader"  Grid.Column="0"  HorizontalAlignment="Left"
                                                 Width="{TemplateBinding Width}"
                                             Style="{StaticResource toggleButtonKey}"
                                             Content="{TemplateBinding Header}"
                                             Padding="{TemplateBinding Padding}"
                                             IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsExpanded,Mode=TwoWay}"/>
                              <StackPanel Orientation="Horizontal"  Grid.Column="1">
                                  <Button x:Name="btnHistory"  Content="History"/>
                                   <Button x:Name="btnNotes" Content="Notes"/>
                                   <Button x:Name="btnMedication"   Content="Medication"/>
                               </StackPanel>
                                   </Grid>


                               <!-- Expander Content -->
                               <ContentPresenter  x:Name="expanderContent"/>

                           </StackPanel>



                       </Grid>
                   </Border>
                   <ControlTemplate.Triggers>
                       <!-- Trigger for showing the popup when Expander control is not expanded and IsMouseOver is true  -->
                       <MultiTrigger>
                           <MultiTrigger.Conditions>
                               <Condition SourceName="expanderHeader" Property="IsMouseOver" Value="True"></Condition>
                               <Condition SourceName="expanderHeader" Property="IsChecked" Value="False"></Condition>
                           </MultiTrigger.Conditions>

                       </MultiTrigger>



                       <!-- Trigger for setting the content of expander when IsExpanded is true -->
                       <Trigger SourceName="expanderHeader" Property="IsChecked" Value="True">

                           <Setter TargetName="expanderContent"
                                   Property="Visibility" Value="Visible"></Setter>
                       </Trigger>
                       <Trigger SourceName="expanderHeader" Property="IsChecked" Value="False">

                           <Setter TargetName="expanderContent"
                                   Property="Visibility" Value="Collapsed"></Setter>
                       </Trigger>
                   </ControlTemplate.Triggers>


               </ControlTemplate>
           </Setter.Value>
       </Setter>
   </Style>



and in CustomControl.cs i added
public CustomControl1()
{
this.Loaded += new RoutedEventHandler(CustomControl1_Loaded);
}

void CustomControl1_Loaded(object sender, RoutedEventArgs e)
{
Button btn = Template.FindName("btnHistory", this) as Button;
if (btn != null)
{
btn.Click += new RoutedEventHandler(btn_Click);
}
Button btnNotes = Template.FindName("btnNotes", this) as Button;
if (btnNotes != null)
{
btnNotes.Click += new RoutedEventHandler(btnNotes_Click);
}
Button btnMedcation = Template.FindName("btnMedication", this) as Button;
if (btnMedcation != null)
{
btnMedcation.Click += new RoutedEventHandler(btnMedcation_Click);

}
}
is this is right approach or not.
plz reply

WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP

GeneralRe: How i can add new buttons to my epander control Pin
Super Lloyd4-Aug-09 1:40
Super Lloyd4-Aug-09 1:40 
AnswerRe: How i can add new buttons to my epander control Pin
wasimsharp4-Aug-09 1:56
wasimsharp4-Aug-09 1:56 
QuestionCustom classes in XAML - Assign properties after parents set Pin
Ian Shlasko3-Aug-09 4:15
Ian Shlasko3-Aug-09 4:15 
AnswerRe: Custom classes in XAML - Assign properties after parents set Pin
Super Lloyd4-Aug-09 3:14
Super Lloyd4-Aug-09 3:14 
GeneralRe: Custom classes in XAML - Assign properties after parents set Pin
Ian Shlasko4-Aug-09 12:14
Ian Shlasko4-Aug-09 12:14 
GeneralRe: Custom classes in XAML - Assign properties after parents set Pin
Super Lloyd4-Aug-09 13:06
Super Lloyd4-Aug-09 13:06 
GeneralRe: Custom classes in XAML - Assign properties after parents set Pin
Ian Shlasko4-Aug-09 15:57
Ian Shlasko4-Aug-09 15:57 
QuestionHow can I cache data in WPF application? Pin
Kunal Chowdhury «IN»3-Aug-09 1:06
professionalKunal Chowdhury «IN»3-Aug-09 1:06 
AnswerRe: How can I cache data in WPF application? Pin
Pete O'Hanlon3-Aug-09 1:32
mvePete O'Hanlon3-Aug-09 1:32 
AnswerRe: How can I cache data in WPF application? Pin
Kunal Chowdhury «IN»3-Aug-09 2:43
professionalKunal Chowdhury «IN»3-Aug-09 2:43 
QuestionHow to Give Header in multicolunm TreeView and also implement sorting algo? Pin
sachinjadhavcm2-Aug-09 23:54
sachinjadhavcm2-Aug-09 23:54 
QuestionAdjusting Panels in WPF programatically ? Pin
Krishna Aditya2-Aug-09 20:31
Krishna Aditya2-Aug-09 20:31 
AnswerRe: Adjusting Panels in WPF programatically ? Pin
Christian Graus2-Aug-09 22:02
protectorChristian Graus2-Aug-09 22:02 
QuestionGlobal Styles - Update Pin
#realJSOP2-Aug-09 1:02
mve#realJSOP2-Aug-09 1:02 
QuestionHow to display a document in silverlight? Pin
CBenac31-Jul-09 14:27
CBenac31-Jul-09 14:27 
AnswerRe: How to display a document in silverlight? Pin
Michael Sync31-Jul-09 18:21
Michael Sync31-Jul-09 18:21 
QuestionUse Themes? Pin
#realJSOP31-Jul-09 1:09
mve#realJSOP31-Jul-09 1:09 

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.