Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all 18858 articles
Browse latest View live

Unable to cast object of type 'MS.Internal.Controls.AddInHost' to type 'System.Windows.Controls.UserControl'

$
0
0

Hi,

I am facing problem for implementing WPF addin framework in my application. In my application, I have to create instance of Usercontrol into separate appdomain and pass the reference to host application which is running into another appdomain

I have created usercontrol instance separate appdomain and cast it to "System.Windows.FrameworkElement" as per addin framework guideline and I am able to pass reference of framework instance into host application. But when I am trying to convert FrameWorkElement into usercontrol in hostapplication appdomain, I am getting exception  "Unable to cast object of type 'MS.Internal.Controls.AddInHost' to type 'System.Windows.Controls.UserControl'."

Can any one please tell me whether it is possible to convert Framework element into userControl.

Regards

Tihomir Blagoev

Visual Studio 2015 and PRISM compatibility issue

$
0
0

I downloaded the Microsoft Patterns & Practices sample code for Prism Interactivity.

http://www.microsoft.com/en-us/download/details.aspx?id=42537

If I open this project with Visual Studio 2013, and open up the InteractionRequestView.xaml, everything looks fine.  I can see the UserControl in the designer and no errors.  Also I can build and run without a problem.

If I open this project with Visual Studio 2015, and open up the InteractionRequestView.xaml, I cannot see the design-time of the UserControl.  It states Invalid Markup.  If I look at the errors panel, it shows that on the line

<prism:InteractionRequestTrigger SourceObject="{Binding RequestShowConfiguration, Mode=OneWay}">

has an error that states:  "The local property 'Actions' can only be applied to types that are derived from 'TriggerBase'.  The code still compiles and runs correctly.  This would not be much of an issue as it would an annoyance, if it were not for the fact that the designer does not load because of 'invalid markup'.

Does anyone know how to fix this issue?  Is anyone else having the issue?  The code is obviously correct, since it runs.  All I can determine is there is some issue in the IDE.

Thanks,

Michael

GlyphTypeface alignment box

$
0
0

Hello,

from the documentation:

The LeftSideBearings value is positive when the left edge of the black box is within the alignment rectangle defined by the advance width and font cell height.

The LeftSideBearings value is negative when the left edge of the black box overhangs the alignment rectangle.

I assumed that the black box is what I get from GlyphRun.ComputeInkBoundingBox() initialized to the glyph index in question.

However, the left side bearing + ink bounding box width + right side bearing do not add to the glyphs'advance width as returned by GlyphTypeface.AdvanceWidths.

How should the glyph be aligned inside the alignment rectangle then?

Thanks,
Jan

Add a combo box at runtime in datagrid cell in wpf

$
0
0
Hi,

How can we add a combo box at runtime in datagrid cell in wpf. I have tried some ways but i am not able to do so.

Vishal Kumar Singh

Printing Windows Presentation Foundations

$
0
0

Hello, I am new to visual basic in general. I've been self teaching everything I know so far(Only been doing this for two or so weeks).

I currently am using Visual Studio 2015 Express with .NET Framework 4.5.2 using a WPF application. Instead of using a window for my host, I am using individual pages I am creating and hosting in the main window.

I can't figure out how to scale everything on my screen to fit into a single page to print. I found out how to print earlier this week, however it prints only top left hand corner of the page and the rest is cut off. 

Thanks,

Brad

Why binding of Grid ColumnDefinition's Width inside a DataTemplate is not working

$
0
0

Hi,

Do you have any idea why the Grid.ColumnDefinition's Width within DataTemplate is not working and how I can fix this?

Here is the line of code: 

<UserControl.Resources><DataTemplate x:Key="datatemplate_opencompany_itemx"><!-- template for the items in the OpenCompany List. The Background/ container is defined elsewhere, we define the bindings and textfield (so, only content) here.--><Grid Background="Transparent" Height="Auto" Width="Auto"><Grid.ColumnDefinitions><ColumnDefinition Width="{Binding WidthLength}"/><ColumnDefinition Width="*"/><ColumnDefinition Width="25"/></Grid.ColumnDefinitions><Border HorizontalAlignment="Stretch" Padding="4" VerticalAlignment="Stretch" d:LayoutOverrides="Width" CornerRadius="{DynamicResource cornerRadius_default}" Margin="2,1,4,1" BorderThickness="1" SnapsToDevicePixels="True" Height="22"><Border.Background><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="{Binding Company, ConverterParameter=B, Converter={StaticResource CompanyColorConverter}}" Offset="1"/><GradientStop Color="{Binding Company, ConverterParameter=Neutral, Converter={StaticResource CompanyColorConverter}}"/></LinearGradientBrush></Border.Background><Border.BorderBrush><LinearGradientBrush><!-- Workaround, for some reason a solidcolorbrush with bindings to the company color do not show up. So we'll just create a gradient from and to
					the very same color. Which works just fine.--><GradientStop Color="{Binding Company, ConverterParameter=Line, Converter={StaticResource CompanyColorConverter}}" Offset="1"/><GradientStop Color="{Binding Company, ConverterParameter=Line, Converter={StaticResource CompanyColorConverter}}"/></LinearGradientBrush></Border.BorderBrush><!--PBI 90848: Changed the Company.Number to Company.Database to display the database name instead of company number--><TextBlock Text="{Binding Company.Database}" Width="Auto" Foreground="White" VerticalAlignment="Center" FontFamily="{DynamicResource font_default}" FontSize="12" FontWeight="Bold" HorizontalAlignment="Left"/></Border><controls:ExtendedTextBlock Text="{Binding Company.Name}" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontFamily="{DynamicResource font_default}" FontSize="12" Grid.Column="1"/><Button x:Name="button" ToolTip="{Binding RemoveText}" cal:Message.Attach="[Event Click]=[Action DeleteCompanyCommand]" HorizontalAlignment="Center" Grid.Column="2" Template="{DynamicResource button_small_flat}" Visibility="Collapsed" VerticalAlignment="Center" ><Path Data="{DynamicResource icon_cross}" Height="12" Stretch="Fill" Width="12" Fill="{DynamicResource solid_red}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2"/></Button></Grid><DataTemplate.Triggers><Trigger Property="IsMouseOver" Value="True"><!-- the delete button should only be show  on a MouseOver --><Setter Property="Visibility" TargetName="button" Value="Visible"/></Trigger></DataTemplate.Triggers></DataTemplate></UserControl.Resources>

If you can notice in this line of code, I binded the width length to the WidthLength property from the ModelView.

<Grid.ColumnDefinitions><ColumnDefinition Width="{Binding WidthLength}"/><ColumnDefinition Width="*"/><ColumnDefinition Width="25"/></Grid.ColumnDefinitions>
        public GridLength WidthLength
        {
            get { return _widthLength; }
            set
            {
                if (value != _widthLength)
                {
                    _widthLength = value;
                    NotifyOfPropertyChange(() => WidthLength);
                }
            }
        }

I tried this binding approach outside the DataTemplate and it is working properly.

Any suggestions?

Thank you!

What reference books do you recommend for MVVM Light?

$
0
0

I'm currently going through the "MVVM Light Toolkit Fundamentals" Pluralsight course taught by Laurent Bugnion. It is excellent and I'm learning lots about MVVM Light. However certain concepts, like Messenger are hard for me to get my arms around. I'm sure it will come more naturally once I start working on our WPF app where we'll be using MVVM Light as the MVVM framework (yes I know Laurent doesn't consider MVVM Light a framework; I'm just using that as a convenient term for now).

So what I'm wondering is this; are there any books or reference material that I could use and refer to, while trying to implement MVVM Light in our next project? I'm the type of person for whom watching online training videos, although great at getting me introduced to a new concept, doesn't get me 100% there. I need a reference and I find a book as being helpful.


Rod

wpf Richtextbox isses with linebreak

$
0
0

I have a simple wpf application which has a RichTextBox.

This is the code.

privatevoidInitializeContent(){FlowDocument document =newFlowDocument();LineBreak b =newLineBreak();Paragraph p1 =newParagraph(); p1.Inlines.Add("line One"); p1.Inlines.Add(newLineBreak()); p1.Inlines.Add("line two"); p1.Inlines.Add(newLineBreak()); p1.Inlines.Add("line three"); p1.Inlines.Add(newLineBreak()); p1.Inlines.Add("line Four"); p1.Inlines.Add(newLineBreak()); document.Blocks.Add(p1);MyTextBox.Document= document;}

This is how the output looks:

line one
line two
line three
line four

Change the keyboard default input language to japanese and try typing some text like "アbc" by setting input mode to Half-width-katakana before "line" in second line. But it types in line 1 i.e after "line one" instead.

What is expected:
line one
アbcline two
line three
line four

What is I am seeing:
line oneアbc
line two
line three
line four

Changing LineBreak to Environment.NewLine works which I don't want to do.



WPF - DataGrid

$
0
0

Hi folks,

I want to update the entire rows of datagrid in wpf application, that would be happen after edited the cell and checked(true) the check box. Please send the reference code for this problem.

WPF DATAGRIDTEMPLATECOLUMN CHECKBOX BINDING ISSUE

$
0
0

Hi All,

I have a WPF Datagrid in my view bound to ObservableCollection(say MergeEntityColl)  present in my viewmodel. This datagrid also has one checkbox column as DataGridTemplateColumn(needed for my req.uirement)  with below XAML:

<DataGrid ItemsSource="{Binding MergeEntityColl}" AutoGenerateColumns="False" CanUserAddRows="False" x:Name="TransTypesGrid"><DataGrid.Columns><DataGridTemplateColumn><DataGridTemplateColumn.CellTemplate><DataTemplate><StackPanel><CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
.......................................................................................</StackPanel></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn><DataGridTextColumn Header="TestHeader" Binding="{Binding Test11}" /></DataGrid.Columns>

As shown above Checkbox.Ischecked bound to IsSelected property of ObservableCollection "MergeEntityColl". In my view I have one button to select/check all the checkboxes present for records present in datagrid and one another button to deselect/uncheck all the checboxes.

Now on "Select All" command, I loop through this MergeEntityColl and assign IsSelected property  = True but this is not getting reflected in view. The Checkboxes are not getting checked/selected. Similar thing happens with deselect/uncheck all command.

Please help me in achieving above functionality. Thanks in advance.

Regards,

Pratham  

populate wpf textbox from listbox selected item - MVVM

$
0
0

Hello,
I am working on WPF MVVM...
The window has a listbox which is populated with FullNames of students
The bit I need help on is when you click on a name in the listbox then the textboxes to be populated with FirstName in textbox1 and textbox2 with Address1 fields

This is what I am doing so far but DetailData does not seem to be populating...

//frmDetailsTest<Window x:Class="Rustam.frmDetailsTest"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="frmDetailsTest" Height="501.6" Width="455.686"
        xmlns:scr="clr-namespace:Rustam"
        Loaded="Window_Loaded"><Window.Resources><scr:clsStudentViewModel x:Key="StudentViewModel"/></Window.Resources><Grid Margin="0,0,5.2,-0.2"
          DataContext="{Binding Source={StaticResource StudentViewModel}}"><StackPanel Orientation="Vertical"><ListBox Name="lstNames"
                 ItemsSource="{Binding Path=DataCollection}"
                 SelectedValuePath="StudentID"
                 DisplayMemberPath="FullName"
                 HorizontalAlignment="Left" Height="253" Margin="10,10,0,0" VerticalAlignment="Top" Width="236" SelectionChanged="lstNames_SelectionChanged" Grid.ColumnSpan="7"></ListBox><Grid Grid.Row="2"
                  Margin="5,5,4.6,5"
                  x:Name="grdDetail"
                   Height="166"
                  DataContext="{Binding Path=DetailData}"><Grid.RowDefinitions><RowDefinition Height="Auto" /><RowDefinition Height="Auto" /></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width="120"></ColumnDefinition><ColumnDefinition Width="*"></ColumnDefinition></Grid.ColumnDefinitions><TextBox
                    Text="{Binding Path=Address1, Mode=TwoWay}"
                    Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,9.2,0,-30.6" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/><TextBox
                    Text="{Binding Path=FirstName, Mode=TwoWay}"
                    Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,37.2,0,-57" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/></Grid></StackPanel></Grid></Window>
using System.Data;
using System.Data.SqlClient;
using System.ComponentModel;
using System.Collections.ObjectModel;
using DataAccess;

namespace Rustam
{
    public class clsStudentViewModel : INotifyPropertyChanged
    {
        clsStudentAccess _DataManager = new clsStudentAccess();

        #region Constructor - Initialize Product Data Collection
        public clsStudentViewModel()
        {
            DataCollection = _DataManager.GetStudentNamesCol();
        }
        #endregion

        #region INotifyPropertyChanged
        public event PropertyChangedEventHandler PropertyChanged;
        protected void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                PropertyChangedEventArgs args = new PropertyChangedEventArgs(propertyName);

                // Raise the PropertyChanged event.
                handler(this, args);
            }
        }
        #endregion

        #region DataCollection Property
        private ObservableCollection<clsStudentDetails> _DataCollection;

        public ObservableCollection<clsStudentDetails> DataCollection
        {
            get { return _DataCollection; }
            set
            {
                _DataCollection = value;
                RaisePropertyChanged("DataCollection");
            }
        }
        #endregion

        #region DetailData Property
        private clsStudentDetails mDetailData;

        public clsStudentDetails DetailData
        {
            get { return mDetailData; }
            set
            {
                mDetailData = value;
                RaisePropertyChanged("DetailData");
            }
        }
        #endregion
}

-----------------------------------------------------------------------
-----------------------------------------------------------------------
--------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace DataAccess
{
    public class clsStudentAccess
    {
        public ObservableCollection<clsStudentDetails> GetStudentNamesCol()
        {
            ObservableCollection<clsStudentDetails> ret = new ObservableCollection<clsStudentDetails>();

            // get a configured DbCommand object
            DbCommand comm = clsGenericDataAccess.CreateCommand();
            // set the stored procedure name
            comm.CommandText = "uspGetAllStudentNames";
            // execute the stored procedure and return the results
            DataTable table = new DataTable();
            table = clsGenericDataAccess.ExecuteSelectCommand(comm);

            if (table.Rows.Count > 0)
            {
                foreach (DataRow dr in table.Rows)
                {
                    clsStudentDetails student = new clsStudentDetails();

                    student.StudentID = int.Parse(dr["StudentID"].ToString());
                    student.FullName = dr["FullName"].ToString();

                    ret.Add(student);
                }
            }

            return ret;
        }


public clsStudentDetails GetStudentDetailsUniqueMVVM(int intStudentID)
        {
            DbCommand comm = clsGenericDataAccess.CreateCommand();
            comm.CommandText = "uspGetStudentDetailsUnique";

            DbParameter param = comm.CreateParameter();
            if (intStudentID > 0)
            {
                param.ParameterName = "@StudentID";
                param.Value = intStudentID;
                param.DbType = DbType.Int32;
                comm.Parameters.Add(param);
            }

            DataTable table = new DataTable();
            table = clsGenericDataAccess.ExecuteSelectCommand(comm);
            clsStudentDetails details = new clsStudentDetails();
            if (table.Rows.Count > 0)
            {
                details.FirstName = table.Rows[0]["FirstName"].ToString();
                details.Address1 = table.Rows[0]["Address1"].ToString();
            }

            return details;
        }
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace DataAccess
{
    public class clsStudentDetails : INotifyPropertyChanged
    {

        #region INotifyPropertyChanged
        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        #endregion

        private int _StudentID;
        public int StudentID
        {
            get { return _StudentID; }
            set
            {
                if (_StudentID != value)
                {
                    _StudentID = value;
                    RaisePropertyChanged("StudentID");
                }
            }
        }

        private string _FullName;
        public string FullName
        {
            get { return _FullName; }
            set
            {
                if (_FullName != value)
                {
                    _FullName = value;
                    RaisePropertyChanged("FullName");
                }
            }
        }

        private string _FirstName;
        public string FirstName
        {
            get { return _FirstName; }
            set
            {
                if (_FirstName != value)
                {
                    _FullName = value;
                    RaisePropertyChanged("FirstName");
                }
            }
        }

        private string _Address1;
        public string Address1
        {
            get { return _Address1; }
            set
            {
                if (_Address1 != value)
                {
                    _Address1 = value;
                    RaisePropertyChanged("Address1");
                }
            }
        }
    }
}


WPF Writeable Bitmap Memory Leak?

$
0
0
Hello, everyone!

I'm trying to figure out how to release a WriteableBitmap memory.

In the next section of code I fill the backbuffer of a WriteableBitmap with a really large amount of data from "BigImage" (3600 * 4800 px, just for testing)
If I comment the lines where bitmap and image are equaled to null, the memory it´s not release and the application consumes ~230 MB, even
when Image and bitmap are no longer used!

As you can see at the end of the code its necessary to call GC.Collect() to release the memory.

Any help would be great.

PS. Sorry for my bad english.

private void buttonTest_Click(object sender, RoutedEventArgs e)
{
            Image image = new Image();
            image.Source = new BitmapImage(new Uri("BigImage"));

            WriteableBitmap bitmap = new WriteableBitmap(
                (BitmapSource)image.Source);

            bitmap.Lock();


bitmap.Unlock(); image = null; bitmap = null; GC.Collect(); }

Unhandled NullRreference exception just after creating new project

$
0
0

I got this exception when I just created a new UWP Project with C# language

System.NullReferenceException Object reference not set to an instance of an object.

at Microsoft.VisualStudio.DesignTools.Platform.Metadata.MetadataStore.GetTypeConverter(Type type) at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties.ResolveImplementation(IPlatformMetadata platformMetadata, DesignTimePropertyId neutralProperty, IType declaringType, PropertyChangedCallback callback) at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties.RegisterProperty(IPropertyId neutralPropertyKey, IType declaringType, PropertyChangedCallback callback) at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlCommonDesignTimeProperties.Initialize(WindowsUIXamlDesignTimeProperties designTimeProperties) at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties..ctor(IPlatformTypes platformMetadata) at Microsoft.VisualStudio.DesignTools.UniversalXamlDesigner.UniversalXamlPlatformMetadata.CreateDesignTimeProperties() at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.Metadata.WindowsUIXamlPlatformMetadata.Initialize() at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsStoreXamlPlatform.Initialize() at Microsoft.VisualStudio.DesignTools.Platform.PlatformCreatorBase.CreatePlatform(IPlatformReferenceAssemblyResolver referenceAssemblyResolver) at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform, Boolean create) at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetSourceItemContext(IHostSourceItem sourceItem) at Microsoft.VisualStudio.DesignTools.Designer.DesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass12_0.<Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__0(CancellationToken cancelToken) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass6_0`1.<MarshalInWithCancellation>b__0() at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker() System.NullReferenceException Object reference not set to an instance of an object. Server stack trace: at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalInSynchronous(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallModality callModality, String methodName, String filePath, Int32 lineNumber) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, String methodName, String filePath, Int32 lineNumber) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.MarshalInWithCancellation[TResult](IRemoteCancellationToken remoteToken, Func`2 func, ApartmentState apartmentState) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken remoteToken) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken cancelToken) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.CreateDesignerImpl(IRemoteDesignerService ds, IHostSourceItem item, IHostTextEditor editor, RemoteCancellationToken remoteCancelToken) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass14_0.<Microsoft.VisualStudio.DesignTools.DesignerContract.IDesignerService.CreateDesigner>b__0(IRemoteDesignerService ds, RemoteCancellationToken remoteToken) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass5_0`1.<MarshalOutWithCancellation>b__0(IRemoteDesignerService ds) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass27_0`1.<MarshalOut>b__0() at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker() System.NullReferenceException Object reference not set to an instance of an object. at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal, CancellationToken cancelToken, String methodName, String filePath, Int32 lineNumber) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CancellationToken cancelToken, CallSynchronizationMode syncMode, WaitHandle timeoutSignal, String methodName, String filePath, Int32 lineNumber) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action`1 action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.MarshalOutWithCancellation[TResult](CancellationToken cancelToken, Func`3 func, ApartmentState apartmentState) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.Microsoft.VisualStudio.DesignTools.DesignerContract.IDesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken) at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)


This just recent. This Visual Studio 2015 has just installed and almost never been in use. The last use was for creating a simple Web app in HTML.

Is there something wrong happened during the installation? I remembered having no problem installing this VS nor the UWP SDK


Metro Style on Windows 7

$
0
0

PresentationFramework.Aero2.dll does not come with .Net 4.5 on Windows 7.

My question is allowed to deploy local PresentationFramework.Aero2.dll to have metro style in my app?

Ellipse in ComboBox not updating when selected item changed.

$
0
0

Hello all,

I have a form, that uses a custom control; this control, basically, puts a colored circle then some text to the right.  I load all the options into a ComboBox and when an item is selected for the first time, it displays the correct colored circle and the correct text.  However, any other time a selection is made, only the text gets updated.  This is driving me nuts as I have no clue why this is happening.  Can someone shed some light on this for me?

User Control that displays circle and text:

<UserControl x:Class="WireTalk.Client.Views.Presence"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:WireTalk.Client.Views"
             Loaded="UserControl_Loaded"
             mc:Ignorable="d"><UserControl.Resources><Style x:Key="CircleButton"
               TargetType="Label"><Setter Property="OverridesDefaultStyle"
                    Value="True"/><Setter Property="Background"
                    Value="#FF6DB4EF"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="Label"><Grid><Ellipse Fill="{TemplateBinding Background}"
                                     RenderOptions.EdgeMode="Unspecified"/><Ellipse RenderOptions.EdgeMode="Unspecified"><Ellipse.Fill><RadialGradientBrush><GradientStop Offset="0"
                                                      Color="#00000000"/><GradientStop Offset="0.88"
                                                      Color="#00000000"/><GradientStop Offset="1"
                                                      Color="#80000000"/></RadialGradientBrush></Ellipse.Fill></Ellipse><Ellipse Margin="5"
                                     x:Name="highlightCircle"
                                     RenderOptions.EdgeMode="Unspecified"><Ellipse.Fill ><LinearGradientBrush ><GradientStop Offset="0"
                                                      Color="#50FFFFFF"/><GradientStop Offset="0.5"
                                                      Color="#00FFFFFF"/><GradientStop Offset="1"
                                                      Color="#50FFFFFF"/></LinearGradientBrush></Ellipse.Fill></Ellipse><ContentPresenter x:Name="content"
                                              HorizontalAlignment="Center"
                                              VerticalAlignment="Center"/></Grid></ControlTemplate></Setter.Value></Setter></Style></UserControl.Resources><Grid Name="grid"><Label Width="20"
               Height="20"
               Style="{StaticResource CircleButton}"
               Name="label"></Label></Grid></UserControl>


ComboBox using custom control:

<ComboBox Margin="5,0,5,5"
                  Height="40"
                  Name="box"
                  VerticalAlignment="Bottom"
                  VerticalContentAlignment="Center"
                  ItemsSource="{Binding Model.PresenceList}"><ComboBox.ItemTemplate><DataTemplate><StackPanel Orientation="Horizontal"><Custom:Presence Background="{Binding Color}"></Custom:Presence><TextBlock Margin="5,0,0,0"
                                   Text="{Binding Description}"></TextBlock></StackPanel></DataTemplate></ComboBox.ItemTemplate></ComboBox>

PresenceList is an ObservableCollection<PresenceModel>.
PresenceModel simply contains two string properties, Color and Description.

Thanks,
Corey


Any idea why Blend for Visual Studio is occasionally hidden from the Taskbar of Windows when Visual Studio is also open?

$
0
0

I can ALT-TAB to it and it shows as a blank rectangle in the ALT-TAB thumbnails when that issue occurs. Visual Studio 2015 RC Community, Windows 8.1 64. WPF. NET 4.6 Preview.

PS. I guess there might be another forum for it but I figured it's also specific to WPF development.

I can't reproduce it immediately. But it might happen after builds and runs. Not entirely sure.






wpf mvvm

$
0
0

Hello,
At present, listbox is populated with names and their IDs from database...
what is the best way to do the following in MVVM:
1- click on one of the names
2- using the selected ID, pass that to the database and retrieve the Address for that Name
3- populate textbox with address

Thanks

How to force a reevaluation of WindowStartupLocation="centerscreen" dual monitor setup.

$
0
0

I'm using a window that is using WindowStartupLocation="centerscreen" in a dual monitor setup.

However I'm hiding and showing the window. In the first show it display the window correctly in the monitor where the cursor is, however, in the second show and so forth the window is always showing at the same screen. 

My question is: how can I force the window to reevaluate the window startup location before each show?



Windows 10 Title Bar Extends into Window Frame with WindowStyle="None"

$
0
0

If I create a new WPF application and set the WindowStyle="None" on the main Window, I am now seeing in Windows 10 that there is still a 4 or 5 pixel title bar at the top of the Window. This does not show up in Window 7-8.1. Anyone else seen this and know how to get rid of it?

After creating a new project in VS2015, use the following XAML to see the issue:

<Window x:Class="No_Title_Bar_WPF.MainWindow"        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"        xmlns:local="clr-namespace:No_Title_Bar_WPF"        mc:Ignorable="d"        Background="#202020"        WindowStyle="None"        Title="MainWindow"        Height="350"        Width="525">    <Grid>        <Grid.RowDefinitions>            <RowDefinition Height="Auto"/>            <RowDefinition Height="*"/>        </Grid.RowDefinitions>        <TextBlock Grid.Row="0" Foreground="AliceBlue" FontSize="20" Text="WPF window with NO title bar"/>    </Grid></Window>

When I do this, I see the following:



Circular image box

$
0
0

How could I show images from database(profile photos), in a rounded box? More exactly in a circle container?

Like this:

And another small circle in the right corner of the image circle?(With a status signal for example?

Thank you


Valdirnm

Viewing all 18858 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>