|
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CustomControlsAndTemplates"
x:Class="CustomControlsAndTemplates.Window1"
Title="Window1" Height="600" Width="600" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources\Styles.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<StackPanel Orientation="Vertical" Margin="0,0,0,0" RenderTransformOrigin="0.616,0.65" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600">
<StackPanel Orientation="Horizontal" Margin="0,0,0,0" Height="300" Width="600">
<!-- LEFT PANEL -->
<StackPanel Orientation="Vertical" Width="300" HorizontalAlignment="Center" Background="Beige">
<local:OpenImageCustomControlUsingRoutedEvents x:Name="openImageControlUsingRoutedEvents" Width="80" Height="80" Background="Yellow" Margin="0,5,0,0">
<local:OpenImageCustomControlUsingRoutedEvents.Template>
<ControlTemplate>
<StackPanel Orientation="Vertical" Background="{TemplateBinding Background}">
<Border BorderBrush="Black" BorderThickness="2,2,2,2" Height="60">
<Image x:Name="Part_Image" Margin="0" Stretch="Fill" />
</Border>
<Button x:Name="Part_OpenImage" Width="Auto" Content="Browse" Height="20"/>
</StackPanel>
</ControlTemplate>
</local:OpenImageCustomControlUsingRoutedEvents.Template>
</local:OpenImageCustomControlUsingRoutedEvents>
<TextBlock Text="Using Routed Events To Help Ensure Correct Template Operation" TextAlignment="Center" TextWrapping="Wrap"/>
</StackPanel>
<!-- RIGHT PANEL -->
<StackPanel Orientation="Vertical" Width="300" HorizontalAlignment="Center" Background="Coral">
<local:OpenImageCustomControlUsingCommands x:Name="openImageCustomControlUsingCommands" Width="80" Height="80" Background="Yellow" Margin="0,5,0,0">
<local:OpenImageCustomControlUsingCommands.Template>
<ControlTemplate>
<StackPanel Orientation="Vertical" Background="{TemplateBinding Background}">
<Border BorderBrush="Black" BorderThickness="2,2,2,2" Height="60">
<Image x:Name="selectedImage" Margin="0" Stretch="Fill" />
</Border>
<Button Command="{x:Static local:OpenImageCustomControlUsingCommands.OpenImageCommand}" Width="Auto" Content="Browse" Height="20"/>
</StackPanel>
</ControlTemplate>
</local:OpenImageCustomControlUsingCommands.Template>
</local:OpenImageCustomControlUsingCommands>
<TextBlock Text="Using Commands TO Help Ensure Correct Template Operation" TextAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="300" Width="600">
<!-- LEFT PANEL -->
<StackPanel Orientation="Vertical" Width="300" HorizontalAlignment="Center" Background="#FF678989">
<TextBlock Text="Working ScrollBar Template Using PART_Track" TextAlignment="Center" TextWrapping="Wrap"/>
<ScrollBar Margin="0,15,0,0" Height="200" Style="{StaticResource scrollWORKS}" Width="40"/>
</StackPanel>
<!-- RIGHT PANEL -->
<StackPanel Orientation="Vertical" Width="300" HorizontalAlignment="Center" Background="#FF50ADFF">
<TextBlock Text="Not Working ScrollBar Template" TextAlignment="Center" TextWrapping="Wrap"/>
<ScrollBar Margin="0,15,0,0" Height="200" Style="{StaticResource scroll_NO_WORKS}" Width="40"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Window>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)
- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence
Both of these at Sussex University UK.
Award(s)
I am lucky enough to have won a few awards for Zany Crazy code articles over the years
- Microsoft C# MVP 2016
- Codeproject MVP 2016
- Microsoft C# MVP 2015
- Codeproject MVP 2015
- Microsoft C# MVP 2014
- Codeproject MVP 2014
- Microsoft C# MVP 2013
- Codeproject MVP 2013
- Microsoft C# MVP 2012
- Codeproject MVP 2012
- Microsoft C# MVP 2011
- Codeproject MVP 2011
- Microsoft C# MVP 2010
- Codeproject MVP 2010
- Microsoft C# MVP 2009
- Codeproject MVP 2009
- Microsoft C# MVP 2008
- Codeproject MVP 2008
- And numerous codeproject awards which you can see over at my blog