Solved

Using Resource Dictionary to assign height in Xaml

Posted on 2008-10-08
2
572 Views
Last Modified: 2013-11-26
Have a Resource Dictionary:
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <!--    Grid Colors -->
    <Color x:Key="grdSolidColorBrush" A="255" R="165" G="195" B="239" />
          :
    <Button  x:Key="btnStd"    Height="23"  Width="75"  />
    <Label   x:Key="lblStd"    Height="28"  Width="54"  />
    <Label   x:Key="lblStd_X2" Height="28"  Width="108" />
    <TextBox x:Key="txtStd"    Height="21"  Width="90"  />
          :
    <Thickness x:Key="TxtR3C2" Left="265" Right="0" Bottom="0" Top="62"  />

Want to use the Resource Dictionary to globally assign height and width of GUI Objects

This works -
        <Grid >
            <Grid.Background>
                <SolidColorBrush Color="{DynamicResource grdSolidColorBrush}" />
            </Grid.Background>
and brings down the desired Color, in that way, can change the color in one location and cascade it to all Xaml code.  Can also place Objects dynamically on form with Margin="{DynamicResource TxtR3C2}" "like" commands.

However, I can not seem to dynamically control the height and width of Objects.  Width="{DynamicResource txtStd.Width}" does not produce an Object with a Width of 90.

What am I missing?

Thank you in advanced

Marv
0
Comment
Question by:Marvin_Rowe
  • 2
2 Comments
 

Author Comment

by:Marvin_Rowe
ID: 22670492
Answered own question - sorry

This works for a Button control but it sould apply to all

    <Style TargetType="Button" x:Key="btnStd" >
        <Setter Property="Height" Value="28" />
        <Setter Property="Width" Value="54" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Bottom" />
    </Style>
0
 

Accepted Solution

by:
Marvin_Rowe earned 0 total points
ID: 22670499
That's "should" not "sould"
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now