Solved

Using Resource Dictionary to assign height in Xaml

Posted on 2008-10-08
2
577 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

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…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

763 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