Search Results

Search found 625 results on 25 pages for 'stretch'.

Page 14/25 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Ubuntu 12.04 gets overheated, whereas I have no heating problems on Windows 7 whatsoever

    - by G K
    I bought a new laptop which came pre-installed with Windows 7. I love working on Ubuntu and hence installed it. I can work on Windows for 6 hours at a stretch and feel the laptop being only slightly warm, but 15 minutes into running Ubuntu and my laptop is too hot. The battery also drains out very quickly on Ubuntu. 1.5 hrs of backup on Ubuntu compared to 5-6 hrs on Windows. I previously owned a Dell Inspiron N5010 and everything ran smoothly on that. No heating issues. It came with intel i3 processor. So I'm wondering whether this problem has something to do with the processor? (AMD A8) Specs: HP Pavilion G6-2005AX Laptop (APU Quad Core A8/ 4GB/ 500GB/ Win7 HB/ 1.5GB Graph) 1 GB AMD Radeon HD 7670M Dedicated 512 MB AMD Radeon HD 7640G Graphics Integrated Is there any fix for this problem? Thanks in advance. Edit: I've installed ATI proprietary drivers suggested by Ubuntu.

    Read the article

  • Transfer disk image to larger/smaller disk

    - by forthrin
    I need to switch the hard drive on a 2006 iMac to a new SSD. I don't have the original installation CDs. I know I can order CDs from Apple, but this costs money. Someone told me it's possible to rip the image of the old drive and transfer to the new drive. If so, does the size of the new drive have to be exactly the same as the old? If not, my questions are: Is it possible to "stretch" the image from 120 MB disk to a 256 MB disk (numbers are examples)? If so, what is the command line for this? Likewise, is it possible to "shrink" an image from a larger disk (eg. 256 MB) to a smaller disk (eg. 120 MB), provided that the actual space used on the disk does not exceed 120 MB? How do you do this on the command line?

    Read the article

  • How to not startx in hosted inux CentOS 5.5 ,and how to make full screen

    - by user61104
    Hello all Im beginner to VMWare player , im using CentOS 5.5 as the virtual OS and installed the VMWare Player in windows xp 32 bit And its working great , but when I like to start the GNUME gui to use x server its starting the GUI desktop right inside the VMWare server I like it just to start , and I will connect form out side ( for example with xming x server ) how can I do that ? Second question is how can I make the VMWare server with the GUI display to be full screen on my desktop ? Now when I resize the window its getting full screen but the Linux main window remain centered and small . and I like it to stretch full screen

    Read the article

  • WPF - How can I place a usercontrol over an AdornedElementPlaceholder?

    - by Kevin
    I'm trying to get the validation to not show through my custom modal dialog. I've tried setting the zindex of the dialog and and of the elements in this template. Any ideas? This is coming from a validation template: <ControlTemplate x:Key="ValidationTemplate"> <DockPanel> <TextBlock Foreground="Red" FontSize="20" Panel.ZIndex="-10">!</TextBlock> <Border Name="validationBorder" BorderBrush="Red" BorderThickness="2" Padding="1" CornerRadius="3" Panel.ZIndex="-10"> <Border.Resources> <Storyboard x:Key="_blink"> <ColorAnimationUsingKeyFrames AutoReverse="True" BeginTime="00:00:00" Storyboard.TargetName="validationBorder" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" RepeatBehavior="Forever"> <SplineColorKeyFrame KeyTime="00:00:1" Value="#00FF0000"/> </ColorAnimationUsingKeyFrames> </Storyboard> </Border.Resources> <Border.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard Storyboard="{StaticResource _blink}" /> </EventTrigger> </Border.Triggers> <AdornedElementPlaceholder/> </Border> </DockPanel> </ControlTemplate> The dialog: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Class="GunMiser.Controls.PendingChangesConfirmationDialog" Height="768" Width="1024" mc:Ignorable="d"> <Grid Background="White"> <Rectangle x:Name="MainRectangle" Margin="0,0,0,0" Style="{DynamicResource UserControlOverlayRectangleStyle}" Opacity="0.85"/> <Border Margin="288,250,278,288" Background="#FF868686" BorderBrush="Black" BorderThickness="1"> <Border.Effect> <DropShadowEffect Color="#FFB6B2B2"/> </Border.Effect> <TextBlock x:Name="textBlockMessage" Margin="7,29,7,97" TextWrapping="Wrap" d:LayoutOverrides="VerticalAlignment" TextAlignment="Center"/> </Border> <Button x:Name="OkButton" Click="OkButton_Click" Margin="313,0,0,328" VerticalAlignment="Bottom" Height="24" Content="Save Changes" Style="{DynamicResource GunMiserButtonStyle}" HorizontalAlignment="Left" Width="103"/> <Button Click="CancelButton_Click" Margin="453.294,0,456,328" VerticalAlignment="Bottom" Height="24" Content="Cancel Changes" Style="{DynamicResource GunMiserButtonStyle}"/> <Button Click="CancelActionButton_Click" Margin="0,0,304,328" VerticalAlignment="Bottom" Height="24" Content="Go Back" Style="{DynamicResource GunMiserButtonStyle}" HorizontalAlignment="Right" Width="114.706"/> </Grid> </UserControl> And the overall window is: <Window x:Class="GunMiser.Views.Shell" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cal="http://www.codeplex.com/CompositeWPF" xmlns:controls="clr-namespace:GunMiser.Controls;assembly=GunMiser.Controls" Title="Gun Miser" Height="768" Width="1024"> <Canvas> <controls:PendingChangesConfirmationDialog x:Name="PendingChangesConfirmationDialog" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Width="1008" Height="730" Visibility="Collapsed" Panel.ZIndex="100" /> <ContentControl x:Name="FilterRegion" cal:RegionManager.RegionName="FilterRegion" Width="326" Height="656" Canvas.Top="32" VerticalAlignment="Top" HorizontalAlignment="Left" /> <ContentControl Name="WorkspaceRegion" cal:RegionManager.RegionName="WorkspaceRegion" Width="678" Height="726" Canvas.Left="330" VerticalAlignment="Top" HorizontalAlignment="Left"/> <Button Click="GunsButton_Click" Width="75" Height="25" Content="Guns" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/> <Button Click="OpticsButton_Click" Width="75" Height="25" Content="Optics" Canvas.Left="81" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/> <Button Click="SettingsButton_Click" Width="56" Height="28" Content="Settings" Canvas.Left="944" Style="{DynamicResource GunMiserButtonStyle}" HorizontalAlignment="Left" VerticalAlignment="Top"/> <Button Click="AccessoriesButton_Click" Width="75" Height="25" Content="Accessories" Canvas.Left="239" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/> <Button Click="AmmunitionButton_Click" Width="75" Height="25" Content="Ammunition" Canvas.Left="160" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/> </Canvas> </Window>

    Read the article

  • How can I bind the nested viewmodels to properties of a control

    - by Robert
    I used Microsoft's Chart Control of the WPF toolkit to write my own chart control. I blogged about it here. My Chart control stacks the yaxes in the chart on top of each other. As you can read in the article this all works quite well. Now I want to create a viewmodel that controls the data and axes in the chart. So far I'm able to add axes to the chart and show them in the chart. But I have a problem when I try to add the lineseries because it has one DependentAxis and one InDependentAxis property. I don't know how to assign the proper xAxis and yAxis controls to it. Below you see part of the LineSeriesViewModel. It has a nested XAxisViewModel and YAxisViewModel property. public class LineSeriesViewModel : ViewModelBase, IChartComponent { XAxisViewModel _xAxis; public XAxisViewModel XAxis { get { return _xAxis; } set { _xAxis = value; RaisePropertyChanged(() => XAxis); } } //The YAxis Property look the same } The viewmodels all have their own datatemplate. The xaml code looks like this: <UserControl.Resources> <DataTemplate x:Key="xAxisTemplate" DataType="{x:Type l:YAxisViewModel}"> <chart:LinearAxis x:Name="yAxis" Orientation="Y" Location="Left" Minimum="0" Maximum="10" IsHitTestVisible="False" Width="50" /> </DataTemplate> <DataTemplate x:Key="yAxisTemplate" DataType="{x:Type l:XAxisViewModel}"> <chart:LinearAxis x:Name="xAxis" Orientation="X" Location="Bottom" Minimum="0" Maximum="100" IsHitTestVisible="False" Height="50" /> </DataTemplate> <DataTemplate DataType="{x:Type l:LineSeriesViewModel}"> <!--Binding doesn't work on the Dependent and IndependentAxis! --> <!--YAxis XAxis and Series are properties of the LineSeriesViewModel --> <l:FastLineSeries DependentAxis="{Binding Path=YAxis}" IndependentAxis="{Binding Path=XAxis}" ItemsSource="{Binding Path=Series}"/> </DataTemplate> <Style TargetType="ItemsControl"> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <!--My stacked chart control --> <l:StackedPanel x:Name="stackedPanel" Width="Auto" Height="Auto" Background="LightBlue"> </l:StackedPanel> </ItemsPanelTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ClipToBounds="True"> <!-- View is an ObservableCollection of all axes and series--> <ItemsControl x:Name="chartItems" ItemsSource="{Binding Path=View}" Focusable="False"> </ItemsControl> </Grid> This code works quite well. When I add axes they get drawn. But the DependentAxis and InDependentAxis of the lineseries control stay null, so the series doesn't get drawn. How can I bind the nested viewmodels to the properties of a control?

    Read the article

  • events not getting fired properly

    - by prince23
    hi, this is my xaml code. datagrid within another data grid. <sdk:DataGrid x:Name="dgLevel1" AutoGenerateColumns="False" VerticalAlignment="Top" IsReadOnly="True" Margin="12,12,0,0" RowDetailsVisibilityChanged="dgLevel1_RowDetailsVisibilityChanged" SelectionMode="Extended" RowDetailsVisibilityMode="VisibleWhenSelected" Height="412" HorizontalAlignment="Left" Width="816"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="myButton" Width="24" Height="24" Click="ExpandLevel1_Click"> <Image x:Name="imgLevel1" Source="Images/detail.JPG" Stretch="None"/> </Button> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn Header="Actual" Visibility="Collapsed"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding UniqueName}" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Binding="{Binding Name}" Header="Name" Width="550" /> <!--<sdk:DataGridTextColumn Binding="{Binding UniqueName}" Visibility="Collapsed"/>--> <sdk:DataGridTemplateColumn Header="Actual" Width="80" > <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding Age}" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> <sdk:DataGrid.RowDetailsTemplate> <DataTemplate> <StackPanel Width="805"> <sdk:DataGrid x:Name="dgLevel2" Width="797" Margin="17,0,0,0" HeadersVisibility ="None" AutoGenerateColumns="False" HorizontalAlignment="Center" IsReadOnly="True" RowDetailsVisibilityChanged="dgLevel2_RowDetailsVisibilityChanged" SelectionMode="Extended" RowDetailsVisibilityMode="VisibleWhenSelected"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="myButton" Width="24" Height="30" Click="ExpandLevel2_Click"> <Image x:Name="imgLevel2" Source="Images/detail.JPG" Stretch="None"/> </Button> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Binding="{Binding School}" Width="528" /> <sdk:DataGridTextColumn Binding="{Binding College}" Visibility="Collapsed" /> <sdk:DataGridTemplateColumn Header="Actual" Width="80"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding DOB}" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> </sdk:DataGrid> </StackPanel> </DataTemplate> </sdk:DataGrid.RowDetailsTemplate> </sdk:DataGrid> i have 2 data grid and have 2 image buttons in both the grid . but the event which is in datagrid ExpandLevel1 _Click and ExpandLevel2 _Click is not getting fired properly. some times get fired some times no when i click the button first this event gets fired then ExpandLevel1_Click then **dgLevel1_RowDetailsVisibilityChanged . same thing is happening for the datagrid 2 ExpandLevel2_Click then dgLevel2_RowDetailsVisibilityChanged** there are scenario where first datagrid event gets fired first then button click events why is this happening .is there any solution for this looking forward an solutions thanks in advance. prince

    Read the article

  • expand/collpase datagrid

    - by prince23
    hi, i have an nested datagrid . i able to bind the values with no issues once i clik teh row i able to show nested grid. now i need to add an image button( like an "+ " Symbol ) at the left corner. once i press this button the grid shows the further records under it. that time i need to repalce the image button with ("--" symbol). i have these two images done. but how to do this is really a big issue now for me.can any one help me out.struck on this issue from past 3 days. plz plz provide an solution on this. i would be really thank full for you guys . am new to silver light this is my code. <sdk:DataGrid MinHeight="100" x:Name="dgCounty" AutoGenerateColumns="False" VerticalAlignment="Top" Grid.Row="1" IsReadOnly="True" Margin="5,5,5,0" RowDetailsVisibilityChanged="dgCounty_RowDetailsVisibilityChanged" RowDetailsVisibilityMode="VisibleWhenSelected"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn CanUserReorder="False"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="+" Click="Button_Click"></Button> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Header="ID" Width="100" Binding="{Binding EmployeeID}" CanUserReorder="False"/> <sdk:DataGridTextColumn Header="FirstName" Width="80" Binding="{Binding EmployeeFName}" CanUserReorder="False"/> <sdk:DataGridTextColumn Header="LastName" Width="80" Binding="{Binding EmployeeLName}" CanUserReorder="False"/> <sdk:DataGridTextColumn Header="MailID" Width="80" Binding="{Binding EmployeeMailID}" CanUserReorder="False"/> </sdk:DataGrid.Columns> <sdk:DataGrid.RowDetailsTemplate> <DataTemplate> <sdk:DataGrid x:Name="dgrdRowDetail" Width="400" AutoGenerateColumns="False" HorizontalAlignment="Center" IsReadOnly="True" > <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Header="CompanyName" Binding="{Binding CompanyName}"/> <sdk:DataGridTextColumn Header="CompanyID" Binding="{Binding CompanyID}"/> <sdk:DataGridTemplateColumn Header="Score"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <StackPanel Loaded ="StackPanel_Loaded" Orientation="Horizontal" Background="Transparent"> <TextBlock Text="{Binding Score}" TextWrapping="NoWrap" HorizontalAlignment="Center" Foreground="Blue"></TextBlock> <!--<Image Source ="../Images/image1.JPG" Width="20" Height="20" Stretch ="Fill"/>--> <Image x:Name="imgScore" Source ="{Binding Score}" Width="20" Height="20" Stretch ="Fill"/> <sdk:Label Content="Score" /> </StackPanel> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> </sdk:DataGrid> private void Button_Click(object sender, RoutedEventArgs e) { //how to handle this issue. } if possiable plz provide the code that can help me out.

    Read the article

  • Error while trying to insert image in to wordML

    - by Kiru
    Hi, Help needed. I am getting this error {"The xml has invalid content and cannot be constructed as an element.\r\nParameter name: outerXml"} while passing constructed xml in to DocumentFormat.OpenXml.Office.Drawing.Drawing() constructor like this DocumentFormat.OpenXml.Office.Drawing.Drawing d = new DocumentFormat.OpenXml.Office.Drawing.Drawing(img); Here is the xml which is passed in <w:drawing xmlns:w="http://schemas.openxmlformats.org/drawingml/2006/main"> <wp:anchor distT="0" distB="0" distL="114300" distR="114300" simplePos="0" relativeHeight="251658240" behindDoc="0" locked="0" layoutInCell="1" allowOverlap="1" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"> <wp:simplePos x="0" y="0"/> <wp:positionH relativeFrom="column"> <wp:align>right</wp:align> </wp:positionH> <wp:positionV relativeFrom="paragraph"> <wp:align>top</wp:align> </wp:positionV> <wp:extent cx="400" cy="400"/> <wp:effectExtent l="19050" t="0" r="0" b="0"/> <wp:wrapSquare wrapText="bothSides"/> <wp:docPr id="1" name="image"/> <wp:cNvGraphicFramePr> <a:graphicFrameLocks noChangeAspect="1" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/> </wp:cNvGraphicFramePr> <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"> <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"> <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"> <pic:nvPicPr> <pic:cNvPr id="0" name="image"/> <pic:cNvPicPr> <a:picLocks noChangeAspect="1" noChangeArrowheads="1"/> </pic:cNvPicPr> </pic:nvPicPr> <pic:blipFill> <a:blip r:embed="rIdImg4" cstate="print" xmlns:r="http://schemas.openxmlformats.org/drawingml/2006/relationships"/> <a:stretch> <a:fillRect/> </a:stretch> </pic:blipFill> <pic:spPr bwMode="auto"> <a:xfrm> <a:off x="0" y="0"/> <a:ext cx="400" cy="400"/> </a:xfrm> <a:prstGeom prst="rect"> <a:avLst/> </a:prstGeom> <a:noFill/> <a:ln w="9525"> <a:noFill/> <a:miter lim="800000"/> <a:headEnd/> <a:tailEnd/> </a:ln> </pic:spPr> </pic:pic> </a:graphicData> </a:graphic> </wp:anchor> </w:drawing> Thanks, Kiru

    Read the article

  • Templates and inheritance

    - by mariusz
    Hello, I have a big problem. I use additional controls for Wpf. One of them is Telerik RadWindow This control is already templated. Now I want to create custom Window with will inherit from RadWindow, and make custom template, eg. One base window will contains grid and two buttons, second base window will contain two grids (master - detail). The problem is that templates do not support inheritance. Perhaps is another way to template only the content of Winodow? My code, that doesn't work (empty window appears, so template doesn't apply) <Style TargetType="{x:Type local:TBaseRjWindow}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:TBaseRjContent}"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <Grid Name="mGrid"> <Grid.ColumnDefinitions> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition MaxHeight="40" MinHeight="30" /> <RowDefinition MaxHeight="40" MinHeight="30" /> <RowDefinition Height="Auto" /> <RowDefinition MaxHeight="40" MinHeight="30" /> </Grid.RowDefinitions> <telerik:RadGridView Margin="10,10,10,10" Name="grid" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ScrollMode="Deferred" AutoGenerateColumns="False" Width="Auto" > </telerik:RadGridView> <telerik:RadDataPager Grid.Row="1" Grid.Column="0" x:Name="radDataPager" PageSize="50" AutoEllipsisMode="None" DisplayMode="First, Previous, Next, Text" Margin="10,0,10,0"/> <StackPanel Grid.Row="1" Grid.Column="0" Margin="5 5 5 5" HorizontalAlignment="Left" Orientation="Horizontal" Height="20" Width="Auto" VerticalAlignment="Center" > <telerik:RadButton x:Name="btAdd" Margin="5 0 5 0" Content="Dodaj" /> <telerik:RadButton x:Name="btEdit" Margin="5 0 5 0" Content="Edytuj" /> <telerik:RadButton x:Name="btDelete" Margin="5 0 5 0" Content="Usun" /> </StackPanel> <StackPanel Name="addFields" Background="LightGray" Visibility="Collapsed" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Width="Auto" Height="Auto" Orientation="Horizontal"> <GroupBox Header="Szczegoly" Margin="2 2 2 2" > <Grid VerticalAlignment="Top" DataContext="{Binding SelectedItem, ElementName=grid}" Name="_gAddFields" Margin="0 0 0 0" Width="Auto" Height="Auto" > </Grid> </GroupBox> </StackPanel> <StackPanel Grid.Row="3" Grid.Column="0" Margin="5 5 5 5" HorizontalAlignment="Right" Orientation="Horizontal" Height="25" Width="Auto" VerticalAlignment="Center" > <telerik:RadButton x:Name="btSave" IsDefault="True" Width="60" Margin="5 0 5 0" Content="Zapisz" /> <telerik:RadButton x:Name="btOK" IsDefault="True" Width="60" Margin="5 0 5 0" Content="Akceptuj" /> <telerik:RadButton x:Name="btCancel" IsCancel="True" Width="60" Margin="5 0 5 0" Content="Anuluj" /> </StackPanel> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> Please help

    Read the article

  • Silverlight: Binding a custom control to an arbitrary object

    - by Ryan Bates
    I am planning on writing a hierarchical organizational control, similar to an org chart. Several org chart implementations are out there, but not quite fit what I have in mind. Binding fields in a DataTemplate to a custom object does not seem to work. I started with a generic, custom control, i.e. public class NodeBodyBlock : ContentControl { public NodeBodyBlock() { this.DefaultStyleKey = typeof(NodeBodyBlock); } } It has a simple style in generic.xaml: <Style TargetType="org:NodeBodyBlock"> <Setter Property="Width" Value="200" /> <Setter Property="Height" Value="100" /> <Setter Property="Background" Value="Lavender" /> <Setter Property="FontSize" Value="11" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="org:NodeBodyBlock"> <Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" CornerRadius="4" BorderBrush="Black" BorderThickness="1" > <Grid> <VisualStateManager/> ... clipped for brevity </VisualStateManager.VisualStateGroups> <ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> My plan now is to be able to use this common definition as a base definition of sorts, with customized version of it used to display different types of content. A simple example would be to use this on a user control with the following style: <Style TargetType="org:NodeBodyBlock" x:Key="TOCNode2"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=NodeTitle}"/> </StackPanel> </DataTemplate> </Setter.Value> </Setter> </Style> and an instance defined as <org:NodeBodyBlock Style="{StaticResource TOCNode2}" x:Name="stTest" DataContext="{StaticResource DummyData}" /> The DummyData is defined as <toc:Node NodeNumber="mynum" NodeStatus="A" NodeTitle="INLine Node Title!" x:Key="DummyData"/> With a simple C# class behind it, where each of the fields is a public property. When running the app, the Dummy Data values simply do not show up in the GUI. A trivial test such as <TextBlock Text="{Binding NodeTitle}" DataContext="{StaticResource DummyData}"/> works just fine. Any ideas around where I am missing the plot?

    Read the article

  • Windows Phone 7: Building a simple dictionary web client

    - by TechTwaddle
    Like I mentioned in this post a while back, I came across a dictionary web service called Aonaware that serves up word definitions from various dictionaries and is really easy to use. The services page on their website, http://services.aonaware.com/DictService/DictService.asmx, lists all the operations that are supported by the dictionary service. Here they are, Word Dictionary Web Service The following operations are supported. For a formal definition, please review the Service Description. Define Define given word, returning definitions from all dictionaries DefineInDict Define given word, returning definitions from specified dictionary DictionaryInfo Show information about the specified dictionary DictionaryList Returns a list of available dictionaries DictionaryListExtended Returns a list of advanced dictionaries (e.g. translating dictionaries) Match Look for matching words in all dictionaries using the given strategy MatchInDict Look for matching words in the specified dictionary using the given strategy ServerInfo Show remote server information StrategyList Return list of all available strategies on the server Follow the links above to get more information on each API. In this post we will be building a simple windows phone 7 client which uses this service to get word definitions for words entered by the user. The application will also allow the user to select a dictionary from all the available ones and look up the word definition in that dictionary. So of all the apis above we will be using only two, DictionaryList() to get a list of all supported dictionaries and DefineInDict() to get the word definition from a particular dictionary. Before we get started, a note to you all; I would have liked to implement this application using concepts from data binding, item templates, data templates etc. I have a basic understanding of what they are but, being a beginner, I am not very comfortable with those topics yet so I didn’t use them. I thought I’ll get this version out of the way and maybe in the next version I could give those a try. A somewhat scary mock-up of the what the final application will look like, Select Dictionary is a list picker control from the silverlight toolkit (you need to download and install the toolkit if you haven’t already). Below it is a textbox where the user can enter words to look up and a button beside it to fetch the word definition when clicked. Finally we have a textblock which occupies the remaining area and displays the word definition from the selected dictionary. Create a silverlight application for windows phone 7, AonawareDictionaryClient, and add references to the silverlight toolkit and the web service. From the solution explorer right on References and select Microsoft.Phone.Controls.Toolkit from under the .NET tab, Next, add a reference to the web service. Again right click on References and this time select Add Service Reference In the resulting dialog paste the service url in the Address field and press go, (url –> http://services.aonaware.com/DictService/DictService.asmx) once the service is discovered, provide a name for the NameSpace, in this case I’ve called it AonawareDictionaryService. Press OK. You can now use the classes and functions that are generated in the AonawareDictionaryClient.AonawareDictionaryService namespace. Let’s get the UI done now. In MainPage.xaml add a namespace declaration to use the toolkit controls, xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" the content of LayoutRoot is changed as follows, (sorry, no syntax highlighting in this post) <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,5,0,5">     <TextBlock x:Name="ApplicationTitle" Text="AONAWARE DICTIONARY CLIENT" Style="{StaticResource PhoneTextNormalStyle}"/>     <!--<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>--> </StackPanel> <!--ContentPanel - place additional content here--> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">     <Grid.RowDefinitions>         <RowDefinition Height="Auto"/>         <RowDefinition Height="Auto"/>         <RowDefinition Height="*"/>     </Grid.RowDefinitions>     <toolkit:ListPicker Grid.Column="1" x:Name="listPickerDictionaryList"                         Header="Select Dictionary :">     </toolkit:ListPicker>     <Grid Grid.Row="1" Margin="0,5,0,0">         <Grid.ColumnDefinitions>             <ColumnDefinition Width="*"/>             <ColumnDefinition Width="Auto" />         </Grid.ColumnDefinitions>         <TextBox x:Name="txtboxInputWord" Grid.Column="0" GotFocus="OnTextboxInputWordGotFocus" />         <Button x:Name="btnGo" Grid.Column="1" Click="OnButtonGoClick" >             <Button.Content>                 <Image Source="/images/button-go.png"/>             </Button.Content>         </Button>     </Grid>     <ScrollViewer Grid.Row="2" x:Name="scrollViewer">         <TextBlock  Margin="12,5,12,5"  x:Name="txtBlockWordMeaning" HorizontalAlignment="Stretch"                    VerticalAlignment="Stretch" TextWrapping="Wrap"                    FontSize="26" />     </ScrollViewer> </Grid> I have commented out the PageTitle as it occupies too much valuable space, and the ContentPanel is changed to contain three rows. First row contains the list picker control, second row contains the textbox and the button, and the third row contains a textblock within a scroll viewer. The designer will now be showing the final ui, Now go to MainPage.xaml.cs, and add the following namespace declarations, using Microsoft.Phone.Controls; using AonawareDictionaryClient.AonawareDictionaryService; using System.IO.IsolatedStorage; A class called DictServiceSoapClient would have been created for you in the background when you added a reference to the web service. This class functions as a wrapper to the services exported by the web service. All the web service functions that we saw at the start can be access through this class, or more precisely through an object of this class. Create a data member of type DictServiceSoapClient in the Mainpage class, and a function which initializes it, DictServiceSoapClient DictSvcClient = null; private DictServiceSoapClient GetDictServiceSoapClient() {     if (null == DictSvcClient)     {         DictSvcClient = new DictServiceSoapClient();     }     return DictSvcClient; } We have two major tasks remaining. First, when the application loads we need to populate the list picker with all the supported dictionaries and second, when the user enters a word and clicks on the arrow button we need to fetch the word’s meaning. Populating the List Picker In the OnNavigatingTo event of the MainPage, we call the DictionaryList() api. This can also be done in the OnLoading event handler of the MainPage; not sure if one has an advantage over the other. Here’s the code for OnNavigatedTo, protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) {     DictServiceSoapClient client = GetDictServiceSoapClient();     client.DictionaryListCompleted += new EventHandler<DictionaryListCompletedEventArgs>(OnGetDictionaryListCompleted);     client.DictionaryListAsync();     base.OnNavigatedTo(e); } Windows Phone 7 supports only async calls to web services. When we added a reference to the dictionary service, asynchronous versions of all the functions were generated automatically. So in the above function we register a handler to the DictionaryListCompleted event which will occur when the call to DictionaryList() gets a response from the server. Then we call the DictionaryListAsynch() function which is the async version of the DictionaryList() api. The result of this api will be sent to the handler OnGetDictionaryListCompleted(), void OnGetDictionaryListCompleted(object sender, DictionaryListCompletedEventArgs e) {     IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;     Dictionary[] listOfDictionaries;     if (e.Error == null)     {         listOfDictionaries = e.Result;         PopulateListPicker(listOfDictionaries, settings);     }     else if (settings.Contains("SavedDictionaryList"))     {         listOfDictionaries = settings["SavedDictionaryList"] as Dictionary[];         PopulateListPicker(listOfDictionaries, settings);     }     else     {         MessageBoxResult res = MessageBox.Show("An error occured while retrieving dictionary list, do you want to try again?", "Error", MessageBoxButton.OKCancel);         if (MessageBoxResult.OK == res)         {             GetDictServiceSoapClient().DictionaryListAsync();         }     }     settings.Save(); } I have used IsolatedStorageSettings to store a few things; the entire dictionary list and the dictionary that is selected when the user exits the application, so that the next time when the user starts the application the current dictionary is set to the last selected value. First we check if the api returned any error, if the error object is null e.Result will contain the list (actually array) of Dictionary type objects. If there was an error, we check the isolated storage settings to see if there is a dictionary list stored from a previous instance of the application and if so, we populate the list picker based on this saved list. Note that in this case there are chances that the dictionary list might be out of date if there have been changes on the server. Finally, if none of these cases are true, we display an error message to the user and try to fetch the list again. PopulateListPicker() is passed the array of Dictionary objects and the settings object as well, void PopulateListPicker(Dictionary[] listOfDictionaries, IsolatedStorageSettings settings) {     listPickerDictionaryList.Items.Clear();     foreach (Dictionary dictionary in listOfDictionaries)     {         listPickerDictionaryList.Items.Add(dictionary.Name);     }     settings["SavedDictionaryList"] = listOfDictionaries;     string savedDictionaryName;     if (settings.Contains("SavedDictionary"))     {         savedDictionaryName = settings["SavedDictionary"] as string;     }     else     {         savedDictionaryName = "WordNet (r) 2.0"; //default dictionary, wordnet     }     foreach (string dictName in listPickerDictionaryList.Items)     {         if (dictName == savedDictionaryName)         {             listPickerDictionaryList.SelectedItem = dictName;             break;         }     }     settings["SavedDictionary"] = listPickerDictionaryList.SelectedItem as string; } We first clear all the items from the list picker, add the dictionary names from the array and then create a key in the settings called SavedDictionaryList and store the dictionary list in it. We then check if there is saved dictionary available from a previous instance, if there is, we set it as the selected item in the list picker. And if not, we set “WordNet ® 2.0” as the default dictionary. Before returning, we save the selected dictionary in the “SavedDictionary” key of the isolated storage settings. Fetching word definitions Getting this part done is very similar to the above code. We get the input word from the textbox, call into DefineInDictAsync() to fetch the definition and when DefineInDictAsync completes, we get the result and display it in the textblock. Here is the handler for the button click, private void OnButtonGoClick(object sender, RoutedEventArgs e) {     txtBlockWordMeaning.Text = "Please wait..";     IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;     if (txtboxInputWord.Text.Trim().Length <= 0)     {         MessageBox.Show("Please enter a word in the textbox and press 'Go'");     }     else     {         Dictionary[] listOfDictionaries = settings["SavedDictionaryList"] as Dictionary[];         string selectedDictionary = listPickerDictionaryList.SelectedItem.ToString();         string dictId = "wn"; //default dictionary is wordnet (wn is the dict id)         foreach (Dictionary dict in listOfDictionaries)         {             if (dict.Name == selectedDictionary)             {                 dictId = dict.Id;                 break;             }         }         DictServiceSoapClient client = GetDictServiceSoapClient();         client.DefineInDictCompleted += new EventHandler<DefineInDictCompletedEventArgs>(OnDefineInDictCompleted);         client.DefineInDictAsync(dictId, txtboxInputWord.Text.Trim());     } } We validate the input and then select the dictionary id based on the currently selected dictionary. We need the dictionary id because the api DefineInDict() expects the dictionary identifier and not the dictionary name. We could very well have stored the dictionary id in isolated storage settings too. Again, same as before, we register a event handler for the DefineInDictCompleted event and call the DefineInDictAsync() method passing in the dictionary id and the input word. void OnDefineInDictCompleted(object sender, DefineInDictCompletedEventArgs e) {     WordDefinition wd = e.Result;     scrollViewer.ScrollToVerticalOffset(0.0f);     if (wd.Definitions.Length == 0)     {         txtBlockWordMeaning.Text = String.Format("No definitions were found for '{0}' in '{1}'", txtboxInputWord.Text.Trim(), listPickerDictionaryList.SelectedItem.ToString().Trim());     }     else     {         foreach (Definition def in wd.Definitions)         {             string str = def.WordDefinition;             str = str.Replace("  ", " "); //some formatting             txtBlockWordMeaning.Text = str;         }     } } When the api completes, e.Result will contain a WordDefnition object. This class is also generated in the background while adding the service reference. We check the word definitions within this class to see if any results were returned, if not, we display a message to the user in the textblock. If a definition was found the text on the textblock is set to display the definition of the word. Adding final touches, we now need to save the current dictionary when the application exits. A small but useful thing is selecting the entire word in the input textbox when the user selects it. This makes sure that if the user has looked up a definition for a really long word, he doesn’t have to press ‘clear’ too many times to enter the next word, protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e) {     IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;     settings["SavedDictionary"] = listPickerDictionaryList.SelectedItem as string;     settings.Save();     base.OnNavigatingFrom(e); } private void OnTextboxInputWordGotFocus(object sender, RoutedEventArgs e) {     TextBox txtbox = sender as TextBox;     if (txtbox.Text.Trim().Length > 0)     {         txtbox.SelectionStart = 0;         txtbox.SelectionLength = txtbox.Text.Length;     } } OnNavigatingFrom() is called whenever you navigate away from the MainPage, since our application contains only one page that would mean that it is exiting. I leave you with a short video of the application in action, but before that if you have any suggestions on how to make the code better and improve it please do leave a comment. Until next time…

    Read the article

  • WrapPanel doesn't wrap in WPF ListView

    - by Joan Venge
    I am using a ListView with an ItemTemplate like this: <Window.Resources> <DataTemplate x:Key="ItemTemplate"> <WrapPanel Orientation="Horizontal"> <Image Width="50" Height="50" Stretch="Fill" Source="{Binding Cover}"/> <Label Content="{Binding Title}" /> </WrapPanel> </DataTemplate> </Window.Resources> But the Covers do not fill the screen like windows explorer windows. How do I do this? They just get stacked vertically in my version.

    Read the article

  • WPF Check/Uncheck all checkboxes located in a gridview

    - by toni
    Hi! I have a gridview with some columns. One of these columns is checkbox type. Then I have two buttons in my UI, one for check all and another for uncheck all. I would like to check all checkboxes in the column when I press the a button and uncheck all checkboxes when I press the another one. How can I do this? Some snippet code: <... <Classes:SortableListView x:Name="lstViewRutas" ItemsSource="{Binding Source={StaticResource RutasCollectionData}}" ... > <...> <GridViewColumn Header="Activa" Width="50"> <GridViewColumn.CellTemplate> <DataTemplate> <CheckBox x:Name="chkBxF" Click="chkBx_Click" IsChecked="{Binding Path=Activa}" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <...> </Classes:SortableListView> <...> </Page> My data object binding to gridview is: namespace GParts.Classes { public class RutasCollection { /// <summary> /// Colección de datos de la tabla /// </summary> ObservableCollection<RutasData> _RutasCollection; /// <summary> /// Constructor. Crea una nueva instancia tipo ObservableCollection /// de tipo RutasData /// </summary> public RutasCollection() { _RutasCollection = new ObservableCollection<RutasData>(); } /// <summary> /// Retorna el conjunto entero de rutas en la colección /// </summary> public ObservableCollection<RutasData> Get { get { return _RutasCollection; } } /// <summary> /// Retorna el conjunto entero de rutas en la colección /// </summary> /// <returns></returns> public ObservableCollection<RutasData> GetCollection() { return _RutasCollection; } /// <summary> /// Añade un elemento tipo RutasData a la colección /// </summary> /// <param name="hora"></param> public void Add(RutasData ruta) { _RutasCollection.Add(ruta); } /// <summary> /// Elimina un elemento tipo RutasData de la colección /// </summary> /// <param name="ruta"></param> public void Remove(RutasData ruta) { _RutasCollection.Remove(ruta); } /// <summary> /// Elimina todos los registros de la colección /// </summary> public void RemoveAll() { _RutasCollection.Clear(); } /// <summary> /// Inserta un elemento tipo RutasData a la colección /// en la posición rowId establecida /// </summary> /// <param name="rowId"></param> /// <param name="ruta"></param> public void Insert(int rowId, RutasData ruta) { _RutasCollection.Insert(rowId, ruta); } } /// <summary> /// Clase RutasData /// </summary> // Registro tabla interficie pantalla public class RutasData { public int Id { get; set; } public bool Activa { get; set; } public string Ruta { get; set; } } } and in my page loaded event I do this to populate gridview: // Obtiene datos tabla Rutas var tbl_Rutas = Accessor.GetRutasTable(); // This method returns entire table foreach (var ruta in tbl_Rutas) { _RutasCollection.Add(new RutasData { Id = (int) ruta.Id, Ruta = ruta.Ruta, Activa = (bool) ruta.Activa }); } // Enlaza los datos con el objeto proveedor RutasCollection lstViewRutas.ItemsSource = _RutasCollection.GetCollection(); Everything is ok but now I would like to check/uncheck all checkboxes in the gridviewcolumn when I press one button or another. How can I do this? Something like this¿? I receive an error that says I can modify itemsource property. private void btnCheckAll_Click(object sender, RoutedEventArgs e) { // Update data object bind to gridview ObservableCollection<RutasData> listas = _RutasCollection.GetCollection(); foreach (var lst in listas) { ((RutasData)lst).Activa = true; } // Update with new values the UI lstViewRutas.ItemsSource = _RutasCollection.GetCollection(); } Thanks!

    Read the article

  • WPF: how to find an element in a datatemplate from an itemscontrol

    - by EV
    Hi, I have the following problem: the application is using the custom itemscontrol called ToolBox. The elements of a toolbox are called toolboxitems and are custom contentcontrol. Now, the toolbox stores a number of images that are retrieved from a database and displayed. For that I use a datatemplate inside the toolbox control. However, when I try to drag and drop the elements, I don't get the image object but the database component. I thought that I should then traverse the structure to find the Image element. here's the code: Toolbox: public class Toolbox : ItemsControl { private Size defaultItemSize = new Size(65, 65); public Size DefaultItemSize { get { return this.defaultItemSize; } set { this.defaultItemSize = value; } } protected override DependencyObject GetContainerForItemOverride() { return new ToolboxItem(); } protected override bool IsItemItsOwnContainerOverride(object item) { return (item is ToolboxItem); } } ToolBoxItem: public class ToolboxItem : ContentControl { private Point? dragStartPoint = null; static ToolboxItem() { FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(ToolboxItem), new FrameworkPropertyMetadata(typeof(ToolboxItem))); } protected override void OnPreviewMouseDown(MouseButtonEventArgs e) { base.OnPreviewMouseDown(e); this.dragStartPoint = new Point?(e.GetPosition(this)); } public String url { get; private set; } protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.LeftButton != MouseButtonState.Pressed) { this.dragStartPoint = null; } if (this.dragStartPoint.HasValue) { Point position = e.GetPosition(this); if ((SystemParameters.MinimumHorizontalDragDistance <= Math.Abs((double)(position.X - this.dragStartPoint.Value.X))) || (SystemParameters.MinimumVerticalDragDistance <= Math.Abs((double)(position.Y - this.dragStartPoint.Value.Y)))) { string xamlString = XamlWriter.Save(this.Content); MessageBoxResult result = MessageBox.Show(xamlString); DataObject dataObject = new DataObject("DESIGNER_ITEM", xamlString); if (dataObject != null) { DragDrop.DoDragDrop(this, dataObject, DragDropEffects.Copy); } } e.Handled = true; } } private childItem FindVisualChild<childItem>(DependencyObject obj) where childItem : DependencyObject { for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { DependencyObject child = VisualTreeHelper.GetChild(obj, i); if (child != null && child is childItem) return (childItem)child; else { childItem childOfChild = FindVisualChild<childItem>(child); if (childOfChild != null) return childOfChild; } } return null; } } here is the xaml file for ToolBox and toolbox item: <Style TargetType="{x:Type s:ToolboxItem}"> <Setter Property="Control.Padding" Value="5" /> <Setter Property="ContentControl.HorizontalContentAlignment" Value="Stretch" /> <Setter Property="ContentControl.VerticalContentAlignment" Value="Stretch" /> <Setter Property="ToolTip" Value="{Binding ToolTip}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type s:ToolboxItem}"> <Grid> <Rectangle Name="Border" StrokeThickness="1" StrokeDashArray="2" Fill="Transparent" SnapsToDevicePixels="true" /> <ContentPresenter Content="{TemplateBinding ContentControl.Content}" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" ContentTemplate="{TemplateBinding ContentTemplate}"/> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter TargetName="Border" Property="Stroke" Value="Gray" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type s:Toolbox}"> <Setter Property="SnapsToDevicePixels" Value="true" /> <Setter Property="Focusable" Value="False" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Border BorderThickness="{TemplateBinding Border.BorderThickness}" Padding="{TemplateBinding Control.Padding}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" SnapsToDevicePixels="True"> <ScrollViewer VerticalScrollBarVisibility="Auto"> <ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" /> </ScrollViewer> </Border> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <WrapPanel Margin="0,5,0,5" ItemHeight="{Binding Path=DefaultItemSize.Height, RelativeSource={RelativeSource AncestorType=s:Toolbox}}" ItemWidth="{Binding Path=DefaultItemSize.Width, RelativeSource={RelativeSource AncestorType=s:Toolbox}}" /> </ItemsPanelTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> Example usage: <Toolbox x:Name="NewLibrary" DefaultItemSize="55,55" ItemsSource="{Binding}" > <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel> <Image Source="{Binding Path=url}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </Toolbox> The object that I get is a database object. When using a static resource I get the Image object. How to retrieve this Image object from a datatemplate? I though that I could use this tutorial: http://msdn.microsoft.com/en-us/library/bb613579.aspx But it does not seem to solve the problem. Could anyone suggest a solution? Thanks!

    Read the article

  • [Silverlight, Navigation] Layout of elements added to a tabcontrol on a different navigation page wr

    - by sinni800
    Hello, I am developing a Silverlight client using the provided navigation template for an imageboard I developed. I have a "search" tab which lists all searches for tags which were executed. I also have a show post tab which shows (also in tab-form) posts, opened from the search tab. When I open a post from the search page, it instanciates a new control (of type UserControl) and inserts this into the ShowPost page's tabcontrol. When I switch (or get switched) to the Show Post view the layout is all messed up. The UserControl inside the tab does not stretch in the tab. When I switch tabs back and forth this is strangely fixed. The reason seems to be that the user control gets created there but has no layout to "fit to" until said layout is opened, which is too late then. You can see it here: http://aspbooru.tk/Silverlight/UI.aspx Thank you in advance...

    Read the article

  • How can I center a Silverlight DataGridTemplateColumn header?

    - by Mike Pateras
    I want to center the header on a Silverlight DataGridTemplateColumn. The following code gets me most of the way there: DataGridTemplateColumn column = new DataGridTemplateColumn(); column.CellTemplate = Resources[templateName] as DataTemplate; column.Header = headerName; column.HeaderStyle = new Style { TargetType = typeof(DataGridColumnHeader) }; column.HeaderStyle.Setters.Add(new Setter(DataGridColumnHeader.HorizontalAlignmentProperty, HorizontalAlignment.Center)); The header is, indeed, centered, but if the column is expanded, the header doesn't stretch. It just remains it's original width, leaving white gaps on either side of it, which looks terrible. What is the proper way to center the column header, such that it still occupies the full width?

    Read the article

  • Problems with sticky footer - CSS - main content wont go 100% height (float)

    - by Jamie
    I'm trying to implement hxxp://www.cssstickyfooter.com however I am having a few problems! See screenshot: hxxp://img22.imageshack.us/img22/2654/71161106.jpg The div "Content" contains both left and right columns. On smaller resolutions this is working as expected however once the user starts to increase there resolution the content doesn't expand as I intend it to. If you notice the blue box. That should stretch to the footer at the bottom of the page. If you notice that the blue divider line (right_container3-4) stops also at the same point. CODE HTML: hxxp://tinyurl.com/m39x52 CSS: hxxp://tinyurl.com/lb62ej I would apriciate any help at all! I've been racking my brains for ages on this one, its just a small site so I suppose it's not too much of an issue. But it's nice to know all the same! Thankyou P.S. Sorry about the URL formatting

    Read the article

  • Scale a Visual Brush Background WPF

    - by user279244
    Hello, I have a Item called MiniMap in my xaml. I have set the background of it to a visual brush representting a canvas Item. Now, I want to scale the background to a ratio 0.7 . How can I do it? Thanks in advance <local:MiniMap Width="201" Height="134" x:Name="MiniMapItem" MinHeight="100" MinWidth="100" Opacity="1" SnapsToDevicePixels="True" Margin="0,0,20,20" VerticalAlignment="Bottom" HorizontalAlignment="Right"> <local:MiniMap.Background> <VisualBrush Visual="{Binding ElementName=viewport}" Stretch="None" TileMode="None" AlignmentX="Left" AlignmentY="Top" /> </local:MiniMap.Background> </local:MiniMap>

    Read the article

  • How to set a RichTextBox in Silverlight 4 to fit it's parent height and maintain it on resize?

    - by Ivan Zlatanov
    I am having hard times figuring this out. Here is what I need: <StackPanel x:Name="container" VerticalAlignment="Stretch"> <RichTextBox Height="???" /> </StackPanel> Basically what I know I can do is to bind RichTextBox Height to it's parent's height ( Height="{Binding ElementName=container, Path=ActualHeight}". Unfortunately this only works on load, because as it seems ActualHeight and ActualWidth don't notify for changes. So what is the best way in Silverlight 4 to tell RichTextBox or TextBlock, it doesn't matter, to fill it's parent height, and maintain scrollbar if it's content height is bigger. Is the only way to bind some Resize events and maintain the height explicitly? That seems really ugly to me?

    Read the article

  • How to set the image into fit screen in the image view

    - by Pugal Devan
    Hi, I am new to iphone development. I want to display the actual size of the image in image view. I have created image view by using Interface builder and set the properties. Now the problem is, I have set into "Scale to Fill", then the image will be stretched in the full screen. Now i want to display the actual size of the image will be displayed in image view. For example 52X52 size image should be displayed with the same size in the image view.The 1200X1020 size image should be fit to the size of the image view .So according the size of the image it should fit to image view and i want the image smaller than image view should retain its original size(It should not stretch to fit the image view). Is it any possible solution to achieve it, please guide me. Thanks.

    Read the article

  • Intersection point in silverlight/wpf

    - by Andrei Neagu
    Hello, Given a path like this one : <Path Stretch="Fill" Stroke="#FFD69436" Data="M 0,20 L 22.3,20 L 34,0 L 44.7,20 L 68,20 L 55.8,40 L 68,60 L 44.7,60 L 34,80 L 22.3,60 L 0,60 L 11.16,40 L 0,20 Z"> <Path.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush.GradientStops> <GradientStop Color="#FFFFFF" Offset="0" /> <GradientStop Color="Orange" Offset="1" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Path.Fill> </Path> How can I get the point that is at the edge of this figure at any angle? Lets say that I want the intersection point between the edge of this figure and a line passing through the center of this figure, at the 30 degrees angle with the OX axe? thanks.

    Read the article

  • Bound Command not firing on another viewModel? What Am I doing wrong?

    - by devnet247
    Hi I cannot seem to bind a command to a button.I have a treeview on the left showing Country City etc.. And I tabcontrol on the right. do I This uses 4 viewModels rootviewModel-ContinentViewModel-CountryViewModel-CityViewModel What I am building is based on http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx Now on one of the tabs I have a Toolbar with a button "TestButton" that I have mapped in zaml. This does not fire! The reason is not firing is because I m binding the RootViewModel but the command that is bound in zaml is in the cityViewModel. How Do I pass the datacontext from one view to the other? or how do I make the button fire. I need the command to be in the cityViewModel. Any Suggestions on how I bind it? View "WorldExplorerView" where I bind the main DataContext public partial class WorldExplorerView { public WorldExplorerView() { InitializeComponent(); var continents = Database.GetContinents(); var rootViewModel = new RootViewModel(continents); DataContext = rootViewModel; } } CityViewModel public class CityViewModel : TreeViewItemViewModel { private City _city; private RelayCommand _testCommand; public CityViewModel(City city, CountryViewModel countryViewModel):base(countryViewModel,false) { _city = city; } Properties etc...... public ICommand TestCommand { get { if(_testCommand==null) { _testCommand = new RelayCommand(param => GetTestCommand(), param => CanCallTestCommand); ; } return _testCommand; } } protected bool CanCallTestCommand { get { return true; } } private static void GetTestCommand() { MessageBox.Show("It works"); } } ZAML <DockPanel> <DockPanel LastChildFill="True"> <Label DockPanel.Dock="top" Content="Title " HorizontalAlignment="Center"></Label> <StatusBar DockPanel.Dock="Bottom"> <StatusBarItem Content="Status Bar" ></StatusBarItem> </StatusBar> <Grid DockPanel.Dock="Top"> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="2*"/> </Grid.ColumnDefinitions> <TreeView Name="tree" ItemsSource="{Binding Continents}"> <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="{Binding IsExpanded,Mode=TwoWay}"/> <Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay}"/> <Setter Property="FontWeight" Value="Normal"/> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="FontWeight" Value="Bold"></Setter> </Trigger> </Style.Triggers> </Style> </TreeView.ItemContainerStyle> <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type ViewModels:ContinentViewModel}" ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\Continent.png"/> <TextBlock Text="{Binding ContinentName}"/> </StackPanel> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="{x:Type ViewModels:CountryViewModel}" ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\Country.png"/> <TextBlock Text="{Binding CountryName}"/> </StackPanel> </HierarchicalDataTemplate> <DataTemplate DataType="{x:Type ViewModels:CityViewModel}" > <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\City.png"/> <TextBlock Text="{Binding CityName}"/> </StackPanel> </DataTemplate> </TreeView.Resources> </TreeView> <GridSplitter Grid.Row="0" Grid.Column="1" Background="LightGray" Width="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> <Grid Grid.Column="2" Margin="5" > <TabControl> <TabItem Header="Demo"> <DockPanel LastChildFill="True"> <ToolBar DockPanel.Dock="Top"> <!-- DOES NOT WORK--> <Button Name="btnTest" Command="{Binding TestCommand}" Content="Press me see if works"></Button> </ToolBar> <TextBox></TextBox> </DockPanel> </TabItem> <TabItem Header="Details" DataContext="{Binding Path=SelectedItem.City, ElementName=tree, Mode=OneWay}"> <StackPanel > <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding CityName}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Area}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Population}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding CityDetailsInfo.ClubsCount}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding CityDetailsInfo.PubsCount}"/> </StackPanel> </TabItem> </TabControl> </Grid> </Grid> </DockPanel> </DockPanel>

    Read the article

  • DataGrid rendering fails

    - by patryk.beza
    I have DataGrid with groups of data. The problem is that after binding data I have strange effect (text was blured by me; the problem are cells' paddings/margins). This effect can be easily 'fixed' by user because after one click on top expander data hides and after second click on the expander, rows in DataGrid are displayed correctly. My XAML code: <DataGrid Name="myDataGrid" Grid.Row="0" ItemsSource="{Binding}" AutoGenerateColumns="False" Background="White" RowBackground="#FBFFFA" AlternatingRowBackground="#EEFAEB" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <DataGrid.Columns> <!-- Columns definitions with binding ( . . . ) --> </DataGrid.Columns> <DataGrid.CellStyle> <Style TargetType="{x:Type DataGridCell}"> <Setter Property="Padding" Value="7,3"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataGridCell}"> <Border Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" /> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="DataGridCell.IsSelected" Value="True"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush EndPoint="0.504,1.5" StartPoint="0.504,0.03"> <GradientStop Color="#008C13" Offset="0"/> <GradientStop Color="#19FF38" Offset="0.8"/> </LinearGradientBrush> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> </DataGrid.CellStyle> <DataGrid.GroupStyle> <GroupStyle> <GroupStyle.HeaderTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=Name}" FontWeight="Bold" Padding="3" /> </StackPanel> </DataTemplate> </GroupStyle.HeaderTemplate> <GroupStyle.ContainerStyle> <Style TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}"> <Expander> <Expander.Header> <StackPanel Orientation="Horizontal"> <TextBlock Text="Rok " /> <TextBlock Text="{Binding Name}" /> </StackPanel> </Expander.Header> <ItemsPresenter /> </Expander> </ControlTemplate> </Setter.Value> </Setter> </Style> </GroupStyle.ContainerStyle> </GroupStyle> </DataGrid.GroupStyle> </DataGrid> DataGrid's DataContext is set from code (rows with data in DataGrid are displayed after clicking proper button): ICollectionView myView = CollectionViewSource.GetDefaultView(myList); if (operationsView.GroupDescriptions.Count > 0) operationsView.GroupDescriptions.Clear(); operationsView.GroupDescriptions.Add(new PropertyGroupDescription("myGroupDescProperty")); FinancialIncomeOperationsListDataGrid.DataContext = operationsView; Is there any way to manually update layout of the DataGrid? Or maybe there is a better solution?

    Read the article

  • Custom background for UINavigationBar in landcape mode

    - by lostInTransit
    Hi I am adding a custom background for my UINavigationBar. It works fine as long as the phone is in portrait mode. As soon as I switch to landscape mode, half the bar appears blue (the default navbar color) and half of it has my image How can I stretch the image for landscape mode and make it small again for portrait mode? Thanks Solution Incase anyone is looking for an answer to how to add an image to navigation bar - here goes UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 480.0, 44.0)]; [imgView setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"navbar_landscape" ofType:@"png"]]]; [navigationController.navigationBar addSubview:imgView]; [imgView release];

    Read the article

  • WPF Lookless Control Events

    - by Scott
    I have the following class: public class LooklessControl : Control { public List<int> IntList { get; private set; } public int CurrentInt { get; private set; } private int _index = 0; static LooklessControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(LooklessControl), new FrameworkPropertyMetadata(typeof(LooklessControl))); } public LooklessControl() { IntList = new List<int>(); for (int i = 0; i < 10; i++) { IntList.Add(i); } CurrentInt = IntList[_index]; } public static readonly RoutedCommand NextItemCommand = new RoutedCommand("NextItemCommand", typeof(LooklessControl)); private void ExecutedNextItemCommand(object sender, ExecutedRoutedEventArgs e) { NextItemHandler(); } private void CanExecuteNextItemCommand(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; } public static readonly RoutedCommand PrevItemCommand = new RoutedCommand("PrevItemCommand", typeof(LooklessControl)); private void ExecutedPrevItemCommand(ExecutedRoutedEventArgs e) { PrevItemHandler(); } private void CanExecutePrevItemCommand(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; } public static readonly RoutedEvent NextItemEvent = EventManager.RegisterRoutedEvent("NextItemEvent", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(LooklessControl)); public event RoutedEventHandler NextItem { add { AddHandler(NextItemEvent, value); } remove { RemoveHandler(NextItemEvent, value); } } private void RaiseNextItemEvent() { RoutedEventArgs args = new RoutedEventArgs(LooklessControl.NextItemEvent); RaiseEvent(args); } public static readonly RoutedEvent PrevItemEvent = EventManager.RegisterRoutedEvent("PrevItemEvent", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(LooklessControl)); public event RoutedEventHandler PrevItem { add { AddHandler(PrevItemEvent, value); } remove { RemoveHandler(PrevItemEvent, value); } } private void RaisePrevItemEvent() { RoutedEventArgs args = new RoutedEventArgs(LooklessControl.PrevItemEvent); RaiseEvent(args); } private void NextItemHandler() { _index++; if (_index == IntList.Count) { _index = 0; } CurrentInt = IntList[_index]; RaiseNextItemEvent(); } private void PrevItemHandler() { _index--; if (_index == 0) { _index = IntList.Count - 1; } CurrentInt = IntList[_index]; RaisePrevItemEvent(); } } The class has a default style, in Generic.xaml, that looks like this: <Style x:Key="{x:Type local:LooklessControl}" TargetType="{x:Type local:LooklessControl}"> <Setter Property="Height" Value="200"/> <Setter Property="Width" Value="90"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:LooklessControl}"> <Border BorderBrush="Black" BorderThickness="1" Padding="2"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="20"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Rectangle Grid.Row="0" Fill="LightGray"/> <Rectangle Grid.Row="1" Fill="Gainsboro"/> <Grid Grid.Row="0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="10"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="10"/> </Grid.ColumnDefinitions> <Path Grid.Column="0" x:Name="pathLeftArrow" Data="M0,0.5 L1,1 1,0Z" Width="6" Height="14" Stretch="Fill" HorizontalAlignment="Center" Fill="SlateBlue"/> <TextBlock Grid.Column="1" Name="textBlock" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CurrentInt}" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Junction" FontSize="13"/> <Path Grid.Column="2" x:Name="pathRightArrow" Data="M0,0 L1,0.5 0,1Z" Width="6" Height="14" Stretch="Fill" HorizontalAlignment="Center" Fill="SlateBlue"/> </Grid> <ListBox Grid.Row="1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Background="Transparent" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IntList}"/> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> How do I make it so that when the user clicks on pathLeftArrow it fires LooklessControl.PrevItemCommand, or or they click on pathRightArrow and it fires LooklessControl.NextItemCommand, or they click on an item in the ListBox and LooklessControl is notified of the newly selected item? In other words, without adding x:Class to the top of Generic.xaml and thus creating a code-behind file for it, which I assume you wouldn't want to do, how do you handle events for elements in your xaml that don't have a Command property (which is just about everything other than a Button)? Should LooklessControl have it's own XAML file (much like what you get when you create a new UserControl) associated with it that Generic.xaml just pulls in as a MergedDictionar as its default template? Or is there some other acknowledged way to do what I'm trying to do?

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >