Click here to Skip to main content
15,914,010 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Project Output Type Class Library and Windows Application Pin
cjb11019-Nov-14 23:55
cjb11019-Nov-14 23:55 
GeneralRe: Project Output Type Class Library and Windows Application Pin
Ashfaque Hussain20-Nov-14 0:05
Ashfaque Hussain20-Nov-14 0:05 
GeneralRe: Project Output Type Class Library and Windows Application Pin
cjb11020-Nov-14 0:43
cjb11020-Nov-14 0:43 
GeneralRe: Project Output Type Class Library and Windows Application Pin
Ashfaque Hussain20-Nov-14 1:11
Ashfaque Hussain20-Nov-14 1:11 
GeneralRe: Project Output Type Class Library and Windows Application Pin
cjb11020-Nov-14 3:06
cjb11020-Nov-14 3:06 
QuestionAdd a table to a DockPanel Pin
zhshqzyc31-Oct-14 8:56
zhshqzyc31-Oct-14 8:56 
AnswerRe: Add a table to a DockPanel Pin
Mycroft Holmes31-Oct-14 13:44
professionalMycroft Holmes31-Oct-14 13:44 
GeneralRe: Add a table to a DockPanel Pin
zhshqzyc31-Oct-14 15:51
zhshqzyc31-Oct-14 15:51 
GeneralRe: Add a table to a DockPanel Pin
Mycroft Holmes2-Nov-14 21:07
professionalMycroft Holmes2-Nov-14 21:07 
QuestionProblem connection database Silverlight project Pin
Hi I am Kevin29-Oct-14 5:55
Hi I am Kevin29-Oct-14 5:55 
AnswerRe: Problem connection database Silverlight project Pin
Mycroft Holmes31-Oct-14 13:38
professionalMycroft Holmes31-Oct-14 13:38 
QuestionWPF Navigation system Pin
Hi-I-am-Tang29-Oct-14 4:58
Hi-I-am-Tang29-Oct-14 4:58 
AnswerRe: DataTransferManager RT Only? Pin
Richard Deeming27-Oct-14 11:56
mveRichard Deeming27-Oct-14 11:56 
GeneralRe: DataTransferManager RT Only? Pin
Richard Deeming28-Oct-14 4:14
mveRichard Deeming28-Oct-14 4:14 
GeneralRe: DataTransferManager RT Only? Pin
Richard Deeming28-Oct-14 7:34
mveRichard Deeming28-Oct-14 7:34 
GeneralRe: DataTransferManager RT Only? Pin
Richard Deeming28-Oct-14 8:42
mveRichard Deeming28-Oct-14 8:42 
QuestionWPF MVVM VALIDATION Pin
Arun Karuvatta23-Oct-14 22:08
professionalArun Karuvatta23-Oct-14 22:08 
AnswerRe: WPF MVVM VALIDATION Pin
Pete O'Hanlon23-Oct-14 22:42
mvePete O'Hanlon23-Oct-14 22:42 
QuestionWPF or MVC 4 Problem? Pin
Kevin Marois18-Oct-14 17:38
professionalKevin Marois18-Oct-14 17:38 
AnswerRe: WPF or MVC 4 Problem? Pin
Richard Deeming20-Oct-14 1:51
mveRichard Deeming20-Oct-14 1:51 
RantWPF - Why? Pin
SteveHolle17-Oct-14 6:20
SteveHolle17-Oct-14 6:20 
I'm working through the excellent book "Windows Presentation Foundation 4.5 Cookbook" by Pavel Yosifovich, trying to broaden my skill set. I'm at the 70% mark according to my Kindle Reader and still asking "why?" I don't normally like to copy the downloaded code because I learn a great deal by typing the code in and troubleshooting my errors. I finally threw in the towel with the code I will insert at the end of this post. My main aggravation is trying to use XAML to design graphical interfaces. I find it impossible to picture in my head anything but the simplest constructs. This may be a deficiency on my part but please, looking at the templates below created in App.xaml who can really tell what this is going to look like? Many lines of dense code that can't be viewed until the syntax is completely correct AND the template is used in a window.

I understand that there are tools like Blend which begs the question "Why isn't blend the default WPF design tool in Visual Studio?" Are there tools for visualizing, maybe even creating, templates?

I intend to work through the remaining chapters in this book and then explore the tools available in Blend and only use XAML to tweak. Is anyone else with me here?

Code:
<Application x:Class="CH08.CustomScrollBars.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ControlTemplate TargetType="RepeatButton" x:Key="repeatTransTemplate">
<Rectangle Fill="Transparent" />
</ControlTemplate>
<ControlTemplate TargetType="RepeatButton" x:Key="plainTemplate">
<Grid>
<ContentPresenter Margin="{TemplateBinding Padding}" />
</Grid>
</ControlTemplate>
<ControlTemplate TargetType="Thumb" x:Key="vthumbTemplate">
<Rectangle RadiusX="5" RadiusY="10" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}"
Fill="{TemplateBinding Background}" />
</ControlTemplate>
<ControlTemplate TargetType="ScrollBar" x:Key="verticalScrollBarTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border BorderBrush="DarkBlue" BorderThickness="1" Background="LightBlue" Grid.Row="1">
<Track x:Name="PART_Track" IsDirectionReversed="True">
<Track.DecreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageUpCommand" Template="{StaticResource repeatTransTemplate}" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageDownCommand" Template="{StaticResource repeatTransTemplate}" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Template="{StaticResource vthumbTemplate}" BorderBrush="Black" BorderThickness="1">
<Thumb.Background>
<LinearGradientBrush EndPoint="0,1">
<GradientStop Offset="0" Color="DarkGreen" />
<GradientStop Offset="1" Color="LightGreen" />
</LinearGradientBrush>
</Thumb.Background>
</Thumb>
</Track.Thumb>
</Track>
</Border>
<Viewbox>
<RepeatButton Command="{x:Static ScrollBar.LineUpCommand}" Template="{StaticResource plainTemplate}">
<Path Data="M 25,0 L 50,50 L 0,50 Z" Fill="Blue" />
</RepeatButton>
</Viewbox>
<Viewbox Grid.Row="2">
<RepeatButton Command="{x:Static ScrollBar.LineDownCommand}" Template="{StaticResource plainTemplate}">
<Path Data="M 25,50 L 0,0 L 50,0 Z" Fill="Blue" />
</RepeatButton>
</Viewbox>
</Grid>
</ControlTemplate>
<ControlTemplate TargetType="Thumb" x:Key="hthumbTemplate">
<Rectangle RadiusX="10" RadiusY="5" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}"
Fill="{TemplateBinding Background}" />
</ControlTemplate>
<ControlTemplate TargetType="ScrollBar" x:Key="horizontalScrollBarTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border BorderBrush="DarkBlue" BorderThickness="1" Background="LightBlue" Grid.Column="1">
<Track x:Name="PART_Track" IsDirectionReversed="False">
<Track.DecreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageLeftCommand" Template="{StaticResource repeatTransTemplate}" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageRightCommand" Template="{StaticResource repeatTransTemplate}" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Template="{StaticResource hthumbTemplate}" BorderBrush="Black" BorderThickness="1">
<Thumb.Background>
<LinearGradientBrush EndPoint="1,0">
<GradientStop Offset="0" Color="DarkGreen" />
<GradientStop Offset="1" Color="LightGreen" />
</LinearGradientBrush>
</Thumb.Background>
</Thumb>
</Track.Thumb>
</Track>
</Border>
<Viewbox>
<RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}" Template="{StaticResource plainTemplate}">
<Path Data="M 0,25 L 50,50 L 50,0 Z" Fill="Blue" />
</RepeatButton>
</Viewbox>
<Viewbox Grid.Column="2">
<RepeatButton Command="{x:Static ScrollBar.LineRightCommand}" Template="{StaticResource plainTemplate}">
<Path Data="M 0,0 L 50,25 L 0,50 Z" Fill="Blue" />
</RepeatButton>
</Viewbox>
</Grid>
</ControlTemplate>
<Style TargetType="ScrollBar">
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource verticalScrollBarTemplate}" />
</Trigger>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Template" Value="{StaticResource horizontalScrollBarTemplate}" />
</Trigger>

</Style.Triggers>
</Style>

</Application.Resources>
</Application>
GeneralRe: WPF - Why? Pin
Gerry Schmitz17-Oct-14 11:07
mveGerry Schmitz17-Oct-14 11:07 
GeneralRe: WPF - Why? Pin
RedDk17-Oct-14 11:29
RedDk17-Oct-14 11:29 
GeneralRe: WPF - Why? Pin
SteveHolle6-Nov-14 4:18
SteveHolle6-Nov-14 4:18 
GeneralRe: WPF - Why? Pin
Mycroft Holmes17-Oct-14 13:51
professionalMycroft Holmes17-Oct-14 13:51 

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.